1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. appengine
  5. ServiceNetworkSettings
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.appengine.ServiceNetworkSettings

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    A NetworkSettings resource is a container for ingress settings for a version or service.

    To get more information about ServiceNetworkSettings, see:

    Example Usage

    App Engine Service Network Settings

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const bucket = new gcp.storage.Bucket("bucket", {
        name: "appengine-static-content",
        location: "US",
    });
    const object = new gcp.storage.BucketObject("object", {
        name: "hello-world.zip",
        bucket: bucket.name,
        source: new pulumi.asset.FileAsset("./test-fixtures/hello-world.zip"),
    });
    const internalapp = new gcp.appengine.StandardAppVersion("internalapp", {
        versionId: "v1",
        service: "internalapp",
        deleteServiceOnDestroy: true,
        runtime: "nodejs20",
        entrypoint: {
            shell: "node ./app.js",
        },
        deployment: {
            zip: {
                sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
            },
        },
        envVariables: {
            port: "8080",
        },
    });
    const internalappServiceNetworkSettings = new gcp.appengine.ServiceNetworkSettings("internalapp", {
        service: internalapp.service,
        networkSettings: {
            ingressTrafficAllowed: "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    bucket = gcp.storage.Bucket("bucket",
        name="appengine-static-content",
        location="US")
    object = gcp.storage.BucketObject("object",
        name="hello-world.zip",
        bucket=bucket.name,
        source=pulumi.FileAsset("./test-fixtures/hello-world.zip"))
    internalapp = gcp.appengine.StandardAppVersion("internalapp",
        version_id="v1",
        service="internalapp",
        delete_service_on_destroy=True,
        runtime="nodejs20",
        entrypoint={
            "shell": "node ./app.js",
        },
        deployment={
            "zip": {
                "source_url": pulumi.Output.all(
                    bucketName=bucket.name,
                    objectName=object.name
    ).apply(lambda resolved_outputs: f"https://storage.googleapis.com/{resolved_outputs['bucketName']}/{resolved_outputs['objectName']}")
    ,
            },
        },
        env_variables={
            "port": "8080",
        })
    internalapp_service_network_settings = gcp.appengine.ServiceNetworkSettings("internalapp",
        service=internalapp.service,
        network_settings={
            "ingress_traffic_allowed": "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
        })
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/appengine"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
    			Name:     pulumi.String("appengine-static-content"),
    			Location: pulumi.String("US"),
    		})
    		if err != nil {
    			return err
    		}
    		object, err := storage.NewBucketObject(ctx, "object", &storage.BucketObjectArgs{
    			Name:   pulumi.String("hello-world.zip"),
    			Bucket: bucket.Name,
    			Source: pulumi.NewFileAsset("./test-fixtures/hello-world.zip"),
    		})
    		if err != nil {
    			return err
    		}
    		internalapp, err := appengine.NewStandardAppVersion(ctx, "internalapp", &appengine.StandardAppVersionArgs{
    			VersionId:              pulumi.String("v1"),
    			Service:                pulumi.String("internalapp"),
    			DeleteServiceOnDestroy: pulumi.Bool(true),
    			Runtime:                pulumi.String("nodejs20"),
    			Entrypoint: &appengine.StandardAppVersionEntrypointArgs{
    				Shell: pulumi.String("node ./app.js"),
    			},
    			Deployment: &appengine.StandardAppVersionDeploymentArgs{
    				Zip: &appengine.StandardAppVersionDeploymentZipArgs{
    					SourceUrl: pulumi.All(bucket.Name, object.Name).ApplyT(func(_args []interface{}) (string, error) {
    						bucketName := _args[0].(string)
    						objectName := _args[1].(string)
    						return fmt.Sprintf("https://storage.googleapis.com/%v/%v", bucketName, objectName), nil
    					}).(pulumi.StringOutput),
    				},
    			},
    			EnvVariables: pulumi.StringMap{
    				"port": pulumi.String("8080"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appengine.NewServiceNetworkSettings(ctx, "internalapp", &appengine.ServiceNetworkSettingsArgs{
    			Service: internalapp.Service,
    			NetworkSettings: &appengine.ServiceNetworkSettingsNetworkSettingsArgs{
    				IngressTrafficAllowed: pulumi.String("INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var bucket = new Gcp.Storage.Bucket("bucket", new()
        {
            Name = "appengine-static-content",
            Location = "US",
        });
    
        var @object = new Gcp.Storage.BucketObject("object", new()
        {
            Name = "hello-world.zip",
            Bucket = bucket.Name,
            Source = new FileAsset("./test-fixtures/hello-world.zip"),
        });
    
        var internalapp = new Gcp.AppEngine.StandardAppVersion("internalapp", new()
        {
            VersionId = "v1",
            Service = "internalapp",
            DeleteServiceOnDestroy = true,
            Runtime = "nodejs20",
            Entrypoint = new Gcp.AppEngine.Inputs.StandardAppVersionEntrypointArgs
            {
                Shell = "node ./app.js",
            },
            Deployment = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentArgs
            {
                Zip = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentZipArgs
                {
                    SourceUrl = Output.Tuple(bucket.Name, @object.Name).Apply(values =>
                    {
                        var bucketName = values.Item1;
                        var objectName = values.Item2;
                        return $"https://storage.googleapis.com/{bucketName}/{objectName}";
                    }),
                },
            },
            EnvVariables = 
            {
                { "port", "8080" },
            },
        });
    
        var internalappServiceNetworkSettings = new Gcp.AppEngine.ServiceNetworkSettings("internalapp", new()
        {
            Service = internalapp.Service,
            NetworkSettings = new Gcp.AppEngine.Inputs.ServiceNetworkSettingsNetworkSettingsArgs
            {
                IngressTrafficAllowed = "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.storage.Bucket;
    import com.pulumi.gcp.storage.BucketArgs;
    import com.pulumi.gcp.storage.BucketObject;
    import com.pulumi.gcp.storage.BucketObjectArgs;
    import com.pulumi.gcp.appengine.StandardAppVersion;
    import com.pulumi.gcp.appengine.StandardAppVersionArgs;
    import com.pulumi.gcp.appengine.inputs.StandardAppVersionEntrypointArgs;
    import com.pulumi.gcp.appengine.inputs.StandardAppVersionDeploymentArgs;
    import com.pulumi.gcp.appengine.inputs.StandardAppVersionDeploymentZipArgs;
    import com.pulumi.gcp.appengine.ServiceNetworkSettings;
    import com.pulumi.gcp.appengine.ServiceNetworkSettingsArgs;
    import com.pulumi.gcp.appengine.inputs.ServiceNetworkSettingsNetworkSettingsArgs;
    import com.pulumi.asset.FileAsset;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var bucket = new Bucket("bucket", BucketArgs.builder()
                .name("appengine-static-content")
                .location("US")
                .build());
    
            var object = new BucketObject("object", BucketObjectArgs.builder()
                .name("hello-world.zip")
                .bucket(bucket.name())
                .source(new FileAsset("./test-fixtures/hello-world.zip"))
                .build());
    
            var internalapp = new StandardAppVersion("internalapp", StandardAppVersionArgs.builder()
                .versionId("v1")
                .service("internalapp")
                .deleteServiceOnDestroy(true)
                .runtime("nodejs20")
                .entrypoint(StandardAppVersionEntrypointArgs.builder()
                    .shell("node ./app.js")
                    .build())
                .deployment(StandardAppVersionDeploymentArgs.builder()
                    .zip(StandardAppVersionDeploymentZipArgs.builder()
                        .sourceUrl(Output.tuple(bucket.name(), object.name()).applyValue(values -> {
                            var bucketName = values.t1;
                            var objectName = values.t2;
                            return String.format("https://storage.googleapis.com/%s/%s", bucketName,objectName);
                        }))
                        .build())
                    .build())
                .envVariables(Map.of("port", "8080"))
                .build());
    
            var internalappServiceNetworkSettings = new ServiceNetworkSettings("internalappServiceNetworkSettings", ServiceNetworkSettingsArgs.builder()
                .service(internalapp.service())
                .networkSettings(ServiceNetworkSettingsNetworkSettingsArgs.builder()
                    .ingressTrafficAllowed("INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY")
                    .build())
                .build());
    
        }
    }
    
    resources:
      bucket:
        type: gcp:storage:Bucket
        properties:
          name: appengine-static-content
          location: US
      object:
        type: gcp:storage:BucketObject
        properties:
          name: hello-world.zip
          bucket: ${bucket.name}
          source:
            fn::FileAsset: ./test-fixtures/hello-world.zip
      internalapp:
        type: gcp:appengine:StandardAppVersion
        properties:
          versionId: v1
          service: internalapp
          deleteServiceOnDestroy: true
          runtime: nodejs20
          entrypoint:
            shell: node ./app.js
          deployment:
            zip:
              sourceUrl: https://storage.googleapis.com/${bucket.name}/${object.name}
          envVariables:
            port: '8080'
      internalappServiceNetworkSettings:
        type: gcp:appengine:ServiceNetworkSettings
        name: internalapp
        properties:
          service: ${internalapp.service}
          networkSettings:
            ingressTrafficAllowed: INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY
    

    Create ServiceNetworkSettings Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServiceNetworkSettings(name: string, args: ServiceNetworkSettingsArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceNetworkSettings(resource_name: str,
                               args: ServiceNetworkSettingsArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceNetworkSettings(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               network_settings: Optional[ServiceNetworkSettingsNetworkSettingsArgs] = None,
                               service: Optional[str] = None,
                               project: Optional[str] = None)
    func NewServiceNetworkSettings(ctx *Context, name string, args ServiceNetworkSettingsArgs, opts ...ResourceOption) (*ServiceNetworkSettings, error)
    public ServiceNetworkSettings(string name, ServiceNetworkSettingsArgs args, CustomResourceOptions? opts = null)
    public ServiceNetworkSettings(String name, ServiceNetworkSettingsArgs args)
    public ServiceNetworkSettings(String name, ServiceNetworkSettingsArgs args, CustomResourceOptions options)
    
    type: gcp:appengine:ServiceNetworkSettings
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServiceNetworkSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceNetworkSettingsArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceNetworkSettingsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceNetworkSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceNetworkSettingsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serviceNetworkSettingsResource = new Gcp.AppEngine.ServiceNetworkSettings("serviceNetworkSettingsResource", new()
    {
        NetworkSettings = new Gcp.AppEngine.Inputs.ServiceNetworkSettingsNetworkSettingsArgs
        {
            IngressTrafficAllowed = "string",
        },
        Service = "string",
        Project = "string",
    });
    
    example, err := appengine.NewServiceNetworkSettings(ctx, "serviceNetworkSettingsResource", &appengine.ServiceNetworkSettingsArgs{
    	NetworkSettings: &appengine.ServiceNetworkSettingsNetworkSettingsArgs{
    		IngressTrafficAllowed: pulumi.String("string"),
    	},
    	Service: pulumi.String("string"),
    	Project: pulumi.String("string"),
    })
    
    var serviceNetworkSettingsResource = new ServiceNetworkSettings("serviceNetworkSettingsResource", ServiceNetworkSettingsArgs.builder()
        .networkSettings(ServiceNetworkSettingsNetworkSettingsArgs.builder()
            .ingressTrafficAllowed("string")
            .build())
        .service("string")
        .project("string")
        .build());
    
    service_network_settings_resource = gcp.appengine.ServiceNetworkSettings("serviceNetworkSettingsResource",
        network_settings={
            "ingress_traffic_allowed": "string",
        },
        service="string",
        project="string")
    
    const serviceNetworkSettingsResource = new gcp.appengine.ServiceNetworkSettings("serviceNetworkSettingsResource", {
        networkSettings: {
            ingressTrafficAllowed: "string",
        },
        service: "string",
        project: "string",
    });
    
    type: gcp:appengine:ServiceNetworkSettings
    properties:
        networkSettings:
            ingressTrafficAllowed: string
        project: string
        service: string
    

    ServiceNetworkSettings Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ServiceNetworkSettings resource accepts the following input properties:

    NetworkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    Service string
    The name of the service these settings apply to.
    Project string
    NetworkSettings ServiceNetworkSettingsNetworkSettingsArgs
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    Service string
    The name of the service these settings apply to.
    Project string
    networkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    service String
    The name of the service these settings apply to.
    project String
    networkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    service string
    The name of the service these settings apply to.
    project string
    network_settings ServiceNetworkSettingsNetworkSettingsArgs
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    service str
    The name of the service these settings apply to.
    project str
    networkSettings Property Map
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    service String
    The name of the service these settings apply to.
    project String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ServiceNetworkSettings resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ServiceNetworkSettings Resource

    Get an existing ServiceNetworkSettings resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ServiceNetworkSettingsState, opts?: CustomResourceOptions): ServiceNetworkSettings
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            network_settings: Optional[ServiceNetworkSettingsNetworkSettingsArgs] = None,
            project: Optional[str] = None,
            service: Optional[str] = None) -> ServiceNetworkSettings
    func GetServiceNetworkSettings(ctx *Context, name string, id IDInput, state *ServiceNetworkSettingsState, opts ...ResourceOption) (*ServiceNetworkSettings, error)
    public static ServiceNetworkSettings Get(string name, Input<string> id, ServiceNetworkSettingsState? state, CustomResourceOptions? opts = null)
    public static ServiceNetworkSettings get(String name, Output<String> id, ServiceNetworkSettingsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    NetworkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    Project string
    Service string
    The name of the service these settings apply to.
    NetworkSettings ServiceNetworkSettingsNetworkSettingsArgs
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    Project string
    Service string
    The name of the service these settings apply to.
    networkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    project String
    service String
    The name of the service these settings apply to.
    networkSettings ServiceNetworkSettingsNetworkSettings
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    project string
    service string
    The name of the service these settings apply to.
    network_settings ServiceNetworkSettingsNetworkSettingsArgs
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    project str
    service str
    The name of the service these settings apply to.
    networkSettings Property Map
    Ingress settings for this service. Will apply to all versions. Structure is documented below.
    project String
    service String
    The name of the service these settings apply to.

    Supporting Types

    ServiceNetworkSettingsNetworkSettings, ServiceNetworkSettingsNetworkSettingsArgs

    IngressTrafficAllowed string
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    IngressTrafficAllowed string
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    ingressTrafficAllowed String
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    ingressTrafficAllowed string
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    ingress_traffic_allowed str
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    ingressTrafficAllowed String
    The ingress settings for version or service. Default value is INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED. Possible values are: INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED, INGRESS_TRAFFIC_ALLOWED_ALL, INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY, INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.


    Import

    ServiceNetworkSettings can be imported using any of these accepted formats:

    • apps/{{project}}/services/{{service}}

    • {{project}}/{{service}}

    • {{service}}

    When using the pulumi import command, ServiceNetworkSettings can be imported using one of the formats above. For example:

    $ pulumi import gcp:appengine/serviceNetworkSettings:ServiceNetworkSettings default apps/{{project}}/services/{{service}}
    
    $ pulumi import gcp:appengine/serviceNetworkSettings:ServiceNetworkSettings default {{project}}/{{service}}
    
    $ pulumi import gcp:appengine/serviceNetworkSettings:ServiceNetworkSettings default {{service}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi