pulumi_wasm_providers_gcp_mini::compute

Module region_network_endpoint_group

source
Expand description

A regional NEG that can support Serverless Products, proxying traffic to external backends and providing traffic to the PSC port mapping endpoints.

To get more information about RegionNetworkEndpointGroup, see:

§Example Usage

§Region Network Endpoint Group Functions

resources:
  # Cloud Functions Example
  functionNeg:
    type: gcp:compute:RegionNetworkEndpointGroup
    name: function_neg
    properties:
      name: function-neg
      networkEndpointType: SERVERLESS
      region: us-central1
      cloudFunction:
        function: ${functionNegFunction.name}
  functionNegFunction:
    type: gcp:cloudfunctions:Function
    name: function_neg
    properties:
      name: function-neg
      description: My function
      runtime: nodejs10
      availableMemoryMb: 128
      sourceArchiveBucket: ${bucket.name}
      sourceArchiveObject: ${archive.name}
      triggerHttp: true
      timeout: 60
      entryPoint: helloGET
  bucket:
    type: gcp:storage:Bucket
    properties:
      name: cloudfunctions-function-example-bucket
      location: US
  archive:
    type: gcp:storage:BucketObject
    properties:
      name: index.zip
      bucket: ${bucket.name}
      source:
        fn::FileAsset: path/to/index.zip

§Region Network Endpoint Group Cloudrun

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let cloudrunNeg = region_network_endpoint_group::create(
        "cloudrunNeg",
        RegionNetworkEndpointGroupArgs::builder()
            .cloud_run(
                RegionNetworkEndpointGroupCloudRun::builder()
                    .service("${cloudrunNegService.name}")
                    .build_struct(),
            )
            .name("cloudrun-neg")
            .network_endpoint_type("SERVERLESS")
            .region("us-central1")
            .build_struct(),
    );
    let cloudrunNegService = service::create(
        "cloudrunNegService",
        ServiceArgs::builder()
            .location("us-central1")
            .name("cloudrun-neg")
            .template(
                ServiceTemplate::builder()
                    .spec(
                        ServiceTemplateSpec::builder()
                            .containers(
                                vec![
                                    ServiceTemplateSpecContainer::builder()
                                    .image("us-docker.pkg.dev/cloudrun/container/hello")
                                    .build_struct(),
                                ],
                            )
                            .build_struct(),
                    )
                    .build_struct(),
            )
            .traffics(
                vec![
                    ServiceTraffic::builder().latestRevision(true).percent(100)
                    .build_struct(),
                ],
            )
            .build_struct(),
    );
}

§Region Network Endpoint Group Appengine

