All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.compute.kotlin.NetworkPeeringRoutesConfig.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [NetworkPeeringRoutesConfig].
 */
@PulumiTagMarker
public class NetworkPeeringRoutesConfigResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NetworkPeeringRoutesConfigArgs = NetworkPeeringRoutesConfigArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend NetworkPeeringRoutesConfigArgsBuilder.() -> Unit) {
        val builder = NetworkPeeringRoutesConfigArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): NetworkPeeringRoutesConfig {
        val builtJavaResource =
            com.pulumi.gcp.compute.NetworkPeeringRoutesConfig(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return NetworkPeeringRoutesConfig(builtJavaResource)
    }
}

/**
 * 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,
 * });
 * const peeringPrimaryRoutes = new gcp.compute.NetworkPeeringRoutesConfig("peering_primary_routes", {
 *     peering: peeringPrimary.name,
 *     network: networkPrimary.name,
 *     importCustomRoutes: true,
 *     exportCustomRoutes: true,
 * });
 * const peeringSecondary = new gcp.compute.NetworkPeering("peering_secondary", {
 *     name: "secondary-peering",
 *     network: networkSecondary.id,
 *     peerNetwork: networkPrimary.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * network_primary = gcp.compute.Network("network_primary",
 *     name="primary-network",
 *     auto_create_subnetworks=False)
 * network_secondary = gcp.compute.Network("network_secondary",
 *     name="secondary-network",
 *     auto_create_subnetworks=False)
 * peering_primary = gcp.compute.NetworkPeering("peering_primary",
 *     name="primary-peering",
 *     network=network_primary.id,
 *     peer_network=network_secondary.id,
 *     import_custom_routes=True,
 *     export_custom_routes=True)
 * peering_primary_routes = gcp.compute.NetworkPeeringRoutesConfig("peering_primary_routes",
 *     peering=peering_primary.name,
 *     network=network_primary.name,
 *     import_custom_routes=True,
 *     export_custom_routes=True)
 * peering_secondary = gcp.compute.NetworkPeering("peering_secondary",
 *     name="secondary-peering",
 *     network=network_secondary.id,
 *     peer_network=network_primary.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var networkPrimary = new Gcp.Compute.Network("network_primary", new()
 *     {
 *         Name = "primary-network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var networkSecondary = new Gcp.Compute.Network("network_secondary", new()
 *     {
 *         Name = "secondary-network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var peeringPrimary = new Gcp.Compute.NetworkPeering("peering_primary", new()
 *     {
 *         Name = "primary-peering",
 *         Network = networkPrimary.Id,
 *         PeerNetwork = networkSecondary.Id,
 *         ImportCustomRoutes = true,
 *         ExportCustomRoutes = true,
 *     });
 *     var peeringPrimaryRoutes = new Gcp.Compute.NetworkPeeringRoutesConfig("peering_primary_routes", new()
 *     {
 *         Peering = peeringPrimary.Name,
 *         Network = networkPrimary.Name,
 *         ImportCustomRoutes = true,
 *         ExportCustomRoutes = true,
 *     });
 *     var peeringSecondary = new Gcp.Compute.NetworkPeering("peering_secondary", new()
 *     {
 *         Name = "secondary-peering",
 *         Network = networkSecondary.Id,
 *         PeerNetwork = networkPrimary.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		networkPrimary, err := compute.NewNetwork(ctx, "network_primary", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("primary-network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		networkSecondary, err := compute.NewNetwork(ctx, "network_secondary", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("secondary-network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		peeringPrimary, err := compute.NewNetworkPeering(ctx, "peering_primary", &compute.NetworkPeeringArgs{
 * 			Name:               pulumi.String("primary-peering"),
 * 			Network:            networkPrimary.ID(),
 * 			PeerNetwork:        networkSecondary.ID(),
 * 			ImportCustomRoutes: pulumi.Bool(true),
 * 			ExportCustomRoutes: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewNetworkPeeringRoutesConfig(ctx, "peering_primary_routes", &compute.NetworkPeeringRoutesConfigArgs{
 * 			Peering:            peeringPrimary.Name,
 * 			Network:            networkPrimary.Name,
 * 			ImportCustomRoutes: pulumi.Bool(true),
 * 			ExportCustomRoutes: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewNetworkPeering(ctx, "peering_secondary", &compute.NetworkPeeringArgs{
 * 			Name:        pulumi.String("secondary-peering"),
 * 			Network:     networkSecondary.ID(),
 * 			PeerNetwork: networkPrimary.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.NetworkPeering;
 * import com.pulumi.gcp.compute.NetworkPeeringArgs;
 * import com.pulumi.gcp.compute.NetworkPeeringRoutesConfig;
 * import com.pulumi.gcp.compute.NetworkPeeringRoutesConfigArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var networkPrimary = new Network("networkPrimary", NetworkArgs.builder()
 *             .name("primary-network")
 *             .autoCreateSubnetworks("false")
 *             .build());
 *         var networkSecondary = new Network("networkSecondary", NetworkArgs.builder()
 *             .name("secondary-network")
 *             .autoCreateSubnetworks("false")
 *             .build());
 *         var peeringPrimary = new NetworkPeering("peeringPrimary", NetworkPeeringArgs.builder()
 *             .name("primary-peering")
 *             .network(networkPrimary.id())
 *             .peerNetwork(networkSecondary.id())
 *             .importCustomRoutes(true)
 *             .exportCustomRoutes(true)
 *             .build());
 *         var peeringPrimaryRoutes = new NetworkPeeringRoutesConfig("peeringPrimaryRoutes", NetworkPeeringRoutesConfigArgs.builder()
 *             .peering(peeringPrimary.name())
 *             .network(networkPrimary.name())
 *             .importCustomRoutes(true)
 *             .exportCustomRoutes(true)
 *             .build());
 *         var peeringSecondary = new NetworkPeering("peeringSecondary", NetworkPeeringArgs.builder()
 *             .name("secondary-peering")
 *             .network(networkSecondary.id())
 *             .peerNetwork(networkPrimary.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 * 
 * ```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,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * container_network = gcp.compute.Network("container_network",
 *     name="container-network",
 *     auto_create_subnetworks=False)
 * container_subnetwork = gcp.compute.Subnetwork("container_subnetwork",
 *     name="container-subnetwork",
 *     region="us-central1",
 *     network=container_network.name,
 *     ip_cidr_range="10.0.36.0/24",
 *     private_ip_google_access=True,
 *     secondary_ip_ranges=[
 *         gcp.compute.SubnetworkSecondaryIpRangeArgs(
 *             range_name="pod",
 *             ip_cidr_range="10.0.0.0/19",
 *         ),
 *         gcp.compute.SubnetworkSecondaryIpRangeArgs(
 *             range_name="svc",
 *             ip_cidr_range="10.0.32.0/22",
 *         ),
 *     ])
 * private_cluster = gcp.container.Cluster("private_cluster",
 *     name="private-cluster",
 *     location="us-central1-a",
 *     initial_node_count=1,
 *     network=container_network.name,
 *     subnetwork=container_subnetwork.name,
 *     private_cluster_config=gcp.container.ClusterPrivateClusterConfigArgs(
 *         enable_private_endpoint=True,
 *         enable_private_nodes=True,
 *         master_ipv4_cidr_block="10.42.0.0/28",
 *     ),
 *     master_authorized_networks_config=gcp.container.ClusterMasterAuthorizedNetworksConfigArgs(),
 *     ip_allocation_policy=gcp.container.ClusterIpAllocationPolicyArgs(
 *         cluster_secondary_range_name=container_subnetwork.secondary_ip_ranges[0].range_name,
 *         services_secondary_range_name=container_subnetwork.secondary_ip_ranges[1].range_name,
 *     ),
 *     deletion_protection=True)
 * peering_gke_routes = gcp.compute.NetworkPeeringRoutesConfig("peering_gke_routes",
 *     peering=private_cluster.private_cluster_config.peering_name,
 *     network=container_network.name,
 *     import_custom_routes=True,
 *     export_custom_routes=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var containerNetwork = new Gcp.Compute.Network("container_network", new()
 *     {
 *         Name = "container-network",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var containerSubnetwork = new Gcp.Compute.Subnetwork("container_subnetwork", new()
 *     {
 *         Name = "container-subnetwork",
 *         Region = "us-central1",
 *         Network = containerNetwork.Name,
 *         IpCidrRange = "10.0.36.0/24",
 *         PrivateIpGoogleAccess = true,
 *         SecondaryIpRanges = new[]
 *         {
 *             new Gcp.Compute.Inputs.SubnetworkSecondaryIpRangeArgs
 *             {
 *                 RangeName = "pod",
 *                 IpCidrRange = "10.0.0.0/19",
 *             },
 *             new Gcp.Compute.Inputs.SubnetworkSecondaryIpRangeArgs
 *             {
 *                 RangeName = "svc",
 *                 IpCidrRange = "10.0.32.0/22",
 *             },
 *         },
 *     });
 *     var privateCluster = new Gcp.Container.Cluster("private_cluster", new()
 *     {
 *         Name = "private-cluster",
 *         Location = "us-central1-a",
 *         InitialNodeCount = 1,
 *         Network = containerNetwork.Name,
 *         Subnetwork = containerSubnetwork.Name,
 *         PrivateClusterConfig = new Gcp.Container.Inputs.ClusterPrivateClusterConfigArgs
 *         {
 *             EnablePrivateEndpoint = true,
 *             EnablePrivateNodes = true,
 *             MasterIpv4CidrBlock = "10.42.0.0/28",
 *         },
 *         MasterAuthorizedNetworksConfig = null,
 *         IpAllocationPolicy = new Gcp.Container.Inputs.ClusterIpAllocationPolicyArgs
 *         {
 *             ClusterSecondaryRangeName = containerSubnetwork.SecondaryIpRanges.Apply(secondaryIpRanges => secondaryIpRanges[0].RangeName),
 *             ServicesSecondaryRangeName = containerSubnetwork.SecondaryIpRanges.Apply(secondaryIpRanges => secondaryIpRanges[1].RangeName),
 *         },
 *         DeletionProtection = true,
 *     });
 *     var peeringGkeRoutes = new Gcp.Compute.NetworkPeeringRoutesConfig("peering_gke_routes", new()
 *     {
 *         Peering = privateCluster.PrivateClusterConfig.Apply(privateClusterConfig => privateClusterConfig.PeeringName),
 *         Network = containerNetwork.Name,
 *         ImportCustomRoutes = true,
 *         ExportCustomRoutes = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		containerNetwork, err := compute.NewNetwork(ctx, "container_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("container-network"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		containerSubnetwork, err := compute.NewSubnetwork(ctx, "container_subnetwork", &compute.SubnetworkArgs{
 * 			Name:                  pulumi.String("container-subnetwork"),
 * 			Region:                pulumi.String("us-central1"),
 * 			Network:               containerNetwork.Name,
 * 			IpCidrRange:           pulumi.String("10.0.36.0/24"),
 * 			PrivateIpGoogleAccess: pulumi.Bool(true),
 * 			SecondaryIpRanges: compute.SubnetworkSecondaryIpRangeArray{
 * 				&compute.SubnetworkSecondaryIpRangeArgs{
 * 					RangeName:   pulumi.String("pod"),
 * 					IpCidrRange: pulumi.String("10.0.0.0/19"),
 * 				},
 * 				&compute.SubnetworkSecondaryIpRangeArgs{
 * 					RangeName:   pulumi.String("svc"),
 * 					IpCidrRange: pulumi.String("10.0.32.0/22"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		privateCluster, err := container.NewCluster(ctx, "private_cluster", &container.ClusterArgs{
 * 			Name:             pulumi.String("private-cluster"),
 * 			Location:         pulumi.String("us-central1-a"),
 * 			InitialNodeCount: pulumi.Int(1),
 * 			Network:          containerNetwork.Name,
 * 			Subnetwork:       containerSubnetwork.Name,
 * 			PrivateClusterConfig: &container.ClusterPrivateClusterConfigArgs{
 * 				EnablePrivateEndpoint: pulumi.Bool(true),
 * 				EnablePrivateNodes:    pulumi.Bool(true),
 * 				MasterIpv4CidrBlock:   pulumi.String("10.42.0.0/28"),
 * 			},
 * 			MasterAuthorizedNetworksConfig: nil,
 * 			IpAllocationPolicy: &container.ClusterIpAllocationPolicyArgs{
 * 				ClusterSecondaryRangeName: containerSubnetwork.SecondaryIpRanges.ApplyT(func(secondaryIpRanges []compute.SubnetworkSecondaryIpRange) (*string, error) {
 * 					return &secondaryIpRanges[0].RangeName, nil
 * 				}).(pulumi.StringPtrOutput),
 * 				ServicesSecondaryRangeName: containerSubnetwork.SecondaryIpRanges.ApplyT(func(secondaryIpRanges []compute.SubnetworkSecondaryIpRange) (*string, error) {
 * 					return &secondaryIpRanges[1].RangeName, nil
 * 				}).(pulumi.StringPtrOutput),
 * 			},
 * 			DeletionProtection: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewNetworkPeeringRoutesConfig(ctx, "peering_gke_routes", &compute.NetworkPeeringRoutesConfigArgs{
 * 			Peering: privateCluster.PrivateClusterConfig.ApplyT(func(privateClusterConfig container.ClusterPrivateClusterConfig) (*string, error) {
 * 				return &privateClusterConfig.PeeringName, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			Network:            containerNetwork.Name,
 * 			ImportCustomRoutes: pulumi.Bool(true),
 * 			ExportCustomRoutes: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.Subnetwork;
 * import com.pulumi.gcp.compute.SubnetworkArgs;
 * import com.pulumi.gcp.compute.inputs.SubnetworkSecondaryIpRangeArgs;
 * import com.pulumi.gcp.container.Cluster;
 * import com.pulumi.gcp.container.ClusterArgs;
 * import com.pulumi.gcp.container.inputs.ClusterPrivateClusterConfigArgs;
 * import com.pulumi.gcp.container.inputs.ClusterMasterAuthorizedNetworksConfigArgs;
 * import com.pulumi.gcp.container.inputs.ClusterIpAllocationPolicyArgs;
 * import com.pulumi.gcp.compute.NetworkPeeringRoutesConfig;
 * import com.pulumi.gcp.compute.NetworkPeeringRoutesConfigArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var containerNetwork = new Network("containerNetwork", NetworkArgs.builder()
 *             .name("container-network")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var containerSubnetwork = new Subnetwork("containerSubnetwork", SubnetworkArgs.builder()
 *             .name("container-subnetwork")
 *             .region("us-central1")
 *             .network(containerNetwork.name())
 *             .ipCidrRange("10.0.36.0/24")
 *             .privateIpGoogleAccess(true)
 *             .secondaryIpRanges(
 *                 SubnetworkSecondaryIpRangeArgs.builder()
 *                     .rangeName("pod")
 *                     .ipCidrRange("10.0.0.0/19")
 *                     .build(),
 *                 SubnetworkSecondaryIpRangeArgs.builder()
 *                     .rangeName("svc")
 *                     .ipCidrRange("10.0.32.0/22")
 *                     .build())
 *             .build());
 *         var privateCluster = new Cluster("privateCluster", ClusterArgs.builder()
 *             .name("private-cluster")
 *             .location("us-central1-a")
 *             .initialNodeCount(1)
 *             .network(containerNetwork.name())
 *             .subnetwork(containerSubnetwork.name())
 *             .privateClusterConfig(ClusterPrivateClusterConfigArgs.builder()
 *                 .enablePrivateEndpoint(true)
 *                 .enablePrivateNodes(true)
 *                 .masterIpv4CidrBlock("10.42.0.0/28")
 *                 .build())
 *             .masterAuthorizedNetworksConfig()
 *             .ipAllocationPolicy(ClusterIpAllocationPolicyArgs.builder()
 *                 .clusterSecondaryRangeName(containerSubnetwork.secondaryIpRanges().applyValue(secondaryIpRanges -> secondaryIpRanges[0].rangeName()))
 *                 .servicesSecondaryRangeName(containerSubnetwork.secondaryIpRanges().applyValue(secondaryIpRanges -> secondaryIpRanges[1].rangeName()))
 *                 .build())
 *             .deletionProtection("true")
 *             .build());
 *         var peeringGkeRoutes = new NetworkPeeringRoutesConfig("peeringGkeRoutes", NetworkPeeringRoutesConfigArgs.builder()
 *             .peering(privateCluster.privateClusterConfig().applyValue(privateClusterConfig -> privateClusterConfig.peeringName()))
 *             .network(containerNetwork.name())
 *             .importCustomRoutes(true)
 *             .exportCustomRoutes(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   peeringGkeRoutes:
 *     type: gcp:compute:NetworkPeeringRoutesConfig
 *     name: peering_gke_routes
 *     properties:
 *       peering: ${privateCluster.privateClusterConfig.peeringName}
 *       network: ${containerNetwork.name}
 *       importCustomRoutes: true
 *       exportCustomRoutes: true
 *   containerNetwork:
 *     type: gcp:compute:Network
 *     name: container_network
 *     properties:
 *       name: container-network
 *       autoCreateSubnetworks: false
 *   containerSubnetwork:
 *     type: gcp:compute:Subnetwork
 *     name: container_subnetwork
 *     properties:
 *       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
 *   privateCluster:
 *     type: gcp:container:Cluster
 *     name: private_cluster
 *     properties:
 *       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[0].rangeName}
 *         servicesSecondaryRangeName: ${containerSubnetwork.secondaryIpRanges[1].rangeName}
 *       deletionProtection: '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}}
 * ```
 */
