UNPKG

@pulumi/gcp

Version:

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

275 lines (274 loc) • 10.1 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manage a network peering's route settings without managing the peering as * a whole. This resource is primarily intended for use with GCP-generated * peerings that shouldn't otherwise be managed by other tools. Deleting this * resource is a no-op and the peering will not be modified. * * To get more information about NetworkPeeringRoutesConfig, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/networks/updatePeering) * * How-to Guides * * [Official Documentation](https://cloud.google.com/vpc/docs/vpc-peering) * * ## Example Usage * * ### Network Peering Routes Config Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const networkPrimary = new gcp.compute.Network("network_primary", { * name: "primary-network", * autoCreateSubnetworks: false, * }); * const networkSecondary = new gcp.compute.Network("network_secondary", { * name: "secondary-network", * autoCreateSubnetworks: false, * }); * const peeringPrimary = new gcp.compute.NetworkPeering("peering_primary", { * name: "primary-peering", * network: networkPrimary.id, * peerNetwork: networkSecondary.id, * importCustomRoutes: true, * exportCustomRoutes: true, * importSubnetRoutesWithPublicIp: true, * exportSubnetRoutesWithPublicIp: true, * }); * const peeringPrimaryRoutes = new gcp.compute.NetworkPeeringRoutesConfig("peering_primary_routes", { * peering: peeringPrimary.name, * network: networkPrimary.name, * importCustomRoutes: true, * exportCustomRoutes: true, * importSubnetRoutesWithPublicIp: true, * exportSubnetRoutesWithPublicIp: true, * }); * const peeringSecondary = new gcp.compute.NetworkPeering("peering_secondary", { * name: "secondary-peering", * network: networkSecondary.id, * peerNetwork: networkPrimary.id, * }); * ``` * ### Network Peering Routes Config Gke * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const containerNetwork = new gcp.compute.Network("container_network", { * name: "container-network", * autoCreateSubnetworks: false, * }); * const containerSubnetwork = new gcp.compute.Subnetwork("container_subnetwork", { * name: "container-subnetwork", * region: "us-central1", * network: containerNetwork.name, * ipCidrRange: "10.0.36.0/24", * privateIpGoogleAccess: true, * secondaryIpRanges: [ * { * rangeName: "pod", * ipCidrRange: "10.0.0.0/19", * }, * { * rangeName: "svc", * ipCidrRange: "10.0.32.0/22", * }, * ], * }); * const privateCluster = new gcp.container.Cluster("private_cluster", { * name: "private-cluster", * location: "us-central1-a", * initialNodeCount: 1, * network: containerNetwork.name, * subnetwork: containerSubnetwork.name, * privateClusterConfig: { * enablePrivateEndpoint: true, * enablePrivateNodes: true, * masterIpv4CidrBlock: "10.42.0.0/28", * }, * masterAuthorizedNetworksConfig: {}, * ipAllocationPolicy: { * clusterSecondaryRangeName: containerSubnetwork.secondaryIpRanges.apply(secondaryIpRanges => secondaryIpRanges[0].rangeName), * servicesSecondaryRangeName: containerSubnetwork.secondaryIpRanges.apply(secondaryIpRanges => secondaryIpRanges[1].rangeName), * }, * deletionProtection: true, * }); * const peeringGkeRoutes = new gcp.compute.NetworkPeeringRoutesConfig("peering_gke_routes", { * peering: privateCluster.privateClusterConfig.apply(privateClusterConfig => privateClusterConfig.peeringName), * network: containerNetwork.name, * importCustomRoutes: true, * exportCustomRoutes: true, * importSubnetRoutesWithPublicIp: true, * exportSubnetRoutesWithPublicIp: true, * }); * ``` * * ## Import * * NetworkPeeringRoutesConfig can be imported using any of these accepted formats: * * * `projects/{{project}}/global/networks/{{network}}/networkPeerings/{{peering}}` * * * `{{project}}/{{network}}/{{peering}}` * * * `{{network}}/{{peering}}` * * When using the `pulumi import` command, NetworkPeeringRoutesConfig can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default projects/{{project}}/global/networks/{{network}}/networkPeerings/{{peering}} * ``` * * ```sh * $ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default {{project}}/{{network}}/{{peering}} * ``` * * ```sh * $ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default {{network}}/{{peering}} * ``` */ export declare class NetworkPeeringRoutesConfig extends pulumi.CustomResource { /** * Get an existing NetworkPeeringRoutesConfig 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?: NetworkPeeringRoutesConfigState, opts?: pulumi.CustomResourceOptions): NetworkPeeringRoutesConfig; /** * Returns true if the given object is an instance of NetworkPeeringRoutesConfig. 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 NetworkPeeringRoutesConfig; /** * Whether to export the custom routes to the peer network. */ readonly exportCustomRoutes: pulumi.Output<boolean>; /** * Whether subnet routes with public IP range are exported. * IPv4 special-use ranges are always exported to peers and * are not controlled by this field. */ readonly exportSubnetRoutesWithPublicIp: pulumi.Output<boolean>; /** * Whether to import the custom routes to the peer network. */ readonly importCustomRoutes: pulumi.Output<boolean>; /** * Whether subnet routes with public IP range are imported. * IPv4 special-use ranges are always imported from peers and * are not controlled by this field. */ readonly importSubnetRoutesWithPublicIp: pulumi.Output<boolean>; /** * The name of the primary network for the peering. * * * - - - */ readonly network: pulumi.Output<string>; /** * Name of the peering. */ readonly peering: pulumi.Output<string>; /** * 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>; /** * Create a NetworkPeeringRoutesConfig 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: NetworkPeeringRoutesConfigArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering NetworkPeeringRoutesConfig resources. */ export interface NetworkPeeringRoutesConfigState { /** * Whether to export the custom routes to the peer network. */ exportCustomRoutes?: pulumi.Input<boolean>; /** * Whether subnet routes with public IP range are exported. * IPv4 special-use ranges are always exported to peers and * are not controlled by this field. */ exportSubnetRoutesWithPublicIp?: pulumi.Input<boolean>; /** * Whether to import the custom routes to the peer network. */ importCustomRoutes?: pulumi.Input<boolean>; /** * Whether subnet routes with public IP range are imported. * IPv4 special-use ranges are always imported from peers and * are not controlled by this field. */ importSubnetRoutesWithPublicIp?: pulumi.Input<boolean>; /** * The name of the primary network for the peering. * * * - - - */ network?: pulumi.Input<string>; /** * Name of the peering. */ peering?: 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>; } /** * The set of arguments for constructing a NetworkPeeringRoutesConfig resource. */ export interface NetworkPeeringRoutesConfigArgs { /** * Whether to export the custom routes to the peer network. */ exportCustomRoutes: pulumi.Input<boolean>; /** * Whether subnet routes with public IP range are exported. * IPv4 special-use ranges are always exported to peers and * are not controlled by this field. */ exportSubnetRoutesWithPublicIp?: pulumi.Input<boolean>; /** * Whether to import the custom routes to the peer network. */ importCustomRoutes: pulumi.Input<boolean>; /** * Whether subnet routes with public IP range are imported. * IPv4 special-use ranges are always imported from peers and * are not controlled by this field. */ importSubnetRoutesWithPublicIp?: pulumi.Input<boolean>; /** * The name of the primary network for the peering. * * * - - - */ network: pulumi.Input<string>; /** * Name of the peering. */ peering: 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>; }