Vpc Peering Connection Args
Provides a resource to manage a VPC peering connection.
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
andrequester
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-account scenarios. Note: For cross-account (requester's AWS account differs from the accepter's AWS account) or inter-region VPC Peering Connections use theaws.ec2.VpcPeeringConnection
resource to manage the requester's side of the connection and use theaws.ec2.VpcPeeringConnectionAccepter
resource to manage the accepter's side of the connection. Note: Creating multipleaws.ec2.VpcPeeringConnection
resources with the samepeer_vpc_id
andvpc_id
will not produce an error. Instead, AWS will return the connectionid
that already exists, resulting in multipleaws.ec2.VpcPeeringConnection
resources with the sameid
.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.VpcPeeringConnection;
import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
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 foo = new VpcPeeringConnection("foo", VpcPeeringConnectionArgs.builder()
.peerOwnerId(var_.peer_owner_id())
.peerVpcId(aws_vpc.bar().id())
.vpcId(aws_vpc.foo().id())
.build());
}
}
Notes
If both VPCs are not in the same AWS account and region do not enable the auto_accept
attribute. The accepter can manage its side of the connection using the aws.ec2.VpcPeeringConnectionAccepter
resource or accept the connection manually using the AWS Management Console, AWS CLI, through SDKs, etc.
Import
VPC Peering resources can be imported using the vpc peering id
, e.g.,
$ pulumi import aws:ec2/vpcPeeringConnection:VpcPeeringConnection test_connection pcx-111aaa111
Constructors
Properties
An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
Accept the peering (both VPCs need to be in the same AWS account and region).
The AWS account ID of the owner of the peer VPC. Defaults to the account ID the AWS provider is currently connected to.
The region of the accepter VPC of the VPC Peering Connection. auto_accept
must be false
, and use the aws.ec2.VpcPeeringConnectionAccepter
to manage the accepter side.
A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).