public class NetworkPeeringRoutesConfig internal constructor(
    override val javaResource: com.pulumi.gcp.compute.NetworkPeeringRoutesConfig,
) : KotlinCustomResource(javaResource, NetworkPeeringRoutesConfigMapper) {
    /**
     * Whether to export the custom routes to the peer network.
     */
    public val exportCustomRoutes: Output
        get() = javaResource.exportCustomRoutes().applyValue({ args0 -> args0 })

    /**
     * Whether to import the custom routes to the peer network.
     */
    public val importCustomRoutes: Output
        get() = javaResource.importCustomRoutes().applyValue({ args0 -> args0 })

    /**
     * The name of the primary network for the peering.
     * - - -
     */
    public val network: Output
        get() = javaResource.network().applyValue({ args0 -> args0 })

    /**
     * Name of the peering.
     */
    public val peering: Output
        get() = javaResource.peering().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })
}

public object NetworkPeeringRoutesConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.NetworkPeeringRoutesConfig::class == javaResource::class

    override fun map(javaResource: Resource): NetworkPeeringRoutesConfig =
        NetworkPeeringRoutesConfig(javaResource as com.pulumi.gcp.compute.NetworkPeeringRoutesConfig)
}

/**
 * @see [NetworkPeeringRoutesConfig].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NetworkPeeringRoutesConfig].
 */
public suspend fun networkPeeringRoutesConfig(
    name: String,
    block: suspend NetworkPeeringRoutesConfigResourceBuilder.() -> Unit,
): NetworkPeeringRoutesConfig {
    val builder = NetworkPeeringRoutesConfigResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NetworkPeeringRoutesConfig].
 * @param name The _unique_ name of the resulting resource.
 */
public fun networkPeeringRoutesConfig(name: String): NetworkPeeringRoutesConfig {
    val builder = NetworkPeeringRoutesConfigResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy