@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
176 lines • 7.96 kB
JavaScript
;
// *** 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.VpcServiceControls = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Manages the VPC Service Controls configuration for a service
* networking connection
*
* When enabled, Google Cloud makes the following
* route configuration changes in the service producer VPC network:
* - Removes the IPv4 default route (destination 0.0.0.0/0,
* next hop default internet gateway), Google Cloud then creates an
* IPv4 route for destination 199.36.153.4/30 using the default
* internet gateway next hop.
* - Creates Cloud DNS managed private zones and authorizes those zones
* for the service producer VPC network. The zones include
* googleapis.com, gcr.io, pkg.dev, notebooks.cloud.google.com,
* kernels.googleusercontent.com, backupdr.cloud.google.com, and
* backupdr.googleusercontent.com as necessary domains or host names
* for Google APIs and services that are compatible with VPC Service
* Controls. Record data in the zones resolves all host names to
* 199.36.153.4, 199.36.153.5, 199.36.153.6, and 199.36.153.7.
*
* When disabled, Google Cloud makes the following route configuration
* changes in the service producer VPC network:
* - Restores a default route (destination 0.0.0.0/0, next hop default
* internet gateway)
* - Deletes the Cloud DNS managed private zones that provided the host
* name overrides.
*
* To get more information about VPCServiceControls, see:
*
* * [API documentation](https://cloud.google.com/service-infrastructure/docs/service-networking/reference/rest/v1/services)
* * How-to Guides
* * [Enable VPC Service Controls for service networking](https://cloud.google.com/sdk/gcloud/reference/services/vpc-peerings/enable-vpc-service-controls)
* * [Private Google Access with VPC Service Controls](https://cloud.google.com/vpc-service-controls/docs/private-connectivity)
* * [Set up private connectivity to Google APIs and services](https://cloud.google.com/vpc-service-controls/docs/set-up-private-connectivity)
*
* > **Note:** Destroying a `gcp.servicenetworking.VpcServiceControls`
* resource will remove it from state, but will not change the
* underlying VPC Service Controls configuration for the service
* producer network.
*
* ## Example Usage
*
* ### Service Networking Vpc Service Controls Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* // Create a VPC
* const _default = new gcp.compute.Network("default", {name: "example-network"});
* // Create an IP address
* const defaultGlobalAddress = new gcp.compute.GlobalAddress("default", {
* name: "psa-range",
* purpose: "VPC_PEERING",
* addressType: "INTERNAL",
* prefixLength: 16,
* network: _default.id,
* });
* // Create a private connection
* const defaultConnection = new gcp.servicenetworking.Connection("default", {
* network: _default.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [defaultGlobalAddress.name],
* });
* // Enable VPC-SC on the producer network
* const defaultVpcServiceControls = new gcp.servicenetworking.VpcServiceControls("default", {
* network: _default.name,
* service: "servicenetworking.googleapis.com",
* enabled: true,
* }, {
* dependsOn: [defaultConnection],
* });
* ```
*
* ## Import
*
* VPCServiceControls can be imported using any of these accepted formats:
*
* * `services/{{service}}/projects/{{project}}/networks/{{network}}`
* * `{{service}}/{{project}}/{{network}}`
* * `{{service}}/{{network}}`
*
* When using the `pulumi import` command, VPCServiceControls can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:servicenetworking/vpcServiceControls:VpcServiceControls default services/{{service}}/projects/{{project}}/networks/{{network}}
* $ pulumi import gcp:servicenetworking/vpcServiceControls:VpcServiceControls default {{service}}/{{project}}/{{network}}
* $ pulumi import gcp:servicenetworking/vpcServiceControls:VpcServiceControls default {{service}}/{{network}}
* ```
*/
class VpcServiceControls extends pulumi.CustomResource {
/**
* Get an existing VpcServiceControls 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 VpcServiceControls(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:servicenetworking/vpcServiceControls:VpcServiceControls';
/**
* Returns true if the given object is an instance of VpcServiceControls. 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'] === VpcServiceControls.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["network"] = state?.network;
resourceInputs["project"] = state?.project;
resourceInputs["service"] = state?.service;
}
else {
const args = argsOrState;
if (args?.enabled === undefined && !opts.urn) {
throw new Error("Missing required property 'enabled'");
}
if (args?.network === undefined && !opts.urn) {
throw new Error("Missing required property 'network'");
}
if (args?.service === undefined && !opts.urn) {
throw new Error("Missing required property 'service'");
}
resourceInputs["enabled"] = args?.enabled;
resourceInputs["network"] = args?.network;
resourceInputs["project"] = args?.project;
resourceInputs["service"] = args?.service;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VpcServiceControls.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpcServiceControls = VpcServiceControls;
//# sourceMappingURL=vpcServiceControls.js.map