com.pulumi.gcp.compute.kotlin.ServiceAttachment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.ServiceAttachmentConnectedEndpoint
import com.pulumi.gcp.compute.kotlin.outputs.ServiceAttachmentConsumerAcceptList
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.compute.kotlin.outputs.ServiceAttachmentConnectedEndpoint.Companion.toKotlin as serviceAttachmentConnectedEndpointToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.ServiceAttachmentConsumerAcceptList.Companion.toKotlin as serviceAttachmentConsumerAcceptListToKotlin
/**
* Builder for [ServiceAttachment].
*/
@PulumiTagMarker
public class ServiceAttachmentResourceBuilder internal constructor() {
public var name: String? = null
public var args: ServiceAttachmentArgs = ServiceAttachmentArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend ServiceAttachmentArgsBuilder.() -> Unit) {
val builder = ServiceAttachmentArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): ServiceAttachment {
val builtJavaResource = com.pulumi.gcp.compute.ServiceAttachment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ServiceAttachment(builtJavaResource)
}
}
/**
* Represents a ServiceAttachment resource.
* To get more information about ServiceAttachment, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/beta/serviceAttachments)
* * How-to Guides
* * [Configuring Private Service Connect to access services](https://cloud.google.com/vpc/docs/configure-private-service-connect-services)
* ## Example Usage
* ### Service Attachment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const producerServiceHealthCheck = new gcp.compute.HealthCheck("producer_service_health_check", {
* name: "producer-service-health-check",
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* });
* const producerServiceBackend = new gcp.compute.RegionBackendService("producer_service_backend", {
* name: "producer-service",
* region: "us-west2",
* healthChecks: producerServiceHealthCheck.id,
* });
* const pscIlbNetwork = new gcp.compute.Network("psc_ilb_network", {
* name: "psc-ilb-network",
* autoCreateSubnetworks: false,
* });
* const pscIlbProducerSubnetwork = new gcp.compute.Subnetwork("psc_ilb_producer_subnetwork", {
* name: "psc-ilb-producer-subnetwork",
* region: "us-west2",
* network: pscIlbNetwork.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const pscIlbTargetService = new gcp.compute.ForwardingRule("psc_ilb_target_service", {
* name: "producer-forwarding-rule",
* region: "us-west2",
* loadBalancingScheme: "INTERNAL",
* backendService: producerServiceBackend.id,
* allPorts: true,
* network: pscIlbNetwork.name,
* subnetwork: pscIlbProducerSubnetwork.name,
* });
* const pscIlbNat = new gcp.compute.Subnetwork("psc_ilb_nat", {
* name: "psc-ilb-nat",
* region: "us-west2",
* network: pscIlbNetwork.id,
* purpose: "PRIVATE_SERVICE_CONNECT",
* ipCidrRange: "10.1.0.0/16",
* });
* const pscIlbServiceAttachment = new gcp.compute.ServiceAttachment("psc_ilb_service_attachment", {
* name: "my-psc-ilb",
* region: "us-west2",
* description: "A service attachment configured with Terraform",
* domainNames: ["gcp.tfacc.hashicorptest.com."],
* enableProxyProtocol: true,
* connectionPreference: "ACCEPT_AUTOMATIC",
* natSubnets: [pscIlbNat.id],
* targetService: pscIlbTargetService.id,
* });
* const pscIlbConsumerAddress = new gcp.compute.Address("psc_ilb_consumer_address", {
* name: "psc-ilb-consumer-address",
* region: "us-west2",
* subnetwork: "default",
* addressType: "INTERNAL",
* });
* const pscIlbConsumer = new gcp.compute.ForwardingRule("psc_ilb_consumer", {
* name: "psc-ilb-consumer-forwarding-rule",
* region: "us-west2",
* target: pscIlbServiceAttachment.id,
* loadBalancingScheme: "",
* network: "default",
* ipAddress: pscIlbConsumerAddress.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* producer_service_health_check = gcp.compute.HealthCheck("producer_service_health_check",
* name="producer-service-health-check",
* check_interval_sec=1,
* timeout_sec=1,
* tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
* port=80,
* ))
* producer_service_backend = gcp.compute.RegionBackendService("producer_service_backend",
* name="producer-service",
* region="us-west2",
* health_checks=producer_service_health_check.id)
* psc_ilb_network = gcp.compute.Network("psc_ilb_network",
* name="psc-ilb-network",
* auto_create_subnetworks=False)
* psc_ilb_producer_subnetwork = gcp.compute.Subnetwork("psc_ilb_producer_subnetwork",
* name="psc-ilb-producer-subnetwork",
* region="us-west2",
* network=psc_ilb_network.id,
* ip_cidr_range="10.0.0.0/16")
* psc_ilb_target_service = gcp.compute.ForwardingRule("psc_ilb_target_service",
* name="producer-forwarding-rule",
* region="us-west2",
* load_balancing_scheme="INTERNAL",
* backend_service=producer_service_backend.id,
* all_ports=True,
* network=psc_ilb_network.name,
* subnetwork=psc_ilb_producer_subnetwork.name)
* psc_ilb_nat = gcp.compute.Subnetwork("psc_ilb_nat",
* name="psc-ilb-nat",
* region="us-west2",
* network=psc_ilb_network.id,
* purpose="PRIVATE_SERVICE_CONNECT",
* ip_cidr_range="10.1.0.0/16")
* psc_ilb_service_attachment = gcp.compute.ServiceAttachment("psc_ilb_service_attachment",
* name="my-psc-ilb",
* region="us-west2",
* description="A service attachment configured with Terraform",
* domain_names=["gcp.tfacc.hashicorptest.com."],
* enable_proxy_protocol=True,
* connection_preference="ACCEPT_AUTOMATIC",
* nat_subnets=[psc_ilb_nat.id],
* target_service=psc_ilb_target_service.id)
* psc_ilb_consumer_address = gcp.compute.Address("psc_ilb_consumer_address",
* name="psc-ilb-consumer-address",
* region="us-west2",
* subnetwork="default",
* address_type="INTERNAL")
* psc_ilb_consumer = gcp.compute.ForwardingRule("psc_ilb_consumer",
* name="psc-ilb-consumer-forwarding-rule",
* region="us-west2",
* target=psc_ilb_service_attachment.id,
* load_balancing_scheme="",
* network="default",
* ip_address=psc_ilb_consumer_address.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var producerServiceHealthCheck = new Gcp.Compute.HealthCheck("producer_service_health_check", new()
* {
* Name = "producer-service-health-check",
* CheckIntervalSec = 1,
* TimeoutSec = 1,
* TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
* {
* Port = 80,
* },
* });
* var producerServiceBackend = new Gcp.Compute.RegionBackendService("producer_service_backend", new()
* {
* Name = "producer-service",
* Region = "us-west2",
* HealthChecks = producerServiceHealthCheck.Id,
* });
* var pscIlbNetwork = new Gcp.Compute.Network("psc_ilb_network", new()
* {
* Name = "psc-ilb-network",
* AutoCreateSubnetworks = false,
* });
* var pscIlbProducerSubnetwork = new Gcp.Compute.Subnetwork("psc_ilb_producer_subnetwork", new()
* {
* Name = "psc-ilb-producer-subnetwork",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* IpCidrRange = "10.0.0.0/16",
* });
* var pscIlbTargetService = new Gcp.Compute.ForwardingRule("psc_ilb_target_service", new()
* {
* Name = "producer-forwarding-rule",
* Region = "us-west2",
* LoadBalancingScheme = "INTERNAL",
* BackendService = producerServiceBackend.Id,
* AllPorts = true,
* Network = pscIlbNetwork.Name,
* Subnetwork = pscIlbProducerSubnetwork.Name,
* });
* var pscIlbNat = new Gcp.Compute.Subnetwork("psc_ilb_nat", new()
* {
* Name = "psc-ilb-nat",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* Purpose = "PRIVATE_SERVICE_CONNECT",
* IpCidrRange = "10.1.0.0/16",
* });
* var pscIlbServiceAttachment = new Gcp.Compute.ServiceAttachment("psc_ilb_service_attachment", new()
* {
* Name = "my-psc-ilb",
* Region = "us-west2",
* Description = "A service attachment configured with Terraform",
* DomainNames = new[]
* {
* "gcp.tfacc.hashicorptest.com.",
* },
* EnableProxyProtocol = true,
* ConnectionPreference = "ACCEPT_AUTOMATIC",
* NatSubnets = new[]
* {
* pscIlbNat.Id,
* },
* TargetService = pscIlbTargetService.Id,
* });
* var pscIlbConsumerAddress = new Gcp.Compute.Address("psc_ilb_consumer_address", new()
* {
* Name = "psc-ilb-consumer-address",
* Region = "us-west2",
* Subnetwork = "default",
* AddressType = "INTERNAL",
* });
* var pscIlbConsumer = new Gcp.Compute.ForwardingRule("psc_ilb_consumer", new()
* {
* Name = "psc-ilb-consumer-forwarding-rule",
* Region = "us-west2",
* Target = pscIlbServiceAttachment.Id,
* LoadBalancingScheme = "",
* Network = "default",
* IpAddress = pscIlbConsumerAddress.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* producerServiceHealthCheck, err := compute.NewHealthCheck(ctx, "producer_service_health_check", &compute.HealthCheckArgs{
* Name: pulumi.String("producer-service-health-check"),
* CheckIntervalSec: pulumi.Int(1),
* TimeoutSec: pulumi.Int(1),
* TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
* Port: pulumi.Int(80),
* },
* })
* if err != nil {
* return err
* }
* producerServiceBackend, err := compute.NewRegionBackendService(ctx, "producer_service_backend", &compute.RegionBackendServiceArgs{
* Name: pulumi.String("producer-service"),
* Region: pulumi.String("us-west2"),
* HealthChecks: producerServiceHealthCheck.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbNetwork, err := compute.NewNetwork(ctx, "psc_ilb_network", &compute.NetworkArgs{
* Name: pulumi.String("psc-ilb-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* pscIlbProducerSubnetwork, err := compute.NewSubnetwork(ctx, "psc_ilb_producer_subnetwork", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-producer-subnetwork"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbTargetService, err := compute.NewForwardingRule(ctx, "psc_ilb_target_service", &compute.ForwardingRuleArgs{
* Name: pulumi.String("producer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* LoadBalancingScheme: pulumi.String("INTERNAL"),
* BackendService: producerServiceBackend.ID(),
* AllPorts: pulumi.Bool(true),
* Network: pscIlbNetwork.Name,
* Subnetwork: pscIlbProducerSubnetwork.Name,
* })
* if err != nil {
* return err
* }
* pscIlbNat, err := compute.NewSubnetwork(ctx, "psc_ilb_nat", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-nat"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* Purpose: pulumi.String("PRIVATE_SERVICE_CONNECT"),
* IpCidrRange: pulumi.String("10.1.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbServiceAttachment, err := compute.NewServiceAttachment(ctx, "psc_ilb_service_attachment", &compute.ServiceAttachmentArgs{
* Name: pulumi.String("my-psc-ilb"),
* Region: pulumi.String("us-west2"),
* Description: pulumi.String("A service attachment configured with Terraform"),
* DomainNames: pulumi.StringArray{
* pulumi.String("gcp.tfacc.hashicorptest.com."),
* },
* EnableProxyProtocol: pulumi.Bool(true),
* ConnectionPreference: pulumi.String("ACCEPT_AUTOMATIC"),
* NatSubnets: pulumi.StringArray{
* pscIlbNat.ID(),
* },
* TargetService: pscIlbTargetService.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbConsumerAddress, err := compute.NewAddress(ctx, "psc_ilb_consumer_address", &compute.AddressArgs{
* Name: pulumi.String("psc-ilb-consumer-address"),
* Region: pulumi.String("us-west2"),
* Subnetwork: pulumi.String("default"),
* AddressType: pulumi.String("INTERNAL"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewForwardingRule(ctx, "psc_ilb_consumer", &compute.ForwardingRuleArgs{
* Name: pulumi.String("psc-ilb-consumer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* Target: pscIlbServiceAttachment.ID(),
* LoadBalancingScheme: pulumi.String(""),
* Network: pulumi.String("default"),
* IpAddress: pscIlbConsumerAddress.ID(),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.HealthCheck;
* import com.pulumi.gcp.compute.HealthCheckArgs;
* import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
* import com.pulumi.gcp.compute.RegionBackendService;
* import com.pulumi.gcp.compute.RegionBackendServiceArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.ForwardingRule;
* import com.pulumi.gcp.compute.ForwardingRuleArgs;
* import com.pulumi.gcp.compute.ServiceAttachment;
* import com.pulumi.gcp.compute.ServiceAttachmentArgs;
* import com.pulumi.gcp.compute.Address;
* import com.pulumi.gcp.compute.AddressArgs;
* 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 producerServiceHealthCheck = new HealthCheck("producerServiceHealthCheck", HealthCheckArgs.builder()
* .name("producer-service-health-check")
* .checkIntervalSec(1)
* .timeoutSec(1)
* .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
* .port("80")
* .build())
* .build());
* var producerServiceBackend = new RegionBackendService("producerServiceBackend", RegionBackendServiceArgs.builder()
* .name("producer-service")
* .region("us-west2")
* .healthChecks(producerServiceHealthCheck.id())
* .build());
* var pscIlbNetwork = new Network("pscIlbNetwork", NetworkArgs.builder()
* .name("psc-ilb-network")
* .autoCreateSubnetworks(false)
* .build());
* var pscIlbProducerSubnetwork = new Subnetwork("pscIlbProducerSubnetwork", SubnetworkArgs.builder()
* .name("psc-ilb-producer-subnetwork")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .ipCidrRange("10.0.0.0/16")
* .build());
* var pscIlbTargetService = new ForwardingRule("pscIlbTargetService", ForwardingRuleArgs.builder()
* .name("producer-forwarding-rule")
* .region("us-west2")
* .loadBalancingScheme("INTERNAL")
* .backendService(producerServiceBackend.id())
* .allPorts(true)
* .network(pscIlbNetwork.name())
* .subnetwork(pscIlbProducerSubnetwork.name())
* .build());
* var pscIlbNat = new Subnetwork("pscIlbNat", SubnetworkArgs.builder()
* .name("psc-ilb-nat")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .purpose("PRIVATE_SERVICE_CONNECT")
* .ipCidrRange("10.1.0.0/16")
* .build());
* var pscIlbServiceAttachment = new ServiceAttachment("pscIlbServiceAttachment", ServiceAttachmentArgs.builder()
* .name("my-psc-ilb")
* .region("us-west2")
* .description("A service attachment configured with Terraform")
* .domainNames("gcp.tfacc.hashicorptest.com.")
* .enableProxyProtocol(true)
* .connectionPreference("ACCEPT_AUTOMATIC")
* .natSubnets(pscIlbNat.id())
* .targetService(pscIlbTargetService.id())
* .build());
* var pscIlbConsumerAddress = new Address("pscIlbConsumerAddress", AddressArgs.builder()
* .name("psc-ilb-consumer-address")
* .region("us-west2")
* .subnetwork("default")
* .addressType("INTERNAL")
* .build());
* var pscIlbConsumer = new ForwardingRule("pscIlbConsumer", ForwardingRuleArgs.builder()
* .name("psc-ilb-consumer-forwarding-rule")
* .region("us-west2")
* .target(pscIlbServiceAttachment.id())
* .loadBalancingScheme("")
* .network("default")
* .ipAddress(pscIlbConsumerAddress.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* pscIlbServiceAttachment:
* type: gcp:compute:ServiceAttachment
* name: psc_ilb_service_attachment
* properties:
* name: my-psc-ilb
* region: us-west2
* description: A service attachment configured with Terraform
* domainNames:
* - gcp.tfacc.hashicorptest.com.
* enableProxyProtocol: true
* connectionPreference: ACCEPT_AUTOMATIC
* natSubnets:
* - ${pscIlbNat.id}
* targetService: ${pscIlbTargetService.id}
* pscIlbConsumerAddress:
* type: gcp:compute:Address
* name: psc_ilb_consumer_address
* properties:
* name: psc-ilb-consumer-address
* region: us-west2
* subnetwork: default
* addressType: INTERNAL
* pscIlbConsumer:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_consumer
* properties:
* name: psc-ilb-consumer-forwarding-rule
* region: us-west2
* target: ${pscIlbServiceAttachment.id}
* loadBalancingScheme:
* network: default
* ipAddress: ${pscIlbConsumerAddress.id}
* pscIlbTargetService:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_target_service
* properties:
* name: producer-forwarding-rule
* region: us-west2
* loadBalancingScheme: INTERNAL
* backendService: ${producerServiceBackend.id}
* allPorts: true
* network: ${pscIlbNetwork.name}
* subnetwork: ${pscIlbProducerSubnetwork.name}
* producerServiceBackend:
* type: gcp:compute:RegionBackendService
* name: producer_service_backend
* properties:
* name: producer-service
* region: us-west2
* healthChecks: ${producerServiceHealthCheck.id}
* producerServiceHealthCheck:
* type: gcp:compute:HealthCheck
* name: producer_service_health_check
* properties:
* name: producer-service-health-check
* checkIntervalSec: 1
* timeoutSec: 1
* tcpHealthCheck:
* port: '80'
* pscIlbNetwork:
* type: gcp:compute:Network
* name: psc_ilb_network
* properties:
* name: psc-ilb-network
* autoCreateSubnetworks: false
* pscIlbProducerSubnetwork:
* type: gcp:compute:Subnetwork
* name: psc_ilb_producer_subnetwork
* properties:
* name: psc-ilb-producer-subnetwork
* region: us-west2
* network: ${pscIlbNetwork.id}
* ipCidrRange: 10.0.0.0/16
* pscIlbNat:
* type: gcp:compute:Subnetwork
* name: psc_ilb_nat
* properties:
* name: psc-ilb-nat
* region: us-west2
* network: ${pscIlbNetwork.id}
* purpose: PRIVATE_SERVICE_CONNECT
* ipCidrRange: 10.1.0.0/16
* ```
*
* ### Service Attachment Explicit Projects
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const producerServiceHealthCheck = new gcp.compute.HealthCheck("producer_service_health_check", {
* name: "producer-service-health-check",
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* });
* const producerServiceBackend = new gcp.compute.RegionBackendService("producer_service_backend", {
* name: "producer-service",
* region: "us-west2",
* healthChecks: producerServiceHealthCheck.id,
* });
* const pscIlbNetwork = new gcp.compute.Network("psc_ilb_network", {
* name: "psc-ilb-network",
* autoCreateSubnetworks: false,
* });
* const pscIlbProducerSubnetwork = new gcp.compute.Subnetwork("psc_ilb_producer_subnetwork", {
* name: "psc-ilb-producer-subnetwork",
* region: "us-west2",
* network: pscIlbNetwork.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const pscIlbTargetService = new gcp.compute.ForwardingRule("psc_ilb_target_service", {
* name: "producer-forwarding-rule",
* region: "us-west2",
* loadBalancingScheme: "INTERNAL",
* backendService: producerServiceBackend.id,
* allPorts: true,
* network: pscIlbNetwork.name,
* subnetwork: pscIlbProducerSubnetwork.name,
* });
* const pscIlbNat = new gcp.compute.Subnetwork("psc_ilb_nat", {
* name: "psc-ilb-nat",
* region: "us-west2",
* network: pscIlbNetwork.id,
* purpose: "PRIVATE_SERVICE_CONNECT",
* ipCidrRange: "10.1.0.0/16",
* });
* const pscIlbServiceAttachment = new gcp.compute.ServiceAttachment("psc_ilb_service_attachment", {
* name: "my-psc-ilb",
* region: "us-west2",
* description: "A service attachment configured with Terraform",
* domainNames: ["gcp.tfacc.hashicorptest.com."],
* enableProxyProtocol: true,
* connectionPreference: "ACCEPT_MANUAL",
* natSubnets: [pscIlbNat.id],
* targetService: pscIlbTargetService.id,
* consumerRejectLists: [
* "673497134629",
* "482878270665",
* ],
* consumerAcceptLists: [{
* projectIdOrNum: "658859330310",
* connectionLimit: 4,
* }],
* });
* const pscIlbConsumerAddress = new gcp.compute.Address("psc_ilb_consumer_address", {
* name: "psc-ilb-consumer-address",
* region: "us-west2",
* subnetwork: "default",
* addressType: "INTERNAL",
* });
* const pscIlbConsumer = new gcp.compute.ForwardingRule("psc_ilb_consumer", {
* name: "psc-ilb-consumer-forwarding-rule",
* region: "us-west2",
* target: pscIlbServiceAttachment.id,
* loadBalancingScheme: "",
* network: "default",
* ipAddress: pscIlbConsumerAddress.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* producer_service_health_check = gcp.compute.HealthCheck("producer_service_health_check",
* name="producer-service-health-check",
* check_interval_sec=1,
* timeout_sec=1,
* tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
* port=80,
* ))
* producer_service_backend = gcp.compute.RegionBackendService("producer_service_backend",
* name="producer-service",
* region="us-west2",
* health_checks=producer_service_health_check.id)
* psc_ilb_network = gcp.compute.Network("psc_ilb_network",
* name="psc-ilb-network",
* auto_create_subnetworks=False)
* psc_ilb_producer_subnetwork = gcp.compute.Subnetwork("psc_ilb_producer_subnetwork",
* name="psc-ilb-producer-subnetwork",
* region="us-west2",
* network=psc_ilb_network.id,
* ip_cidr_range="10.0.0.0/16")
* psc_ilb_target_service = gcp.compute.ForwardingRule("psc_ilb_target_service",
* name="producer-forwarding-rule",
* region="us-west2",
* load_balancing_scheme="INTERNAL",
* backend_service=producer_service_backend.id,
* all_ports=True,
* network=psc_ilb_network.name,
* subnetwork=psc_ilb_producer_subnetwork.name)
* psc_ilb_nat = gcp.compute.Subnetwork("psc_ilb_nat",
* name="psc-ilb-nat",
* region="us-west2",
* network=psc_ilb_network.id,
* purpose="PRIVATE_SERVICE_CONNECT",
* ip_cidr_range="10.1.0.0/16")
* psc_ilb_service_attachment = gcp.compute.ServiceAttachment("psc_ilb_service_attachment",
* name="my-psc-ilb",
* region="us-west2",
* description="A service attachment configured with Terraform",
* domain_names=["gcp.tfacc.hashicorptest.com."],
* enable_proxy_protocol=True,
* connection_preference="ACCEPT_MANUAL",
* nat_subnets=[psc_ilb_nat.id],
* target_service=psc_ilb_target_service.id,
* consumer_reject_lists=[
* "673497134629",
* "482878270665",
* ],
* consumer_accept_lists=[gcp.compute.ServiceAttachmentConsumerAcceptListArgs(
* project_id_or_num="658859330310",
* connection_limit=4,
* )])
* psc_ilb_consumer_address = gcp.compute.Address("psc_ilb_consumer_address",
* name="psc-ilb-consumer-address",
* region="us-west2",
* subnetwork="default",
* address_type="INTERNAL")
* psc_ilb_consumer = gcp.compute.ForwardingRule("psc_ilb_consumer",
* name="psc-ilb-consumer-forwarding-rule",
* region="us-west2",
* target=psc_ilb_service_attachment.id,
* load_balancing_scheme="",
* network="default",
* ip_address=psc_ilb_consumer_address.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var producerServiceHealthCheck = new Gcp.Compute.HealthCheck("producer_service_health_check", new()
* {
* Name = "producer-service-health-check",
* CheckIntervalSec = 1,
* TimeoutSec = 1,
* TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
* {
* Port = 80,
* },
* });
* var producerServiceBackend = new Gcp.Compute.RegionBackendService("producer_service_backend", new()
* {
* Name = "producer-service",
* Region = "us-west2",
* HealthChecks = producerServiceHealthCheck.Id,
* });
* var pscIlbNetwork = new Gcp.Compute.Network("psc_ilb_network", new()
* {
* Name = "psc-ilb-network",
* AutoCreateSubnetworks = false,
* });
* var pscIlbProducerSubnetwork = new Gcp.Compute.Subnetwork("psc_ilb_producer_subnetwork", new()
* {
* Name = "psc-ilb-producer-subnetwork",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* IpCidrRange = "10.0.0.0/16",
* });
* var pscIlbTargetService = new Gcp.Compute.ForwardingRule("psc_ilb_target_service", new()
* {
* Name = "producer-forwarding-rule",
* Region = "us-west2",
* LoadBalancingScheme = "INTERNAL",
* BackendService = producerServiceBackend.Id,
* AllPorts = true,
* Network = pscIlbNetwork.Name,
* Subnetwork = pscIlbProducerSubnetwork.Name,
* });
* var pscIlbNat = new Gcp.Compute.Subnetwork("psc_ilb_nat", new()
* {
* Name = "psc-ilb-nat",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* Purpose = "PRIVATE_SERVICE_CONNECT",
* IpCidrRange = "10.1.0.0/16",
* });
* var pscIlbServiceAttachment = new Gcp.Compute.ServiceAttachment("psc_ilb_service_attachment", new()
* {
* Name = "my-psc-ilb",
* Region = "us-west2",
* Description = "A service attachment configured with Terraform",
* DomainNames = new[]
* {
* "gcp.tfacc.hashicorptest.com.",
* },
* EnableProxyProtocol = true,
* ConnectionPreference = "ACCEPT_MANUAL",
* NatSubnets = new[]
* {
* pscIlbNat.Id,
* },
* TargetService = pscIlbTargetService.Id,
* ConsumerRejectLists = new[]
* {
* "673497134629",
* "482878270665",
* },
* ConsumerAcceptLists = new[]
* {
* new Gcp.Compute.Inputs.ServiceAttachmentConsumerAcceptListArgs
* {
* ProjectIdOrNum = "658859330310",
* ConnectionLimit = 4,
* },
* },
* });
* var pscIlbConsumerAddress = new Gcp.Compute.Address("psc_ilb_consumer_address", new()
* {
* Name = "psc-ilb-consumer-address",
* Region = "us-west2",
* Subnetwork = "default",
* AddressType = "INTERNAL",
* });
* var pscIlbConsumer = new Gcp.Compute.ForwardingRule("psc_ilb_consumer", new()
* {
* Name = "psc-ilb-consumer-forwarding-rule",
* Region = "us-west2",
* Target = pscIlbServiceAttachment.Id,
* LoadBalancingScheme = "",
* Network = "default",
* IpAddress = pscIlbConsumerAddress.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* producerServiceHealthCheck, err := compute.NewHealthCheck(ctx, "producer_service_health_check", &compute.HealthCheckArgs{
* Name: pulumi.String("producer-service-health-check"),
* CheckIntervalSec: pulumi.Int(1),
* TimeoutSec: pulumi.Int(1),
* TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
* Port: pulumi.Int(80),
* },
* })
* if err != nil {
* return err
* }
* producerServiceBackend, err := compute.NewRegionBackendService(ctx, "producer_service_backend", &compute.RegionBackendServiceArgs{
* Name: pulumi.String("producer-service"),
* Region: pulumi.String("us-west2"),
* HealthChecks: producerServiceHealthCheck.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbNetwork, err := compute.NewNetwork(ctx, "psc_ilb_network", &compute.NetworkArgs{
* Name: pulumi.String("psc-ilb-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* pscIlbProducerSubnetwork, err := compute.NewSubnetwork(ctx, "psc_ilb_producer_subnetwork", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-producer-subnetwork"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbTargetService, err := compute.NewForwardingRule(ctx, "psc_ilb_target_service", &compute.ForwardingRuleArgs{
* Name: pulumi.String("producer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* LoadBalancingScheme: pulumi.String("INTERNAL"),
* BackendService: producerServiceBackend.ID(),
* AllPorts: pulumi.Bool(true),
* Network: pscIlbNetwork.Name,
* Subnetwork: pscIlbProducerSubnetwork.Name,
* })
* if err != nil {
* return err
* }
* pscIlbNat, err := compute.NewSubnetwork(ctx, "psc_ilb_nat", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-nat"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* Purpose: pulumi.String("PRIVATE_SERVICE_CONNECT"),
* IpCidrRange: pulumi.String("10.1.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbServiceAttachment, err := compute.NewServiceAttachment(ctx, "psc_ilb_service_attachment", &compute.ServiceAttachmentArgs{
* Name: pulumi.String("my-psc-ilb"),
* Region: pulumi.String("us-west2"),
* Description: pulumi.String("A service attachment configured with Terraform"),
* DomainNames: pulumi.StringArray{
* pulumi.String("gcp.tfacc.hashicorptest.com."),
* },
* EnableProxyProtocol: pulumi.Bool(true),
* ConnectionPreference: pulumi.String("ACCEPT_MANUAL"),
* NatSubnets: pulumi.StringArray{
* pscIlbNat.ID(),
* },
* TargetService: pscIlbTargetService.ID(),
* ConsumerRejectLists: pulumi.StringArray{
* pulumi.String("673497134629"),
* pulumi.String("482878270665"),
* },
* ConsumerAcceptLists: compute.ServiceAttachmentConsumerAcceptListArray{
* &compute.ServiceAttachmentConsumerAcceptListArgs{
* ProjectIdOrNum: pulumi.String("658859330310"),
* ConnectionLimit: pulumi.Int(4),
* },
* },
* })
* if err != nil {
* return err
* }
* pscIlbConsumerAddress, err := compute.NewAddress(ctx, "psc_ilb_consumer_address", &compute.AddressArgs{
* Name: pulumi.String("psc-ilb-consumer-address"),
* Region: pulumi.String("us-west2"),
* Subnetwork: pulumi.String("default"),
* AddressType: pulumi.String("INTERNAL"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewForwardingRule(ctx, "psc_ilb_consumer", &compute.ForwardingRuleArgs{
* Name: pulumi.String("psc-ilb-consumer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* Target: pscIlbServiceAttachment.ID(),
* LoadBalancingScheme: pulumi.String(""),
* Network: pulumi.String("default"),
* IpAddress: pscIlbConsumerAddress.ID(),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.HealthCheck;
* import com.pulumi.gcp.compute.HealthCheckArgs;
* import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
* import com.pulumi.gcp.compute.RegionBackendService;
* import com.pulumi.gcp.compute.RegionBackendServiceArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.ForwardingRule;
* import com.pulumi.gcp.compute.ForwardingRuleArgs;
* import com.pulumi.gcp.compute.ServiceAttachment;
* import com.pulumi.gcp.compute.ServiceAttachmentArgs;
* import com.pulumi.gcp.compute.inputs.ServiceAttachmentConsumerAcceptListArgs;
* import com.pulumi.gcp.compute.Address;
* import com.pulumi.gcp.compute.AddressArgs;
* 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 producerServiceHealthCheck = new HealthCheck("producerServiceHealthCheck", HealthCheckArgs.builder()
* .name("producer-service-health-check")
* .checkIntervalSec(1)
* .timeoutSec(1)
* .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
* .port("80")
* .build())
* .build());
* var producerServiceBackend = new RegionBackendService("producerServiceBackend", RegionBackendServiceArgs.builder()
* .name("producer-service")
* .region("us-west2")
* .healthChecks(producerServiceHealthCheck.id())
* .build());
* var pscIlbNetwork = new Network("pscIlbNetwork", NetworkArgs.builder()
* .name("psc-ilb-network")
* .autoCreateSubnetworks(false)
* .build());
* var pscIlbProducerSubnetwork = new Subnetwork("pscIlbProducerSubnetwork", SubnetworkArgs.builder()
* .name("psc-ilb-producer-subnetwork")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .ipCidrRange("10.0.0.0/16")
* .build());
* var pscIlbTargetService = new ForwardingRule("pscIlbTargetService", ForwardingRuleArgs.builder()
* .name("producer-forwarding-rule")
* .region("us-west2")
* .loadBalancingScheme("INTERNAL")
* .backendService(producerServiceBackend.id())
* .allPorts(true)
* .network(pscIlbNetwork.name())
* .subnetwork(pscIlbProducerSubnetwork.name())
* .build());
* var pscIlbNat = new Subnetwork("pscIlbNat", SubnetworkArgs.builder()
* .name("psc-ilb-nat")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .purpose("PRIVATE_SERVICE_CONNECT")
* .ipCidrRange("10.1.0.0/16")
* .build());
* var pscIlbServiceAttachment = new ServiceAttachment("pscIlbServiceAttachment", ServiceAttachmentArgs.builder()
* .name("my-psc-ilb")
* .region("us-west2")
* .description("A service attachment configured with Terraform")
* .domainNames("gcp.tfacc.hashicorptest.com.")
* .enableProxyProtocol(true)
* .connectionPreference("ACCEPT_MANUAL")
* .natSubnets(pscIlbNat.id())
* .targetService(pscIlbTargetService.id())
* .consumerRejectLists(
* "673497134629",
* "482878270665")
* .consumerAcceptLists(ServiceAttachmentConsumerAcceptListArgs.builder()
* .projectIdOrNum("658859330310")
* .connectionLimit(4)
* .build())
* .build());
* var pscIlbConsumerAddress = new Address("pscIlbConsumerAddress", AddressArgs.builder()
* .name("psc-ilb-consumer-address")
* .region("us-west2")
* .subnetwork("default")
* .addressType("INTERNAL")
* .build());
* var pscIlbConsumer = new ForwardingRule("pscIlbConsumer", ForwardingRuleArgs.builder()
* .name("psc-ilb-consumer-forwarding-rule")
* .region("us-west2")
* .target(pscIlbServiceAttachment.id())
* .loadBalancingScheme("")
* .network("default")
* .ipAddress(pscIlbConsumerAddress.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* pscIlbServiceAttachment:
* type: gcp:compute:ServiceAttachment
* name: psc_ilb_service_attachment
* properties:
* name: my-psc-ilb
* region: us-west2
* description: A service attachment configured with Terraform
* domainNames:
* - gcp.tfacc.hashicorptest.com.
* enableProxyProtocol: true
* connectionPreference: ACCEPT_MANUAL
* natSubnets:
* - ${pscIlbNat.id}
* targetService: ${pscIlbTargetService.id}
* consumerRejectLists:
* - '673497134629'
* - '482878270665'
* consumerAcceptLists:
* - projectIdOrNum: '658859330310'
* connectionLimit: 4
* pscIlbConsumerAddress:
* type: gcp:compute:Address
* name: psc_ilb_consumer_address
* properties:
* name: psc-ilb-consumer-address
* region: us-west2
* subnetwork: default
* addressType: INTERNAL
* pscIlbConsumer:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_consumer
* properties:
* name: psc-ilb-consumer-forwarding-rule
* region: us-west2
* target: ${pscIlbServiceAttachment.id}
* loadBalancingScheme:
* network: default
* ipAddress: ${pscIlbConsumerAddress.id}
* pscIlbTargetService:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_target_service
* properties:
* name: producer-forwarding-rule
* region: us-west2
* loadBalancingScheme: INTERNAL
* backendService: ${producerServiceBackend.id}
* allPorts: true
* network: ${pscIlbNetwork.name}
* subnetwork: ${pscIlbProducerSubnetwork.name}
* producerServiceBackend:
* type: gcp:compute:RegionBackendService
* name: producer_service_backend
* properties:
* name: producer-service
* region: us-west2
* healthChecks: ${producerServiceHealthCheck.id}
* producerServiceHealthCheck:
* type: gcp:compute:HealthCheck
* name: producer_service_health_check
* properties:
* name: producer-service-health-check
* checkIntervalSec: 1
* timeoutSec: 1
* tcpHealthCheck:
* port: '80'
* pscIlbNetwork:
* type: gcp:compute:Network
* name: psc_ilb_network
* properties:
* name: psc-ilb-network
* autoCreateSubnetworks: false
* pscIlbProducerSubnetwork:
* type: gcp:compute:Subnetwork
* name: psc_ilb_producer_subnetwork
* properties:
* name: psc-ilb-producer-subnetwork
* region: us-west2
* network: ${pscIlbNetwork.id}
* ipCidrRange: 10.0.0.0/16
* pscIlbNat:
* type: gcp:compute:Subnetwork
* name: psc_ilb_nat
* properties:
* name: psc-ilb-nat
* region: us-west2
* network: ${pscIlbNetwork.id}
* purpose: PRIVATE_SERVICE_CONNECT
* ipCidrRange: 10.1.0.0/16
* ```
*
* ### Service Attachment Explicit Networks
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const pscIlbConsumerNetwork = new gcp.compute.Network("psc_ilb_consumer_network", {
* name: "psc-ilb-consumer-network",
* autoCreateSubnetworks: false,
* });
* const producerServiceHealthCheck = new gcp.compute.HealthCheck("producer_service_health_check", {
* name: "producer-service-health-check",
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* });
* const producerServiceBackend = new gcp.compute.RegionBackendService("producer_service_backend", {
* name: "producer-service",
* region: "us-west2",
* healthChecks: producerServiceHealthCheck.id,
* });
* const pscIlbNetwork = new gcp.compute.Network("psc_ilb_network", {
* name: "psc-ilb-network",
* autoCreateSubnetworks: false,
* });
* const pscIlbProducerSubnetwork = new gcp.compute.Subnetwork("psc_ilb_producer_subnetwork", {
* name: "psc-ilb-producer-subnetwork",
* region: "us-west2",
* network: pscIlbNetwork.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const pscIlbTargetService = new gcp.compute.ForwardingRule("psc_ilb_target_service", {
* name: "producer-forwarding-rule",
* region: "us-west2",
* loadBalancingScheme: "INTERNAL",
* backendService: producerServiceBackend.id,
* allPorts: true,
* network: pscIlbNetwork.name,
* subnetwork: pscIlbProducerSubnetwork.name,
* });
* const pscIlbNat = new gcp.compute.Subnetwork("psc_ilb_nat", {
* name: "psc-ilb-nat",
* region: "us-west2",
* network: pscIlbNetwork.id,
* purpose: "PRIVATE_SERVICE_CONNECT",
* ipCidrRange: "10.1.0.0/16",
* });
* const pscIlbServiceAttachment = new gcp.compute.ServiceAttachment("psc_ilb_service_attachment", {
* name: "my-psc-ilb",
* region: "us-west2",
* description: "A service attachment configured with Terraform",
* enableProxyProtocol: false,
* connectionPreference: "ACCEPT_MANUAL",
* natSubnets: [pscIlbNat.id],
* targetService: pscIlbTargetService.id,
* consumerAcceptLists: [{
* networkUrl: pscIlbConsumerNetwork.selfLink,
* connectionLimit: 1,
* }],
* });
* const pscIlbConsumerSubnetwork = new gcp.compute.Subnetwork("psc_ilb_consumer_subnetwork", {
* name: "psc-ilb-consumer-network",
* ipCidrRange: "10.0.0.0/16",
* region: "us-west2",
* network: pscIlbConsumerNetwork.id,
* });
* const pscIlbConsumerAddress = new gcp.compute.Address("psc_ilb_consumer_address", {
* name: "psc-ilb-consumer-address",
* region: "us-west2",
* subnetwork: pscIlbConsumerSubnetwork.id,
* addressType: "INTERNAL",
* });
* const pscIlbConsumer = new gcp.compute.ForwardingRule("psc_ilb_consumer", {
* name: "psc-ilb-consumer-forwarding-rule",
* region: "us-west2",
* target: pscIlbServiceAttachment.id,
* loadBalancingScheme: "",
* network: pscIlbConsumerNetwork.id,
* subnetwork: pscIlbConsumerSubnetwork.id,
* ipAddress: pscIlbConsumerAddress.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* psc_ilb_consumer_network = gcp.compute.Network("psc_ilb_consumer_network",
* name="psc-ilb-consumer-network",
* auto_create_subnetworks=False)
* producer_service_health_check = gcp.compute.HealthCheck("producer_service_health_check",
* name="producer-service-health-check",
* check_interval_sec=1,
* timeout_sec=1,
* tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
* port=80,
* ))
* producer_service_backend = gcp.compute.RegionBackendService("producer_service_backend",
* name="producer-service",
* region="us-west2",
* health_checks=producer_service_health_check.id)
* psc_ilb_network = gcp.compute.Network("psc_ilb_network",
* name="psc-ilb-network",
* auto_create_subnetworks=False)
* psc_ilb_producer_subnetwork = gcp.compute.Subnetwork("psc_ilb_producer_subnetwork",
* name="psc-ilb-producer-subnetwork",
* region="us-west2",
* network=psc_ilb_network.id,
* ip_cidr_range="10.0.0.0/16")
* psc_ilb_target_service = gcp.compute.ForwardingRule("psc_ilb_target_service",
* name="producer-forwarding-rule",
* region="us-west2",
* load_balancing_scheme="INTERNAL",
* backend_service=producer_service_backend.id,
* all_ports=True,
* network=psc_ilb_network.name,
* subnetwork=psc_ilb_producer_subnetwork.name)
* psc_ilb_nat = gcp.compute.Subnetwork("psc_ilb_nat",
* name="psc-ilb-nat",
* region="us-west2",
* network=psc_ilb_network.id,
* purpose="PRIVATE_SERVICE_CONNECT",
* ip_cidr_range="10.1.0.0/16")
* psc_ilb_service_attachment = gcp.compute.ServiceAttachment("psc_ilb_service_attachment",
* name="my-psc-ilb",
* region="us-west2",
* description="A service attachment configured with Terraform",
* enable_proxy_protocol=False,
* connection_preference="ACCEPT_MANUAL",
* nat_subnets=[psc_ilb_nat.id],
* target_service=psc_ilb_target_service.id,
* consumer_accept_lists=[gcp.compute.ServiceAttachmentConsumerAcceptListArgs(
* network_url=psc_ilb_consumer_network.self_link,
* connection_limit=1,
* )])
* psc_ilb_consumer_subnetwork = gcp.compute.Subnetwork("psc_ilb_consumer_subnetwork",
* name="psc-ilb-consumer-network",
* ip_cidr_range="10.0.0.0/16",
* region="us-west2",
* network=psc_ilb_consumer_network.id)
* psc_ilb_consumer_address = gcp.compute.Address("psc_ilb_consumer_address",
* name="psc-ilb-consumer-address",
* region="us-west2",
* subnetwork=psc_ilb_consumer_subnetwork.id,
* address_type="INTERNAL")
* psc_ilb_consumer = gcp.compute.ForwardingRule("psc_ilb_consumer",
* name="psc-ilb-consumer-forwarding-rule",
* region="us-west2",
* target=psc_ilb_service_attachment.id,
* load_balancing_scheme="",
* network=psc_ilb_consumer_network.id,
* subnetwork=psc_ilb_consumer_subnetwork.id,
* ip_address=psc_ilb_consumer_address.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var pscIlbConsumerNetwork = new Gcp.Compute.Network("psc_ilb_consumer_network", new()
* {
* Name = "psc-ilb-consumer-network",
* AutoCreateSubnetworks = false,
* });
* var producerServiceHealthCheck = new Gcp.Compute.HealthCheck("producer_service_health_check", new()
* {
* Name = "producer-service-health-check",
* CheckIntervalSec = 1,
* TimeoutSec = 1,
* TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
* {
* Port = 80,
* },
* });
* var producerServiceBackend = new Gcp.Compute.RegionBackendService("producer_service_backend", new()
* {
* Name = "producer-service",
* Region = "us-west2",
* HealthChecks = producerServiceHealthCheck.Id,
* });
* var pscIlbNetwork = new Gcp.Compute.Network("psc_ilb_network", new()
* {
* Name = "psc-ilb-network",
* AutoCreateSubnetworks = false,
* });
* var pscIlbProducerSubnetwork = new Gcp.Compute.Subnetwork("psc_ilb_producer_subnetwork", new()
* {
* Name = "psc-ilb-producer-subnetwork",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* IpCidrRange = "10.0.0.0/16",
* });
* var pscIlbTargetService = new Gcp.Compute.ForwardingRule("psc_ilb_target_service", new()
* {
* Name = "producer-forwarding-rule",
* Region = "us-west2",
* LoadBalancingScheme = "INTERNAL",
* BackendService = producerServiceBackend.Id,
* AllPorts = true,
* Network = pscIlbNetwork.Name,
* Subnetwork = pscIlbProducerSubnetwork.Name,
* });
* var pscIlbNat = new Gcp.Compute.Subnetwork("psc_ilb_nat", new()
* {
* Name = "psc-ilb-nat",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* Purpose = "PRIVATE_SERVICE_CONNECT",
* IpCidrRange = "10.1.0.0/16",
* });
* var pscIlbServiceAttachment = new Gcp.Compute.ServiceAttachment("psc_ilb_service_attachment", new()
* {
* Name = "my-psc-ilb",
* Region = "us-west2",
* Description = "A service attachment configured with Terraform",
* EnableProxyProtocol = false,
* ConnectionPreference = "ACCEPT_MANUAL",
* NatSubnets = new[]
* {
* pscIlbNat.Id,
* },
* TargetService = pscIlbTargetService.Id,
* ConsumerAcceptLists = new[]
* {
* new Gcp.Compute.Inputs.ServiceAttachmentConsumerAcceptListArgs
* {
* NetworkUrl = pscIlbConsumerNetwork.SelfLink,
* ConnectionLimit = 1,
* },
* },
* });
* var pscIlbConsumerSubnetwork = new Gcp.Compute.Subnetwork("psc_ilb_consumer_subnetwork", new()
* {
* Name = "psc-ilb-consumer-network",
* IpCidrRange = "10.0.0.0/16",
* Region = "us-west2",
* Network = pscIlbConsumerNetwork.Id,
* });
* var pscIlbConsumerAddress = new Gcp.Compute.Address("psc_ilb_consumer_address", new()
* {
* Name = "psc-ilb-consumer-address",
* Region = "us-west2",
* Subnetwork = pscIlbConsumerSubnetwork.Id,
* AddressType = "INTERNAL",
* });
* var pscIlbConsumer = new Gcp.Compute.ForwardingRule("psc_ilb_consumer", new()
* {
* Name = "psc-ilb-consumer-forwarding-rule",
* Region = "us-west2",
* Target = pscIlbServiceAttachment.Id,
* LoadBalancingScheme = "",
* Network = pscIlbConsumerNetwork.Id,
* Subnetwork = pscIlbConsumerSubnetwork.Id,
* IpAddress = pscIlbConsumerAddress.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* pscIlbConsumerNetwork, err := compute.NewNetwork(ctx, "psc_ilb_consumer_network", &compute.NetworkArgs{
* Name: pulumi.String("psc-ilb-consumer-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* producerServiceHealthCheck, err := compute.NewHealthCheck(ctx, "producer_service_health_check", &compute.HealthCheckArgs{
* Name: pulumi.String("producer-service-health-check"),
* CheckIntervalSec: pulumi.Int(1),
* TimeoutSec: pulumi.Int(1),
* TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
* Port: pulumi.Int(80),
* },
* })
* if err != nil {
* return err
* }
* producerServiceBackend, err := compute.NewRegionBackendService(ctx, "producer_service_backend", &compute.RegionBackendServiceArgs{
* Name: pulumi.String("producer-service"),
* Region: pulumi.String("us-west2"),
* HealthChecks: producerServiceHealthCheck.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbNetwork, err := compute.NewNetwork(ctx, "psc_ilb_network", &compute.NetworkArgs{
* Name: pulumi.String("psc-ilb-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* pscIlbProducerSubnetwork, err := compute.NewSubnetwork(ctx, "psc_ilb_producer_subnetwork", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-producer-subnetwork"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbTargetService, err := compute.NewForwardingRule(ctx, "psc_ilb_target_service", &compute.ForwardingRuleArgs{
* Name: pulumi.String("producer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* LoadBalancingScheme: pulumi.String("INTERNAL"),
* BackendService: producerServiceBackend.ID(),
* AllPorts: pulumi.Bool(true),
* Network: pscIlbNetwork.Name,
* Subnetwork: pscIlbProducerSubnetwork.Name,
* })
* if err != nil {
* return err
* }
* pscIlbNat, err := compute.NewSubnetwork(ctx, "psc_ilb_nat", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-nat"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* Purpose: pulumi.String("PRIVATE_SERVICE_CONNECT"),
* IpCidrRange: pulumi.String("10.1.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbServiceAttachment, err := compute.NewServiceAttachment(ctx, "psc_ilb_service_attachment", &compute.ServiceAttachmentArgs{
* Name: pulumi.String("my-psc-ilb"),
* Region: pulumi.String("us-west2"),
* Description: pulumi.String("A service attachment configured with Terraform"),
* EnableProxyProtocol: pulumi.Bool(false),
* ConnectionPreference: pulumi.String("ACCEPT_MANUAL"),
* NatSubnets: pulumi.StringArray{
* pscIlbNat.ID(),
* },
* TargetService: pscIlbTargetService.ID(),
* ConsumerAcceptLists: compute.ServiceAttachmentConsumerAcceptListArray{
* &compute.ServiceAttachmentConsumerAcceptListArgs{
* NetworkUrl: pscIlbConsumerNetwork.SelfLink,
* ConnectionLimit: pulumi.Int(1),
* },
* },
* })
* if err != nil {
* return err
* }
* pscIlbConsumerSubnetwork, err := compute.NewSubnetwork(ctx, "psc_ilb_consumer_subnetwork", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-consumer-network"),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbConsumerNetwork.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbConsumerAddress, err := compute.NewAddress(ctx, "psc_ilb_consumer_address", &compute.AddressArgs{
* Name: pulumi.String("psc-ilb-consumer-address"),
* Region: pulumi.String("us-west2"),
* Subnetwork: pscIlbConsumerSubnetwork.ID(),
* AddressType: pulumi.String("INTERNAL"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewForwardingRule(ctx, "psc_ilb_consumer", &compute.ForwardingRuleArgs{
* Name: pulumi.String("psc-ilb-consumer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* Target: pscIlbServiceAttachment.ID(),
* LoadBalancingScheme: pulumi.String(""),
* Network: pscIlbConsumerNetwork.ID(),
* Subnetwork: pscIlbConsumerSubnetwork.ID(),
* IpAddress: pscIlbConsumerAddress.ID(),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.HealthCheck;
* import com.pulumi.gcp.compute.HealthCheckArgs;
* import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
* import com.pulumi.gcp.compute.RegionBackendService;
* import com.pulumi.gcp.compute.RegionBackendServiceArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.ForwardingRule;
* import com.pulumi.gcp.compute.ForwardingRuleArgs;
* import com.pulumi.gcp.compute.ServiceAttachment;
* import com.pulumi.gcp.compute.ServiceAttachmentArgs;
* import com.pulumi.gcp.compute.inputs.ServiceAttachmentConsumerAcceptListArgs;
* import com.pulumi.gcp.compute.Address;
* import com.pulumi.gcp.compute.AddressArgs;
* 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 pscIlbConsumerNetwork = new Network("pscIlbConsumerNetwork", NetworkArgs.builder()
* .name("psc-ilb-consumer-network")
* .autoCreateSubnetworks(false)
* .build());
* var producerServiceHealthCheck = new HealthCheck("producerServiceHealthCheck", HealthCheckArgs.builder()
* .name("producer-service-health-check")
* .checkIntervalSec(1)
* .timeoutSec(1)
* .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
* .port("80")
* .build())
* .build());
* var producerServiceBackend = new RegionBackendService("producerServiceBackend", RegionBackendServiceArgs.builder()
* .name("producer-service")
* .region("us-west2")
* .healthChecks(producerServiceHealthCheck.id())
* .build());
* var pscIlbNetwork = new Network("pscIlbNetwork", NetworkArgs.builder()
* .name("psc-ilb-network")
* .autoCreateSubnetworks(false)
* .build());
* var pscIlbProducerSubnetwork = new Subnetwork("pscIlbProducerSubnetwork", SubnetworkArgs.builder()
* .name("psc-ilb-producer-subnetwork")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .ipCidrRange("10.0.0.0/16")
* .build());
* var pscIlbTargetService = new ForwardingRule("pscIlbTargetService", ForwardingRuleArgs.builder()
* .name("producer-forwarding-rule")
* .region("us-west2")
* .loadBalancingScheme("INTERNAL")
* .backendService(producerServiceBackend.id())
* .allPorts(true)
* .network(pscIlbNetwork.name())
* .subnetwork(pscIlbProducerSubnetwork.name())
* .build());
* var pscIlbNat = new Subnetwork("pscIlbNat", SubnetworkArgs.builder()
* .name("psc-ilb-nat")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .purpose("PRIVATE_SERVICE_CONNECT")
* .ipCidrRange("10.1.0.0/16")
* .build());
* var pscIlbServiceAttachment = new ServiceAttachment("pscIlbServiceAttachment", ServiceAttachmentArgs.builder()
* .name("my-psc-ilb")
* .region("us-west2")
* .description("A service attachment configured with Terraform")
* .enableProxyProtocol(false)
* .connectionPreference("ACCEPT_MANUAL")
* .natSubnets(pscIlbNat.id())
* .targetService(pscIlbTargetService.id())
* .consumerAcceptLists(ServiceAttachmentConsumerAcceptListArgs.builder()
* .networkUrl(pscIlbConsumerNetwork.selfLink())
* .connectionLimit(1)
* .build())
* .build());
* var pscIlbConsumerSubnetwork = new Subnetwork("pscIlbConsumerSubnetwork", SubnetworkArgs.builder()
* .name("psc-ilb-consumer-network")
* .ipCidrRange("10.0.0.0/16")
* .region("us-west2")
* .network(pscIlbConsumerNetwork.id())
* .build());
* var pscIlbConsumerAddress = new Address("pscIlbConsumerAddress", AddressArgs.builder()
* .name("psc-ilb-consumer-address")
* .region("us-west2")
* .subnetwork(pscIlbConsumerSubnetwork.id())
* .addressType("INTERNAL")
* .build());
* var pscIlbConsumer = new ForwardingRule("pscIlbConsumer", ForwardingRuleArgs.builder()
* .name("psc-ilb-consumer-forwarding-rule")
* .region("us-west2")
* .target(pscIlbServiceAttachment.id())
* .loadBalancingScheme("")
* .network(pscIlbConsumerNetwork.id())
* .subnetwork(pscIlbConsumerSubnetwork.id())
* .ipAddress(pscIlbConsumerAddress.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* pscIlbServiceAttachment:
* type: gcp:compute:ServiceAttachment
* name: psc_ilb_service_attachment
* properties:
* name: my-psc-ilb
* region: us-west2
* description: A service attachment configured with Terraform
* enableProxyProtocol: false
* connectionPreference: ACCEPT_MANUAL
* natSubnets:
* - ${pscIlbNat.id}
* targetService: ${pscIlbTargetService.id}
* consumerAcceptLists:
* - networkUrl: ${pscIlbConsumerNetwork.selfLink}
* connectionLimit: 1
* pscIlbConsumerNetwork:
* type: gcp:compute:Network
* name: psc_ilb_consumer_network
* properties:
* name: psc-ilb-consumer-network
* autoCreateSubnetworks: false
* pscIlbConsumerSubnetwork:
* type: gcp:compute:Subnetwork
* name: psc_ilb_consumer_subnetwork
* properties:
* name: psc-ilb-consumer-network
* ipCidrRange: 10.0.0.0/16
* region: us-west2
* network: ${pscIlbConsumerNetwork.id}
* pscIlbConsumerAddress:
* type: gcp:compute:Address
* name: psc_ilb_consumer_address
* properties:
* name: psc-ilb-consumer-address
* region: us-west2
* subnetwork: ${pscIlbConsumerSubnetwork.id}
* addressType: INTERNAL
* pscIlbConsumer:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_consumer
* properties:
* name: psc-ilb-consumer-forwarding-rule
* region: us-west2
* target: ${pscIlbServiceAttachment.id}
* loadBalancingScheme:
* network: ${pscIlbConsumerNetwork.id}
* subnetwork: ${pscIlbConsumerSubnetwork.id}
* ipAddress: ${pscIlbConsumerAddress.id}
* pscIlbTargetService:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_target_service
* properties:
* name: producer-forwarding-rule
* region: us-west2
* loadBalancingScheme: INTERNAL
* backendService: ${producerServiceBackend.id}
* allPorts: true
* network: ${pscIlbNetwork.name}
* subnetwork: ${pscIlbProducerSubnetwork.name}
* producerServiceBackend:
* type: gcp:compute:RegionBackendService
* name: producer_service_backend
* properties:
* name: producer-service
* region: us-west2
* healthChecks: ${producerServiceHealthCheck.id}
* producerServiceHealthCheck:
* type: gcp:compute:HealthCheck
* name: producer_service_health_check
* properties:
* name: producer-service-health-check
* checkIntervalSec: 1
* timeoutSec: 1
* tcpHealthCheck:
* port: '80'
* pscIlbNetwork:
* type: gcp:compute:Network
* name: psc_ilb_network
* properties:
* name: psc-ilb-network
* autoCreateSubnetworks: false
* pscIlbProducerSubnetwork:
* type: gcp:compute:Subnetwork
* name: psc_ilb_producer_subnetwork
* properties:
* name: psc-ilb-producer-subnetwork
* region: us-west2
* network: ${pscIlbNetwork.id}
* ipCidrRange: 10.0.0.0/16
* pscIlbNat:
* type: gcp:compute:Subnetwork
* name: psc_ilb_nat
* properties:
* name: psc-ilb-nat
* region: us-west2
* network: ${pscIlbNetwork.id}
* purpose: PRIVATE_SERVICE_CONNECT
* ipCidrRange: 10.1.0.0/16
* ```
*
* ### Service Attachment Reconcile Connections
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const producerServiceHealthCheck = new gcp.compute.HealthCheck("producer_service_health_check", {
* name: "producer-service-health-check",
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* });
* const producerServiceBackend = new gcp.compute.RegionBackendService("producer_service_backend", {
* name: "producer-service",
* region: "us-west2",
* healthChecks: producerServiceHealthCheck.id,
* });
* const pscIlbNetwork = new gcp.compute.Network("psc_ilb_network", {
* name: "psc-ilb-network",
* autoCreateSubnetworks: false,
* });
* const pscIlbProducerSubnetwork = new gcp.compute.Subnetwork("psc_ilb_producer_subnetwork", {
* name: "psc-ilb-producer-subnetwork",
* region: "us-west2",
* network: pscIlbNetwork.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const pscIlbTargetService = new gcp.compute.ForwardingRule("psc_ilb_target_service", {
* name: "producer-forwarding-rule",
* region: "us-west2",
* loadBalancingScheme: "INTERNAL",
* backendService: producerServiceBackend.id,
* allPorts: true,
* network: pscIlbNetwork.name,
* subnetwork: pscIlbProducerSubnetwork.name,
* });
* const pscIlbNat = new gcp.compute.Subnetwork("psc_ilb_nat", {
* name: "psc-ilb-nat",
* region: "us-west2",
* network: pscIlbNetwork.id,
* purpose: "PRIVATE_SERVICE_CONNECT",
* ipCidrRange: "10.1.0.0/16",
* });
* const pscIlbServiceAttachment = new gcp.compute.ServiceAttachment("psc_ilb_service_attachment", {
* name: "my-psc-ilb",
* region: "us-west2",
* description: "A service attachment configured with Terraform",
* domainNames: ["gcp.tfacc.hashicorptest.com."],
* enableProxyProtocol: true,
* connectionPreference: "ACCEPT_MANUAL",
* natSubnets: [pscIlbNat.id],
* targetService: pscIlbTargetService.id,
* consumerRejectLists: [
* "673497134629",
* "482878270665",
* ],
* consumerAcceptLists: [{
* projectIdOrNum: "658859330310",
* connectionLimit: 4,
* }],
* reconcileConnections: false,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* producer_service_health_check = gcp.compute.HealthCheck("producer_service_health_check",
* name="producer-service-health-check",
* check_interval_sec=1,
* timeout_sec=1,
* tcp_health_check=gcp.compute.HealthCheckTcpHealthCheckArgs(
* port=80,
* ))
* producer_service_backend = gcp.compute.RegionBackendService("producer_service_backend",
* name="producer-service",
* region="us-west2",
* health_checks=producer_service_health_check.id)
* psc_ilb_network = gcp.compute.Network("psc_ilb_network",
* name="psc-ilb-network",
* auto_create_subnetworks=False)
* psc_ilb_producer_subnetwork = gcp.compute.Subnetwork("psc_ilb_producer_subnetwork",
* name="psc-ilb-producer-subnetwork",
* region="us-west2",
* network=psc_ilb_network.id,
* ip_cidr_range="10.0.0.0/16")
* psc_ilb_target_service = gcp.compute.ForwardingRule("psc_ilb_target_service",
* name="producer-forwarding-rule",
* region="us-west2",
* load_balancing_scheme="INTERNAL",
* backend_service=producer_service_backend.id,
* all_ports=True,
* network=psc_ilb_network.name,
* subnetwork=psc_ilb_producer_subnetwork.name)
* psc_ilb_nat = gcp.compute.Subnetwork("psc_ilb_nat",
* name="psc-ilb-nat",
* region="us-west2",
* network=psc_ilb_network.id,
* purpose="PRIVATE_SERVICE_CONNECT",
* ip_cidr_range="10.1.0.0/16")
* psc_ilb_service_attachment = gcp.compute.ServiceAttachment("psc_ilb_service_attachment",
* name="my-psc-ilb",
* region="us-west2",
* description="A service attachment configured with Terraform",
* domain_names=["gcp.tfacc.hashicorptest.com."],
* enable_proxy_protocol=True,
* connection_preference="ACCEPT_MANUAL",
* nat_subnets=[psc_ilb_nat.id],
* target_service=psc_ilb_target_service.id,
* consumer_reject_lists=[
* "673497134629",
* "482878270665",
* ],
* consumer_accept_lists=[gcp.compute.ServiceAttachmentConsumerAcceptListArgs(
* project_id_or_num="658859330310",
* connection_limit=4,
* )],
* reconcile_connections=False)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var producerServiceHealthCheck = new Gcp.Compute.HealthCheck("producer_service_health_check", new()
* {
* Name = "producer-service-health-check",
* CheckIntervalSec = 1,
* TimeoutSec = 1,
* TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
* {
* Port = 80,
* },
* });
* var producerServiceBackend = new Gcp.Compute.RegionBackendService("producer_service_backend", new()
* {
* Name = "producer-service",
* Region = "us-west2",
* HealthChecks = producerServiceHealthCheck.Id,
* });
* var pscIlbNetwork = new Gcp.Compute.Network("psc_ilb_network", new()
* {
* Name = "psc-ilb-network",
* AutoCreateSubnetworks = false,
* });
* var pscIlbProducerSubnetwork = new Gcp.Compute.Subnetwork("psc_ilb_producer_subnetwork", new()
* {
* Name = "psc-ilb-producer-subnetwork",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* IpCidrRange = "10.0.0.0/16",
* });
* var pscIlbTargetService = new Gcp.Compute.ForwardingRule("psc_ilb_target_service", new()
* {
* Name = "producer-forwarding-rule",
* Region = "us-west2",
* LoadBalancingScheme = "INTERNAL",
* BackendService = producerServiceBackend.Id,
* AllPorts = true,
* Network = pscIlbNetwork.Name,
* Subnetwork = pscIlbProducerSubnetwork.Name,
* });
* var pscIlbNat = new Gcp.Compute.Subnetwork("psc_ilb_nat", new()
* {
* Name = "psc-ilb-nat",
* Region = "us-west2",
* Network = pscIlbNetwork.Id,
* Purpose = "PRIVATE_SERVICE_CONNECT",
* IpCidrRange = "10.1.0.0/16",
* });
* var pscIlbServiceAttachment = new Gcp.Compute.ServiceAttachment("psc_ilb_service_attachment", new()
* {
* Name = "my-psc-ilb",
* Region = "us-west2",
* Description = "A service attachment configured with Terraform",
* DomainNames = new[]
* {
* "gcp.tfacc.hashicorptest.com.",
* },
* EnableProxyProtocol = true,
* ConnectionPreference = "ACCEPT_MANUAL",
* NatSubnets = new[]
* {
* pscIlbNat.Id,
* },
* TargetService = pscIlbTargetService.Id,
* ConsumerRejectLists = new[]
* {
* "673497134629",
* "482878270665",
* },
* ConsumerAcceptLists = new[]
* {
* new Gcp.Compute.Inputs.ServiceAttachmentConsumerAcceptListArgs
* {
* ProjectIdOrNum = "658859330310",
* ConnectionLimit = 4,
* },
* },
* ReconcileConnections = false,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* producerServiceHealthCheck, err := compute.NewHealthCheck(ctx, "producer_service_health_check", &compute.HealthCheckArgs{
* Name: pulumi.String("producer-service-health-check"),
* CheckIntervalSec: pulumi.Int(1),
* TimeoutSec: pulumi.Int(1),
* TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
* Port: pulumi.Int(80),
* },
* })
* if err != nil {
* return err
* }
* producerServiceBackend, err := compute.NewRegionBackendService(ctx, "producer_service_backend", &compute.RegionBackendServiceArgs{
* Name: pulumi.String("producer-service"),
* Region: pulumi.String("us-west2"),
* HealthChecks: producerServiceHealthCheck.ID(),
* })
* if err != nil {
* return err
* }
* pscIlbNetwork, err := compute.NewNetwork(ctx, "psc_ilb_network", &compute.NetworkArgs{
* Name: pulumi.String("psc-ilb-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* pscIlbProducerSubnetwork, err := compute.NewSubnetwork(ctx, "psc_ilb_producer_subnetwork", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-producer-subnetwork"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* IpCidrRange: pulumi.String("10.0.0.0/16"),
* })
* if err != nil {
* return err
* }
* pscIlbTargetService, err := compute.NewForwardingRule(ctx, "psc_ilb_target_service", &compute.ForwardingRuleArgs{
* Name: pulumi.String("producer-forwarding-rule"),
* Region: pulumi.String("us-west2"),
* LoadBalancingScheme: pulumi.String("INTERNAL"),
* BackendService: producerServiceBackend.ID(),
* AllPorts: pulumi.Bool(true),
* Network: pscIlbNetwork.Name,
* Subnetwork: pscIlbProducerSubnetwork.Name,
* })
* if err != nil {
* return err
* }
* pscIlbNat, err := compute.NewSubnetwork(ctx, "psc_ilb_nat", &compute.SubnetworkArgs{
* Name: pulumi.String("psc-ilb-nat"),
* Region: pulumi.String("us-west2"),
* Network: pscIlbNetwork.ID(),
* Purpose: pulumi.String("PRIVATE_SERVICE_CONNECT"),
* IpCidrRange: pulumi.String("10.1.0.0/16"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewServiceAttachment(ctx, "psc_ilb_service_attachment", &compute.ServiceAttachmentArgs{
* Name: pulumi.String("my-psc-ilb"),
* Region: pulumi.String("us-west2"),
* Description: pulumi.String("A service attachment configured with Terraform"),
* DomainNames: pulumi.StringArray{
* pulumi.String("gcp.tfacc.hashicorptest.com."),
* },
* EnableProxyProtocol: pulumi.Bool(true),
* ConnectionPreference: pulumi.String("ACCEPT_MANUAL"),
* NatSubnets: pulumi.StringArray{
* pscIlbNat.ID(),
* },
* TargetService: pscIlbTargetService.ID(),
* ConsumerRejectLists: pulumi.StringArray{
* pulumi.String("673497134629"),
* pulumi.String("482878270665"),
* },
* ConsumerAcceptLists: compute.ServiceAttachmentConsumerAcceptListArray{
* &compute.ServiceAttachmentConsumerAcceptListArgs{
* ProjectIdOrNum: pulumi.String("658859330310"),
* ConnectionLimit: pulumi.Int(4),
* },
* },
* ReconcileConnections: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.HealthCheck;
* import com.pulumi.gcp.compute.HealthCheckArgs;
* import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
* import com.pulumi.gcp.compute.RegionBackendService;
* import com.pulumi.gcp.compute.RegionBackendServiceArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.ForwardingRule;
* import com.pulumi.gcp.compute.ForwardingRuleArgs;
* import com.pulumi.gcp.compute.ServiceAttachment;
* import com.pulumi.gcp.compute.ServiceAttachmentArgs;
* import com.pulumi.gcp.compute.inputs.ServiceAttachmentConsumerAcceptListArgs;
* 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 producerServiceHealthCheck = new HealthCheck("producerServiceHealthCheck", HealthCheckArgs.builder()
* .name("producer-service-health-check")
* .checkIntervalSec(1)
* .timeoutSec(1)
* .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
* .port("80")
* .build())
* .build());
* var producerServiceBackend = new RegionBackendService("producerServiceBackend", RegionBackendServiceArgs.builder()
* .name("producer-service")
* .region("us-west2")
* .healthChecks(producerServiceHealthCheck.id())
* .build());
* var pscIlbNetwork = new Network("pscIlbNetwork", NetworkArgs.builder()
* .name("psc-ilb-network")
* .autoCreateSubnetworks(false)
* .build());
* var pscIlbProducerSubnetwork = new Subnetwork("pscIlbProducerSubnetwork", SubnetworkArgs.builder()
* .name("psc-ilb-producer-subnetwork")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .ipCidrRange("10.0.0.0/16")
* .build());
* var pscIlbTargetService = new ForwardingRule("pscIlbTargetService", ForwardingRuleArgs.builder()
* .name("producer-forwarding-rule")
* .region("us-west2")
* .loadBalancingScheme("INTERNAL")
* .backendService(producerServiceBackend.id())
* .allPorts(true)
* .network(pscIlbNetwork.name())
* .subnetwork(pscIlbProducerSubnetwork.name())
* .build());
* var pscIlbNat = new Subnetwork("pscIlbNat", SubnetworkArgs.builder()
* .name("psc-ilb-nat")
* .region("us-west2")
* .network(pscIlbNetwork.id())
* .purpose("PRIVATE_SERVICE_CONNECT")
* .ipCidrRange("10.1.0.0/16")
* .build());
* var pscIlbServiceAttachment = new ServiceAttachment("pscIlbServiceAttachment", ServiceAttachmentArgs.builder()
* .name("my-psc-ilb")
* .region("us-west2")
* .description("A service attachment configured with Terraform")
* .domainNames("gcp.tfacc.hashicorptest.com.")
* .enableProxyProtocol(true)
* .connectionPreference("ACCEPT_MANUAL")
* .natSubnets(pscIlbNat.id())
* .targetService(pscIlbTargetService.id())
* .consumerRejectLists(
* "673497134629",
* "482878270665")
* .consumerAcceptLists(ServiceAttachmentConsumerAcceptListArgs.builder()
* .projectIdOrNum("658859330310")
* .connectionLimit(4)
* .build())
* .reconcileConnections(false)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* pscIlbServiceAttachment:
* type: gcp:compute:ServiceAttachment
* name: psc_ilb_service_attachment
* properties:
* name: my-psc-ilb
* region: us-west2
* description: A service attachment configured with Terraform
* domainNames:
* - gcp.tfacc.hashicorptest.com.
* enableProxyProtocol: true
* connectionPreference: ACCEPT_MANUAL
* natSubnets:
* - ${pscIlbNat.id}
* targetService: ${pscIlbTargetService.id}
* consumerRejectLists:
* - '673497134629'
* - '482878270665'
* consumerAcceptLists:
* - projectIdOrNum: '658859330310'
* connectionLimit: 4
* reconcileConnections: false
* pscIlbTargetService:
* type: gcp:compute:ForwardingRule
* name: psc_ilb_target_service
* properties:
* name: producer-forwarding-rule
* region: us-west2
* loadBalancingScheme: INTERNAL
* backendService: ${producerServiceBackend.id}
* allPorts: true
* network: ${pscIlbNetwork.name}
* subnetwork: ${pscIlbProducerSubnetwork.name}
* producerServiceBackend:
* type: gcp:compute:RegionBackendService
* name: producer_service_backend
* properties:
* name: producer-service
* region: us-west2
* healthChecks: ${producerServiceHealthCheck.id}
* producerServiceHealthCheck:
* type: gcp:compute:HealthCheck
* name: producer_service_health_check
* properties:
* name: producer-service-health-check
* checkIntervalSec: 1
* timeoutSec: 1
* tcpHealthCheck:
* port: '80'
* pscIlbNetwork:
* type: gcp:compute:Network
* name: psc_ilb_network
* properties:
* name: psc-ilb-network
* autoCreateSubnetworks: false
* pscIlbProducerSubnetwork:
* type: gcp:compute:Subnetwork
* name: psc_ilb_producer_subnetwork
* properties:
* name: psc-ilb-producer-subnetwork
* region: us-west2
* network: ${pscIlbNetwork.id}
* ipCidrRange: 10.0.0.0/16
* pscIlbNat:
* type: gcp:compute:Subnetwork
* name: psc_ilb_nat
* properties:
* name: psc-ilb-nat
* region: us-west2
* network: ${pscIlbNetwork.id}
* purpose: PRIVATE_SERVICE_CONNECT
* ipCidrRange: 10.1.0.0/16
* ```
*
* ## Import
* ServiceAttachment can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/serviceAttachments/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, ServiceAttachment can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default projects/{{project}}/regions/{{region}}/serviceAttachments/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{name}}
* ```
*/
public class ServiceAttachment internal constructor(
override val javaResource: com.pulumi.gcp.compute.ServiceAttachment,
) : KotlinCustomResource(javaResource, ServiceAttachmentMapper) {
/**
* An array of the consumer forwarding rules connected to this service
* attachment.
* Structure is documented below.
*/
public val connectedEndpoints: Output>
get() = javaResource.connectedEndpoints().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> serviceAttachmentConnectedEndpointToKotlin(args0) })
})
})
/**
* The connection preference to use for this service attachment. Valid
* values include "ACCEPT_AUTOMATIC", "ACCEPT_MANUAL".
*/
public val connectionPreference: Output
get() = javaResource.connectionPreference().applyValue({ args0 -> args0 })
/**
* An array of projects that are allowed to connect to this service
* attachment.
* Structure is documented below.
*/
public val consumerAcceptLists: Output>?
get() = javaResource.consumerAcceptLists().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
serviceAttachmentConsumerAcceptListToKotlin(args0)
})
})
}).orElse(null)
})
/**
* An array of projects that are not allowed to connect to this service
* attachment.
*/
public val consumerRejectLists: Output>?
get() = javaResource.consumerRejectLists().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* An optional description of this resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* If specified, the domain name will be used during the integration between
* the PSC connected endpoints and the Cloud DNS. For example, this is a
* valid domain name: "p.mycompany.com.". Current max number of domain names
* supported is 1.
*/
public val domainNames: Output>?
get() = javaResource.domainNames().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* If true, enable the proxy protocol which is for supplying client TCP/IP
* address data in TCP connections that traverse proxies on their way to
* destination servers.
* - - -
*/
public val enableProxyProtocol: Output
get() = javaResource.enableProxyProtocol().applyValue({ args0 -> args0 })
/**
* Fingerprint of this resource. This field is used internally during
* updates of this resource.
*/
public val fingerprint: Output
get() = javaResource.fingerprint().applyValue({ args0 -> args0 })
/**
* Name of the resource. The name must be 1-63 characters long, and
* comply with RFC1035. Specifically, the name must be 1-63 characters
* long and match the regular expression `a-z?`
* which means the first character must be a lowercase letter, and all
* following characters must be a dash, lowercase letter, or digit,
* except the last character, which cannot be a dash.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* An array of subnets that is provided for NAT in this service attachment.
*/
public val natSubnets: Output>
get() = javaResource.natSubnets().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* This flag determines whether a consumer accept/reject list change can reconcile the statuses of existing ACCEPTED or REJECTED PSC endpoints.
* If false, connection policy update will only affect existing PENDING PSC endpoints. Existing ACCEPTED/REJECTED endpoints will remain untouched regardless how the connection policy is modified .
* If true, update will affect both PENDING and ACCEPTED/REJECTED PSC endpoints. For example, an ACCEPTED PSC endpoint will be moved to REJECTED if its project is added to the reject list.
*/
public val reconcileConnections: Output
get() = javaResource.reconcileConnections().applyValue({ args0 -> args0 })
/**
* URL of the region where the resource resides.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* The URI of the created resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
/**
* The URL of a forwarding rule that represents the service identified by
* this service attachment.
*/
public val targetService: Output
get() = javaResource.targetService().applyValue({ args0 -> args0 })
}
public object ServiceAttachmentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.ServiceAttachment::class == javaResource::class
override fun map(javaResource: Resource): ServiceAttachment = ServiceAttachment(
javaResource as
com.pulumi.gcp.compute.ServiceAttachment,
)
}
/**
* @see [ServiceAttachment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ServiceAttachment].
*/
public suspend fun serviceAttachment(
name: String,
block: suspend ServiceAttachmentResourceBuilder.() -> Unit,
): ServiceAttachment {
val builder = ServiceAttachmentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ServiceAttachment].
* @param name The _unique_ name of the resulting resource.
*/
public fun serviceAttachment(name: String): ServiceAttachment {
val builder = ServiceAttachmentResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy