@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
327 lines (326 loc) • 14.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A network attachment is a resource that lets a producer Virtual Private Cloud (VPC) network initiate connections to a consumer VPC network through a Private Service Connect interface.
*
* To get more information about NetworkAttachment, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/networkAttachments)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/vpc/docs/about-network-attachments)
*
* ## Example Usage
*
* ### Network Attachment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultNetwork = new gcp.compute.Network("default", {
* name: "basic-network",
* autoCreateSubnetworks: false,
* });
* const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
* name: "basic-subnetwork",
* region: "us-central1",
* network: defaultNetwork.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const rejectedProducerProject = new gcp.organizations.Project("rejected_producer_project", {
* projectId: "prj-rejected",
* name: "prj-rejected",
* orgId: "123456789",
* billingAccount: "000000-0000000-0000000-000000",
* deletionPolicy: "DELETE",
* });
* const acceptedProducerProject = new gcp.organizations.Project("accepted_producer_project", {
* projectId: "prj-accepted",
* name: "prj-accepted",
* orgId: "123456789",
* billingAccount: "000000-0000000-0000000-000000",
* deletionPolicy: "DELETE",
* });
* const _default = new gcp.compute.NetworkAttachment("default", {
* name: "basic-network-attachment",
* region: "us-central1",
* description: "basic network attachment description",
* connectionPreference: "ACCEPT_MANUAL",
* subnetworks: [defaultSubnetwork.selfLink],
* producerAcceptLists: [acceptedProducerProject.projectId],
* producerRejectLists: [rejectedProducerProject.projectId],
* });
* ```
* ### Network Attachment Instance Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.compute.Network("default", {
* name: "basic-network",
* autoCreateSubnetworks: false,
* });
* const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
* name: "basic-subnetwork",
* region: "us-central1",
* network: _default.id,
* ipCidrRange: "10.0.0.0/16",
* });
* const defaultNetworkAttachment = new gcp.compute.NetworkAttachment("default", {
* name: "basic-network-attachment",
* region: "us-central1",
* description: "my basic network attachment",
* subnetworks: [defaultSubnetwork.id],
* connectionPreference: "ACCEPT_AUTOMATIC",
* });
* const defaultInstance = new gcp.compute.Instance("default", {
* name: "basic-instance",
* zone: "us-central1-a",
* machineType: "e2-micro",
* bootDisk: {
* initializeParams: {
* image: "debian-cloud/debian-11",
* },
* },
* networkInterfaces: [
* {
* network: "default",
* },
* {
* networkAttachment: defaultNetworkAttachment.selfLink,
* },
* ],
* });
* ```
*
* ## Import
*
* NetworkAttachment can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/networkAttachments/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, NetworkAttachment can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/networkAttachment:NetworkAttachment default projects/{{project}}/regions/{{region}}/networkAttachments/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkAttachment:NetworkAttachment default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkAttachment:NetworkAttachment default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkAttachment:NetworkAttachment default {{name}}
* ```
*/
export declare class NetworkAttachment extends pulumi.CustomResource {
/**
* Get an existing NetworkAttachment 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: string, id: pulumi.Input<pulumi.ID>, state?: NetworkAttachmentState, opts?: pulumi.CustomResourceOptions): NetworkAttachment;
/**
* Returns true if the given object is an instance of NetworkAttachment. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is NetworkAttachment;
/**
* An array of connections for all the producers connected to this network attachment.
* Structure is documented below.
*/
readonly connectionEndpoints: pulumi.Output<outputs.compute.NetworkAttachmentConnectionEndpoint[]>;
/**
* The connection preference of service attachment. The value can be set to ACCEPT_AUTOMATIC. An ACCEPT_AUTOMATIC service attachment is one that always accepts the connection from consumer forwarding rules.
* Possible values are: `ACCEPT_AUTOMATIC`, `ACCEPT_MANUAL`, `INVALID`.
*/
readonly connectionPreference: pulumi.Output<string>;
/**
* Creation timestamp in RFC3339 text format.
*/
readonly creationTimestamp: pulumi.Output<string>;
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Fingerprint of this resource. A hash of the contents stored in this object. This
* field is used in optimistic locking. An up-to-date fingerprint must be provided in order to patch.
*/
readonly fingerprint: pulumi.Output<string>;
/**
* Type of the resource.
*/
readonly kind: pulumi.Output<string>;
/**
* Name of the resource. Provided by the client when the resource is created. 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.
*/
readonly name: pulumi.Output<string>;
/**
* The URL of the network which the Network Attachment belongs to. Practically it is inferred by fetching the network of the first subnetwork associated.
* Because it is required that all the subnetworks must be from the same network, it is assured that the Network Attachment belongs to the same network as all the subnetworks.
*/
readonly network: pulumi.Output<string>;
/**
* Projects that are allowed to connect to this network attachment. The project can be specified using its id or number.
*/
readonly producerAcceptLists: pulumi.Output<string[] | undefined>;
/**
* Projects that are not allowed to connect to this network attachment. The project can be specified using its id or number.
*/
readonly producerRejectLists: pulumi.Output<string[] | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* URL of the region where the network attachment resides. This field applies only to the region resource. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
*/
readonly region: pulumi.Output<string>;
/**
* Server-defined URL for the resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* Server-defined URL for this resource's resource id.
*/
readonly selfLinkWithId: pulumi.Output<string>;
/**
* An array of URLs where each entry is the URL of a subnet provided by the service consumer to use for endpoints in the producers that connect to this network attachment.
*/
readonly subnetworks: pulumi.Output<string[]>;
/**
* Create a NetworkAttachment resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: NetworkAttachmentArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering NetworkAttachment resources.
*/
export interface NetworkAttachmentState {
/**
* An array of connections for all the producers connected to this network attachment.
* Structure is documented below.
*/
connectionEndpoints?: pulumi.Input<pulumi.Input<inputs.compute.NetworkAttachmentConnectionEndpoint>[]>;
/**
* The connection preference of service attachment. The value can be set to ACCEPT_AUTOMATIC. An ACCEPT_AUTOMATIC service attachment is one that always accepts the connection from consumer forwarding rules.
* Possible values are: `ACCEPT_AUTOMATIC`, `ACCEPT_MANUAL`, `INVALID`.
*/
connectionPreference?: pulumi.Input<string>;
/**
* Creation timestamp in RFC3339 text format.
*/
creationTimestamp?: pulumi.Input<string>;
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
description?: pulumi.Input<string>;
/**
* Fingerprint of this resource. A hash of the contents stored in this object. This
* field is used in optimistic locking. An up-to-date fingerprint must be provided in order to patch.
*/
fingerprint?: pulumi.Input<string>;
/**
* Type of the resource.
*/
kind?: pulumi.Input<string>;
/**
* Name of the resource. Provided by the client when the resource is created. 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.
*/
name?: pulumi.Input<string>;
/**
* The URL of the network which the Network Attachment belongs to. Practically it is inferred by fetching the network of the first subnetwork associated.
* Because it is required that all the subnetworks must be from the same network, it is assured that the Network Attachment belongs to the same network as all the subnetworks.
*/
network?: pulumi.Input<string>;
/**
* Projects that are allowed to connect to this network attachment. The project can be specified using its id or number.
*/
producerAcceptLists?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Projects that are not allowed to connect to this network attachment. The project can be specified using its id or number.
*/
producerRejectLists?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* URL of the region where the network attachment resides. This field applies only to the region resource. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
*/
region?: pulumi.Input<string>;
/**
* Server-defined URL for the resource.
*/
selfLink?: pulumi.Input<string>;
/**
* Server-defined URL for this resource's resource id.
*/
selfLinkWithId?: pulumi.Input<string>;
/**
* An array of URLs where each entry is the URL of a subnet provided by the service consumer to use for endpoints in the producers that connect to this network attachment.
*/
subnetworks?: pulumi.Input<pulumi.Input<string>[]>;
}
/**
* The set of arguments for constructing a NetworkAttachment resource.
*/
export interface NetworkAttachmentArgs {
/**
* The connection preference of service attachment. The value can be set to ACCEPT_AUTOMATIC. An ACCEPT_AUTOMATIC service attachment is one that always accepts the connection from consumer forwarding rules.
* Possible values are: `ACCEPT_AUTOMATIC`, `ACCEPT_MANUAL`, `INVALID`.
*/
connectionPreference: pulumi.Input<string>;
/**
* An optional description of this resource. Provide this property when you create the resource.
*/
description?: pulumi.Input<string>;
/**
* Name of the resource. Provided by the client when the resource is created. 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.
*/
name?: pulumi.Input<string>;
/**
* Projects that are allowed to connect to this network attachment. The project can be specified using its id or number.
*/
producerAcceptLists?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Projects that are not allowed to connect to this network attachment. The project can be specified using its id or number.
*/
producerRejectLists?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* URL of the region where the network attachment resides. This field applies only to the region resource. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.
*/
region?: pulumi.Input<string>;
/**
* An array of URLs where each entry is the URL of a subnet provided by the service consumer to use for endpoints in the producers that connect to this network attachment.
*/
subnetworks: pulumi.Input<pulumi.Input<string>[]>;
}