Expand description
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
- How-to Guides
§Example Usage
§Network Peering Routes Config Basic
resources:
peeringPrimaryRoutes:
type: gcp:compute:NetworkPeeringRoutesConfig
name: peering_primary_routes
properties:
peering: ${peeringPrimary.name}
network: ${networkPrimary.name}
importCustomRoutes: true
exportCustomRoutes: true
peeringPrimary:
type: gcp:compute:NetworkPeering
name: peering_primary
properties:
name: primary-peering
network: ${networkPrimary.id}
peerNetwork: ${networkSecondary.id}
importCustomRoutes: true
exportCustomRoutes: true
peeringSecondary:
type: gcp:compute:NetworkPeering
name: peering_secondary
properties:
name: secondary-peering
network: ${networkSecondary.id}
peerNetwork: ${networkPrimary.id}
networkPrimary:
type: gcp:compute:Network
name: network_primary
properties:
name: primary-network
autoCreateSubnetworks: 'false'
networkSecondary:
type: gcp:compute:Network
name: network_secondary
properties:
name: secondary-network
autoCreateSubnetworks: 'false'
§Network Peering Routes Config Gke
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let containerNetwork = network::create(
"containerNetwork",
NetworkArgs::builder()
.auto_create_subnetworks(false)
.name("container-network")
.build_struct(),
);
let containerSubnetwork = subnetwork::create(
"containerSubnetwork",
SubnetworkArgs::builder()
.ip_cidr_range("10.0.36.0/24")
.name("container-subnetwork")
.network("${containerNetwork.name}")
.private_ip_google_access(true)
.region("us-central1")
.secondary_ip_ranges(
vec![
SubnetworkSecondaryIpRange::builder().ipCidrRange("10.0.0.0/19")
.rangeName("pod").build_struct(),
SubnetworkSecondaryIpRange::builder().ipCidrRange("10.0.32.0/22")
.rangeName("svc").build_struct(),
],
)
.build_struct(),
);
let peeringGkeRoutes = network_peering_routes_config::create(
"peeringGkeRoutes",
NetworkPeeringRoutesConfigArgs::builder()
.export_custom_routes(true)
.import_custom_routes(true)
.network("${containerNetwork.name}")
.peering("${privateCluster.privateClusterConfig.peeringName}")
.build_struct(),
);
let privateCluster = cluster::create(
"privateCluster",
ClusterArgs::builder()
.deletion_protection(true)
.initial_node_count(1)
.ip_allocation_policy(
ClusterIpAllocationPolicy::builder()
.clusterSecondaryRangeName(
"${containerSubnetwork.secondaryIpRanges[0].rangeName}",
)
.servicesSecondaryRangeName(
"${containerSubnetwork.secondaryIpRanges[1].rangeName}",
)
.build_struct(),
)
.location("us-central1-a")
.master_authorized_networks_config(
ClusterMasterAuthorizedNetworksConfig::builder().build_struct(),
)
.name("private-cluster")
.network("${containerNetwork.name}")
.private_cluster_config(
ClusterPrivateClusterConfig::builder()
.enablePrivateEndpoint(true)
.enablePrivateNodes(true)
.masterIpv4CidrBlock("10.42.0.0/28")
.build_struct(),
)
.subnetwork("${containerSubnetwork.name}")
.build_struct(),
);
}
§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:
$ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default projects/{{project}}/global/networks/{{network}}/networkPeerings/{{peering}}
$ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default {{project}}/{{network}}/{{peering}}
$ pulumi import gcp:compute/networkPeeringRoutesConfig:NetworkPeeringRoutesConfig default {{network}}/{{peering}}
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments