Class PeeringConnectionOptions


  • public class PeeringConnectionOptions
    extends com.pulumi.resources.CustomResource
    Provides a resource to manage VPC peering connection options. > **NOTE on VPC Peering Connections and VPC Peering Connection Options:** This provider provides both a standalone VPC Peering Connection Options and a VPC Peering Connection resource with `accepter` and `requester` attributes. Do not manage options for the same VPC peering connection in both a VPC Peering Connection resource and a VPC Peering Connection Options resource. Doing so will cause a conflict of options and will overwrite the options. Using a VPC Peering Connection Options resource decouples management of the connection options from management of the VPC Peering Connection and allows options to be set correctly in cross-region and cross-account scenarios. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ec2.Vpc;
     import com.pulumi.aws.ec2.VpcArgs;
     import com.pulumi.aws.ec2.VpcPeeringConnection;
     import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
     import com.pulumi.aws.ec2.PeeringConnectionOptions;
     import com.pulumi.aws.ec2.PeeringConnectionOptionsArgs;
     import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsAccepterArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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 foo = new Vpc("foo", VpcArgs.builder()
                 .cidrBlock("10.0.0.0/16")
                 .build());
     
             var bar = new Vpc("bar", VpcArgs.builder()
                 .cidrBlock("10.1.0.0/16")
                 .build());
     
             var fooVpcPeeringConnection = new VpcPeeringConnection("fooVpcPeeringConnection", VpcPeeringConnectionArgs.builder()
                 .vpcId(foo.id())
                 .peerVpcId(bar.id())
                 .autoAccept(true)
                 .build());
     
             var fooPeeringConnectionOptions = new PeeringConnectionOptions("fooPeeringConnectionOptions", PeeringConnectionOptionsArgs.builder()
                 .accepter(PeeringConnectionOptionsAccepterArgs.builder()
                     .allowRemoteVpcDnsResolution(true)
                     .build())
                 .vpcPeeringConnectionId(fooVpcPeeringConnection.id())
                 .build());
     
         }
     }
     
     
    ### Cross-Account Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ec2.Vpc;
     import com.pulumi.aws.ec2.VpcArgs;
     import com.pulumi.aws.AwsFunctions;
     import com.pulumi.aws.inputs.GetCallerIdentityArgs;
     import com.pulumi.aws.ec2.VpcPeeringConnection;
     import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
     import com.pulumi.aws.ec2.VpcPeeringConnectionAccepter;
     import com.pulumi.aws.ec2.VpcPeeringConnectionAccepterArgs;
     import com.pulumi.aws.ec2.PeeringConnectionOptions;
     import com.pulumi.aws.ec2.PeeringConnectionOptionsArgs;
     import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsRequesterArgs;
     import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsAccepterArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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 main = new Vpc("main", VpcArgs.builder()
                 .cidrBlock("10.0.0.0/16")
                 .enableDnsSupport(true)
                 .enableDnsHostnames(true)
                 .build());
     
             var peerVpc = new Vpc("peerVpc", VpcArgs.builder()
                 .cidrBlock("10.1.0.0/16")
                 .enableDnsSupport(true)
                 .enableDnsHostnames(true)
                 .build());
     
             final var peer = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
                 .build());
     
             // Requester's side of the connection.
             var peerVpcPeeringConnection = new VpcPeeringConnection("peerVpcPeeringConnection", VpcPeeringConnectionArgs.builder()
                 .vpcId(main.id())
                 .peerVpcId(peerVpc.id())
                 .peerOwnerId(peer.accountId())
                 .autoAccept(false)
                 .tags(Map.of("Side", "Requester"))
                 .build());
     
             // Accepter's side of the connection.
             var peerVpcPeeringConnectionAccepter = new VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", VpcPeeringConnectionAccepterArgs.builder()
                 .vpcPeeringConnectionId(peerVpcPeeringConnection.id())
                 .autoAccept(true)
                 .tags(Map.of("Side", "Accepter"))
                 .build());
     
             var requester = new PeeringConnectionOptions("requester", PeeringConnectionOptionsArgs.builder()
                 .requester(PeeringConnectionOptionsRequesterArgs.builder()
                     .allowRemoteVpcDnsResolution(true)
                     .build())
                 .vpcPeeringConnectionId(peerVpcPeeringConnectionAccepter.id())
                 .build());
     
             var accepter = new PeeringConnectionOptions("accepter", PeeringConnectionOptionsArgs.builder()
                 .accepter(PeeringConnectionOptionsAccepterArgs.builder()
                     .allowRemoteVpcDnsResolution(true)
                     .build())
                 .vpcPeeringConnectionId(peerVpcPeeringConnectionAccepter.id())
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import VPC Peering Connection Options using the VPC peering `id`. For example: ```sh $ pulumi import aws:ec2/peeringConnectionOptions:PeeringConnectionOptions foo pcx-111aaa111 ```
    • 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<PeeringConnectionOptionsAccepter> accepter()  
      static PeeringConnectionOptions get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, PeeringConnectionOptionsState 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.lang.String> region()  
      com.pulumi.core.Output<PeeringConnectionOptionsRequester> requester()  
      com.pulumi.core.Output<java.lang.String> vpcPeeringConnectionId()  
      • Methods inherited from class com.pulumi.resources.CustomResource

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

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

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

      • PeeringConnectionOptions

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

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

        public PeeringConnectionOptions​(java.lang.String name,
                                        PeeringConnectionOptionsArgs 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

      • accepter

        public com.pulumi.core.Output<PeeringConnectionOptionsAccepter> accepter()
        Returns:
        Configuration block for [VPC Peering Connection](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to set for the VPC that accepts the peering connection (a maximum of one). See `accepter` Block below.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • requester

        public com.pulumi.core.Output<PeeringConnectionOptionsRequester> requester()
        Returns:
        Configuration block for [VPC Peering Connection](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to set for the VPC that requests the peering connection (a maximum of one). See `requester` Block below.
      • vpcPeeringConnectionId

        public com.pulumi.core.Output<java.lang.String> vpcPeeringConnectionId()
        Returns:
        ID of the requester VPC peering connection.
      • get

        public static PeeringConnectionOptions get​(java.lang.String name,
                                                   com.pulumi.core.Output<java.lang.String> id,
                                                   @Nullable
                                                   PeeringConnectionOptionsState 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.