UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

584 lines • 23.3 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceAttachment = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * 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, * }); * ``` * ### 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, * }); * ``` * ### 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, * }); * ``` * ### 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, * }); * ``` * ### Service Attachment Tunneling Config * * ```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 tunneling", * enableProxyProtocol: false, * connectionPreference: "ACCEPT_AUTOMATIC", * natSubnets: [pscIlbNat.id], * targetService: pscIlbTargetService.id, * tunnelingConfig: { * routingMode: "REGIONAL", * encapsulationProfile: "IPV4", * }, * }); * ``` * ### Service Attachment Cross Region Ilb * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const healthCheck = new gcp.compute.HealthCheck("health_check", { * name: "sa", * checkIntervalSec: 1, * timeoutSec: 1, * tcpHealthCheck: { * port: 80, * }, * }); * const backendService = new gcp.compute.BackendService("backend_service", { * name: "sa", * loadBalancingScheme: "INTERNAL_MANAGED", * healthChecks: healthCheck.id, * }); * const urlMap = new gcp.compute.URLMap("url_map", { * name: "sa", * description: "Url map.", * defaultService: backendService.id, * }); * const httpProxy = new gcp.compute.TargetHttpProxy("http_proxy", { * name: "sa", * description: "a description", * urlMap: urlMap.id, * }); * const network = new gcp.compute.Network("network", { * name: "sa", * autoCreateSubnetworks: false, * }); * const subnetworkProxy = new gcp.compute.Subnetwork("subnetwork_proxy", { * name: "sa-proxy", * region: "us-central1", * network: network.id, * purpose: "GLOBAL_MANAGED_PROXY", * role: "ACTIVE", * ipCidrRange: "10.2.0.0/16", * }); * const subnetwork = new gcp.compute.Subnetwork("subnetwork", { * name: "sa", * region: "us-central1", * network: network.id, * ipCidrRange: "10.0.0.0/16", * }); * const forwardingRule = new gcp.compute.GlobalForwardingRule("forwarding_rule", { * name: "sa", * target: httpProxy.id, * network: network.id, * subnetwork: subnetwork.id, * portRange: "80", * loadBalancingScheme: "INTERNAL_MANAGED", * }, { * dependsOn: [subnetworkProxy], * }); * const subnetworkPsc = new gcp.compute.Subnetwork("subnetwork_psc", { * name: "sa-psc", * region: "us-central1", * network: network.id, * purpose: "PRIVATE_SERVICE_CONNECT", * ipCidrRange: "10.1.0.0/16", * }); * const pscIlbServiceAttachment = new gcp.compute.ServiceAttachment("psc_ilb_service_attachment", { * name: "sa", * region: "us-central1", * description: "A service attachment configured with Terraform", * connectionPreference: "ACCEPT_AUTOMATIC", * enableProxyProtocol: false, * natSubnets: [subnetworkPsc.id], * targetService: forwardingRule.id, * }); * ``` * * ## 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}} * $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{project}}/{{region}}/{{name}} * $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{region}}/{{name}} * $ pulumi import gcp:compute/serviceAttachment:ServiceAttachment default {{name}} * ``` */ class ServiceAttachment extends pulumi.CustomResource { /** * Get an existing ServiceAttachment resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new ServiceAttachment(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/serviceAttachment:ServiceAttachment'; /** * Returns true if the given object is an instance of ServiceAttachment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ServiceAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["connectedEndpoints"] = state?.connectedEndpoints; resourceInputs["connectionPreference"] = state?.connectionPreference; resourceInputs["consumerAcceptLists"] = state?.consumerAcceptLists; resourceInputs["consumerRejectLists"] = state?.consumerRejectLists; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["domainNames"] = state?.domainNames; resourceInputs["enableProxyProtocol"] = state?.enableProxyProtocol; resourceInputs["fingerprint"] = state?.fingerprint; resourceInputs["name"] = state?.name; resourceInputs["natSubnets"] = state?.natSubnets; resourceInputs["project"] = state?.project; resourceInputs["propagatedConnectionLimit"] = state?.propagatedConnectionLimit; resourceInputs["pscServiceAttachmentIds"] = state?.pscServiceAttachmentIds; resourceInputs["reconcileConnections"] = state?.reconcileConnections; resourceInputs["region"] = state?.region; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["sendPropagatedConnectionLimitIfZero"] = state?.sendPropagatedConnectionLimitIfZero; resourceInputs["showNatIps"] = state?.showNatIps; resourceInputs["targetService"] = state?.targetService; resourceInputs["tunnelingConfig"] = state?.tunnelingConfig; } else { const args = argsOrState; if (args?.connectionPreference === undefined && !opts.urn) { throw new Error("Missing required property 'connectionPreference'"); } if (args?.enableProxyProtocol === undefined && !opts.urn) { throw new Error("Missing required property 'enableProxyProtocol'"); } if (args?.natSubnets === undefined && !opts.urn) { throw new Error("Missing required property 'natSubnets'"); } if (args?.targetService === undefined && !opts.urn) { throw new Error("Missing required property 'targetService'"); } resourceInputs["connectionPreference"] = args?.connectionPreference; resourceInputs["consumerAcceptLists"] = args?.consumerAcceptLists; resourceInputs["consumerRejectLists"] = args?.consumerRejectLists; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["domainNames"] = args?.domainNames; resourceInputs["enableProxyProtocol"] = args?.enableProxyProtocol; resourceInputs["name"] = args?.name; resourceInputs["natSubnets"] = args?.natSubnets; resourceInputs["project"] = args?.project; resourceInputs["propagatedConnectionLimit"] = args?.propagatedConnectionLimit; resourceInputs["reconcileConnections"] = args?.reconcileConnections; resourceInputs["region"] = args?.region; resourceInputs["sendPropagatedConnectionLimitIfZero"] = args?.sendPropagatedConnectionLimitIfZero; resourceInputs["showNatIps"] = args?.showNatIps; resourceInputs["targetService"] = args?.targetService; resourceInputs["tunnelingConfig"] = args?.tunnelingConfig; resourceInputs["connectedEndpoints"] = undefined /*out*/; resourceInputs["fingerprint"] = undefined /*out*/; resourceInputs["pscServiceAttachmentIds"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServiceAttachment.__pulumiType, name, resourceInputs, opts); } } exports.ServiceAttachment = ServiceAttachment; //# sourceMappingURL=serviceAttachment.js.map