Google Cloud (GCP) Classic

v6.39.0 published on Wednesday, Sep 28, 2022 by Pulumi

ServiceNetworkSettings

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

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var bucket = new Gcp.Storage.Bucket("bucket", new()
    {
        Location = "US",
    });

    var @object = new Gcp.Storage.BucketObject("object", new()
    {
        Bucket = bucket.Name,
        Source = new FileAsset("./test-fixtures/appengine/hello-world.zip"),
    });

    var liveappV1 = new Gcp.AppEngine.StandardAppVersion("liveappV1", new()
    {
        VersionId = "v1",
        Service = "liveapp",
        DeleteServiceOnDestroy = true,
        Runtime = "nodejs10",
        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 liveapp = new Gcp.AppEngine.ServiceNetworkSettings("liveapp", new()
    {
        Service = liveappV1.Service,
        NetworkSettings = new Gcp.AppEngine.Inputs.ServiceNetworkSettingsNetworkSettingsArgs
        {
            IngressTrafficAllowed = "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/appengine"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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{
			Location: pulumi.String("US"),
		})
		if err != nil {
			return err
		}
		object, err := storage.NewBucketObject(ctx, "object", &storage.BucketObjectArgs{
			Bucket: bucket.Name,
			Source: pulumi.NewFileAsset("./test-fixtures/appengine/hello-world.zip"),
		})
		if err != nil {
			return err
		}
		liveappV1, err := appengine.NewStandardAppVersion(ctx, "liveappV1", &appengine.StandardAppVersionArgs{
			VersionId:              pulumi.String("v1"),
			Service:                pulumi.String("liveapp"),
			DeleteServiceOnDestroy: pulumi.Bool(true),
			Runtime:                pulumi.String("nodejs10"),
			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, "liveapp", &appengine.ServiceNetworkSettingsArgs{
			Service: liveappV1.Service,
			NetworkSettings: &appengine.ServiceNetworkSettingsNetworkSettingsArgs{
				IngressTrafficAllowed: pulumi.String("INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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()        
            .location("US")
            .build());

        var object = new BucketObject("object", BucketObjectArgs.builder()        
            .bucket(bucket.name())
            .source(new FileAsset("./test-fixtures/appengine/hello-world.zip"))
            .build());

        var liveappV1 = new StandardAppVersion("liveappV1", StandardAppVersionArgs.builder()        
            .versionId("v1")
            .service("liveapp")
            .deleteServiceOnDestroy(true)
            .runtime("nodejs10")
            .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 liveapp = new ServiceNetworkSettings("liveapp", ServiceNetworkSettingsArgs.builder()        
            .service(liveappV1.service())
            .networkSettings(ServiceNetworkSettingsNetworkSettingsArgs.builder()
                .ingressTrafficAllowed("INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY")
                .build())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

bucket = gcp.storage.Bucket("bucket", location="US")
object = gcp.storage.BucketObject("object",
    bucket=bucket.name,
    source=pulumi.FileAsset("./test-fixtures/appengine/hello-world.zip"))
liveapp_v1 = gcp.appengine.StandardAppVersion("liveappV1",
    version_id="v1",
    service="liveapp",
    delete_service_on_destroy=True,
    runtime="nodejs10",
    entrypoint=gcp.appengine.StandardAppVersionEntrypointArgs(
        shell="node ./app.js",
    ),
    deployment=gcp.appengine.StandardAppVersionDeploymentArgs(
        zip=gcp.appengine.StandardAppVersionDeploymentZipArgs(
            source_url=pulumi.Output.all(bucket.name, object.name).apply(lambda bucketName, objectName: f"https://storage.googleapis.com/{bucket_name}/{object_name}"),
        ),
    ),
    env_variables={
        "port": "8080",
    })
liveapp = gcp.appengine.ServiceNetworkSettings("liveapp",
    service=liveapp_v1.service,
    network_settings=gcp.appengine.ServiceNetworkSettingsNetworkSettingsArgs(
        ingress_traffic_allowed="INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const bucket = new gcp.storage.Bucket("bucket", {location: "US"});
const object = new gcp.storage.BucketObject("object", {
    bucket: bucket.name,
    source: new pulumi.asset.FileAsset("./test-fixtures/appengine/hello-world.zip"),
});
const liveappV1 = new gcp.appengine.StandardAppVersion("liveappV1", {
    versionId: "v1",
    service: "liveapp",
    deleteServiceOnDestroy: true,
    runtime: "nodejs10",
    entrypoint: {
        shell: "node ./app.js",
    },
    deployment: {
        zip: {
            sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
        },
    },
    envVariables: {
        port: "8080",
    },
});
const liveapp = new gcp.appengine.ServiceNetworkSettings("liveapp", {
    service: liveappV1.service,
    networkSettings: {
        ingressTrafficAllowed: "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY",
    },
});
resources:
  bucket:
    type: gcp:storage:Bucket
    properties:
      location: US
  object:
    type: gcp:storage:BucketObject
    properties:
      bucket: ${bucket.name}
      source:
        Fn::FileAsset: ./test-fixtures/appengine/hello-world.zip
  liveappV1:
    type: gcp:appengine:StandardAppVersion
    properties:
      versionId: v1
      service: liveapp
      deleteServiceOnDestroy: true
      runtime: nodejs10
      entrypoint:
        shell: node ./app.js
      deployment:
        zip:
          sourceUrl: https://storage.googleapis.com/${bucket.name}/${object.name}
      envVariables:
        port: 8080
  liveapp:
    type: gcp:appengine:ServiceNetworkSettings
    properties:
      service: ${liveappV1.service}
      networkSettings:
        ingressTrafficAllowed: INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY

Create a ServiceNetworkSettings Resource

new ServiceNetworkSettings(name: string, args: ServiceNetworkSettingsArgs, opts?: CustomResourceOptions);
@overload
def ServiceNetworkSettings(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           network_settings: Optional[ServiceNetworkSettingsNetworkSettingsArgs] = None,
                           project: Optional[str] = None,
                           service: Optional[str] = None)
@overload
def ServiceNetworkSettings(resource_name: str,
                           args: ServiceNetworkSettingsArgs,
                           opts: Optional[ResourceOptions] = 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.

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.

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

The ServiceNetworkSettings resource accepts the following input properties:

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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 an 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 ServiceNetworkSettingsNetworkSettingsArgs

Ingress settings for this service. Will apply to all versions. Structure is documented below.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

service String

The name of the service these settings apply to.

Supporting Types

ServiceNetworkSettingsNetworkSettings

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, and 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, and 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, and 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, and 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, and 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, and INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB.

Import

ServiceNetworkSettings can be imported using any of these accepted formats

 $ 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}}

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.