resources:
  # App Engine Example
  appengineNeg:
    type: gcp:compute:RegionNetworkEndpointGroup
    name: appengine_neg
    properties:
      name: appengine-neg
      networkEndpointType: SERVERLESS
      region: us-central1
      appEngine:
        service: ${appengineNegFlexibleAppVersion.service}
        version: ${appengineNegFlexibleAppVersion.versionId}
  appengineNegFlexibleAppVersion:
    type: gcp:appengine:FlexibleAppVersion
    name: appengine_neg
    properties:
      versionId: v1
      service: appengine-neg
      runtime: nodejs
      flexibleRuntimeSettings:
        operatingSystem: ubuntu22
        runtimeVersion: '20'
      entrypoint:
        shell: node ./app.js
      deployment:
        zip:
          sourceUrl: https://storage.googleapis.com/${appengineNegBucket.name}/${appengineNegBucketObject.name}
      livenessCheck:
        path: /
      readinessCheck:
        path: /
      envVariables:
        port: '8080'
      handlers:
        - urlRegex: .*\/my-path\/*
          securityLevel: SECURE_ALWAYS
          login: LOGIN_REQUIRED
          authFailAction: AUTH_FAIL_ACTION_REDIRECT
          staticFiles:
            path: my-other-path
            uploadPathRegex: .*\/my-path\/*
      automaticScaling:
        coolDownPeriod: 120s
        cpuUtilization:
          targetUtilization: 0.5
      deleteServiceOnDestroy: true
  appengineNegBucket:
    type: gcp:storage:Bucket
    name: appengine_neg
    properties:
      name: appengine-neg
      location: US
      uniformBucketLevelAccess: true
  appengineNegBucketObject:
    type: gcp:storage:BucketObject
    name: appengine_neg
    properties:
      name: hello-world.zip
      bucket: ${appengineNegBucket.name}
      source:
        fn::FileAsset: ./test-fixtures/hello-world.zip

§Region Network Endpoint Group Appengine Empty

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let appengineNeg = region_network_endpoint_group::create(
        "appengineNeg",
        RegionNetworkEndpointGroupArgs::builder()
            .app_engine(RegionNetworkEndpointGroupAppEngine::builder().build_struct())
            .name("appengine-neg")
            .network_endpoint_type("SERVERLESS")
            .region("us-central1")
            .build_struct(),
    );
}

§Region Network Endpoint Group Psc

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let pscNeg = region_network_endpoint_group::create(
        "pscNeg",
        RegionNetworkEndpointGroupArgs::builder()
            .name("psc-neg")
            .network_endpoint_type("PRIVATE_SERVICE_CONNECT")
            .psc_target_service("asia-northeast3-cloudkms.googleapis.com")
            .region("asia-northeast3")
            .build_struct(),
    );
}

§Region Network Endpoint Group Psc Service Attachment

resources:
  default:
    type: gcp:compute:Network
    properties:
      name: psc-network
  defaultSubnetwork:
    type: gcp:compute:Subnetwork
    name: default
    properties:
      name: psc-subnetwork
      ipCidrRange: 10.0.0.0/16
      region: europe-west4
      network: ${default.id}
  pscSubnetwork:
    type: gcp:compute:Subnetwork
    name: psc_subnetwork
    properties:
      name: psc-subnetwork-nat
      ipCidrRange: 10.1.0.0/16
      region: europe-west4
      purpose: PRIVATE_SERVICE_CONNECT
      network: ${default.id}
  defaultHealthCheck:
    type: gcp:compute:HealthCheck
    name: default
    properties:
      name: psc-healthcheck
      checkIntervalSec: 1
      timeoutSec: 1
      tcpHealthCheck:
        port: '80'
  defaultRegionBackendService:
    type: gcp:compute:RegionBackendService
    name: default
    properties:
      name: psc-backend
      region: europe-west4
      healthChecks: ${defaultHealthCheck.id}
  defaultForwardingRule:
    type: gcp:compute:ForwardingRule
    name: default
    properties:
      name: psc-forwarding-rule
      region: europe-west4
      loadBalancingScheme: INTERNAL
      backendService: ${defaultRegionBackendService.id}
      ports:
        - '80'
        - '88'
        - '443'
      network: ${default.name}
      subnetwork: ${defaultSubnetwork.name}
  defaultServiceAttachment:
    type: gcp:compute:ServiceAttachment
    name: default
    properties:
      name: psc-service-attachment
      region: europe-west4
      description: A service attachment configured with Terraform
      enableProxyProtocol: false
      connectionPreference: ACCEPT_AUTOMATIC
      natSubnets:
        - ${pscSubnetwork.selfLink}
      targetService: ${defaultForwardingRule.selfLink}
  pscNegServiceAttachment:
    type: gcp:compute:RegionNetworkEndpointGroup
    name: psc_neg_service_attachment
    properties:
      name: psc-neg
      region: europe-west4
      networkEndpointType: PRIVATE_SERVICE_CONNECT
      pscTargetService: ${defaultServiceAttachment.selfLink}
      pscData:
        producerPort: '88'
      network: ${default.selfLink}
      subnetwork: ${defaultSubnetwork.selfLink}

§Region Network Endpoint Group Internet Ip Port

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let default = network::create(
        "default",
        NetworkArgs::builder().name("network").build_struct(),
    );
    let regionNetworkEndpointGroupInternetIpPort = region_network_endpoint_group::create(
        "regionNetworkEndpointGroupInternetIpPort",
        RegionNetworkEndpointGroupArgs::builder()
            .name("ip-port-neg")
            .network("${default.id}")
            .network_endpoint_type("INTERNET_IP_PORT")
            .region("us-central1")
            .build_struct(),
    );
}

§Region Network Endpoint Group Internet Fqdn Port

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let default = network::create(
        "default",
        NetworkArgs::builder().name("network").build_struct(),
    );
    let regionNetworkEndpointGroupInternetFqdnPort = region_network_endpoint_group::create(
        "regionNetworkEndpointGroupInternetFqdnPort",
        RegionNetworkEndpointGroupArgs::builder()
            .name("ip-port-neg")
            .network("${default.id}")
            .network_endpoint_type("INTERNET_FQDN_PORT")
            .region("us-central1")
            .build_struct(),
    );
}

§Region Network Endpoint Group Portmap

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let default = network::create(
        "default",
        NetworkArgs::builder().name("network").build_struct(),
    );
    let defaultSubnetwork = subnetwork::create(
        "defaultSubnetwork",
        SubnetworkArgs::builder()
            .ip_cidr_range("10.0.0.0/16")
            .name("subnetwork")
            .network("${default.id}")
            .region("us-central1")
            .build_struct(),
    );
    let regionNetworkEndpointGroupPortmap = region_network_endpoint_group::create(
        "regionNetworkEndpointGroupPortmap",
        RegionNetworkEndpointGroupArgs::builder()
            .name("portmap-neg")
            .network("${default.id}")
            .network_endpoint_type("GCE_VM_IP_PORTMAP")
            .region("us-central1")
            .subnetwork("${defaultSubnetwork.id}")
            .build_struct(),
    );
}

§Import

RegionNetworkEndpointGroup can be imported using any of these accepted formats:

  • projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}}

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

$ pulumi import gcp:compute/regionNetworkEndpointGroup:RegionNetworkEndpointGroup default projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{name}}
$ pulumi import gcp:compute/regionNetworkEndpointGroup:RegionNetworkEndpointGroup default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/regionNetworkEndpointGroup:RegionNetworkEndpointGroup default {{region}}/{{name}}
$ pulumi import gcp:compute/regionNetworkEndpointGroup:RegionNetworkEndpointGroup default {{name}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments