Class NetworkPeering


  • public class NetworkPeering
    extends com.pulumi.resources.CustomResource
    Manages a network peering within GCE. For more information see [the official documentation](https://cloud.google.com/compute/docs/vpc/vpc-peering) and [API](https://cloud.google.com/compute/docs/reference/latest/networks). > Both networks must create a peering with each other for the peering to be functional. > Subnets IP ranges across peered VPC networks cannot overlap. ## Example Usage ```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 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 default_ = new Network("default", NetworkArgs.builder() .autoCreateSubnetworks("false") .build()); var other = new Network("other", NetworkArgs.builder() .autoCreateSubnetworks("false") .build()); var peering1 = new NetworkPeering("peering1", NetworkPeeringArgs.builder() .network(default_.selfLink()) .peerNetwork(other.selfLink()) .build()); var peering2 = new NetworkPeering("peering2", NetworkPeeringArgs.builder() .network(other.selfLink()) .peerNetwork(default_.selfLink()) .build()); } } ``` ## Import VPC network peerings can be imported using the name and project of the primary network the peering exists in and the name of the network peering ```sh $ pulumi import gcp:compute/networkPeering:NetworkPeering peering_network project-name/network-name/peering-name ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> exportCustomRoutes()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> exportSubnetRoutesWithPublicIp()  
      static NetworkPeering get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, NetworkPeeringState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> importCustomRoutes()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> importSubnetRoutesWithPublicIp()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> network()  
      com.pulumi.core.Output<java.lang.String> peerNetwork()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> stackType()  
      com.pulumi.core.Output<java.lang.String> state()  
      com.pulumi.core.Output<java.lang.String> stateDetails()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NetworkPeering

        public NetworkPeering​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • NetworkPeering

        public NetworkPeering​(java.lang.String name,
                              NetworkPeeringArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • NetworkPeering

        public NetworkPeering​(java.lang.String name,
                              NetworkPeeringArgs args,
                              @Nullable
                              com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • exportCustomRoutes

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> exportCustomRoutes()
        Returns:
        Whether to export the custom routes to the peer network. Defaults to `false`.
      • exportSubnetRoutesWithPublicIp

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> exportSubnetRoutesWithPublicIp()
        Returns:
        Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported. The IPv4 special-use ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always exported to peers and are not controlled by this field.
      • importCustomRoutes

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> importCustomRoutes()
        Returns:
        Whether to import the custom routes from the peer network. Defaults to `false`.
      • importSubnetRoutesWithPublicIp

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> importSubnetRoutesWithPublicIp()
        Returns:
        Whether subnet routes with public IP range are imported. The default value is false. The IPv4 special-use ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always imported from peers and are not controlled by this field.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the peering.
      • network

        public com.pulumi.core.Output<java.lang.String> network()
        Returns:
        The primary network of the peering.
      • peerNetwork

        public com.pulumi.core.Output<java.lang.String> peerNetwork()
        Returns:
        The peer network in the peering. The peer network may belong to a different project.
      • stackType

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> stackType()
        Returns:
        Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY. Possible values: ["IPV4_ONLY", "IPV4_IPV6"].
      • state

        public com.pulumi.core.Output<java.lang.String> state()
        Returns:
        State for the peering, either `ACTIVE` or `INACTIVE`. The peering is `ACTIVE` when there's a matching configuration in the peer network.
      • stateDetails

        public com.pulumi.core.Output<java.lang.String> stateDetails()
        Returns:
        Details about the current state of the peering.
      • get

        public static NetworkPeering get​(java.lang.String name,
                                         com.pulumi.core.Output<java.lang.String> id,
                                         @Nullable
                                         NetworkPeeringState state,
                                         @Nullable
                                         com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.