Package com.pulumi.aws.ec2
Class PeeringConnectionOptions
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.ec2.PeeringConnectionOptions
-
public class PeeringConnectionOptions extends com.pulumi.resources.CustomResourceProvides 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
### Cross-Account Usagepackage 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()); } }
## 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 ```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()); } }
-
-
Constructor Summary
Constructors Constructor Description PeeringConnectionOptions(java.lang.String name)PeeringConnectionOptions(java.lang.String name, PeeringConnectionOptionsArgs args)PeeringConnectionOptions(java.lang.String name, PeeringConnectionOptionsArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<PeeringConnectionOptionsAccepter>accepter()static PeeringConnectionOptionsget(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()
-
-
-
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.
-
-