VpcPeeringConnectionAccepter

class VpcPeeringConnectionAccepter : KotlinCustomResource

Provides a resource to manage the accepter's side of a VPC Peering Connection. When a cross-account (requester's AWS account differs from the accepter's AWS account) or an inter-region VPC Peering Connection is created, a VPC Peering Connection resource is automatically created in the accepter's account. The requester can use the aws.ec2.VpcPeeringConnection resource to manage its side of the connection and the accepter can use the aws.ec2.VpcPeeringConnectionAccepter resource to "adopt" its side of the connection into management.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.Provider;
import com.pulumi.aws.ProviderArgs;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.AwsFunctions;
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.resources.CustomResourceOptions;
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 peer = new Provider("peer", ProviderArgs.builder()
.region("us-west-2")
.build());
var main = new Vpc("main", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var peerVpc = new Vpc("peerVpc", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build(), CustomResourceOptions.builder()
.provider(aws.peer())
.build());
final var peerCallerIdentity = AwsFunctions.getCallerIdentity();
var peerVpcPeeringConnection = new VpcPeeringConnection("peerVpcPeeringConnection", VpcPeeringConnectionArgs.builder()
.vpcId(main.id())
.peerVpcId(peerVpc.id())
.peerOwnerId(peerCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))
.peerRegion("us-west-2")
.autoAccept(false)
.tags(Map.of("Side", "Requester"))
.build());
var peerVpcPeeringConnectionAccepter = new VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", VpcPeeringConnectionAccepterArgs.builder()
.vpcPeeringConnectionId(peerVpcPeeringConnection.id())
.autoAccept(true)
.tags(Map.of("Side", "Accepter"))
.build(), CustomResourceOptions.builder()
.provider(aws.peer())
.build());
}
}

Import

VPC Peering Connection Accepters can be imported by using the Peering Connection ID, e.g.,

$ pulumi import aws:ec2/vpcPeeringConnectionAccepter:VpcPeeringConnectionAccepter example pcx-12345678

Certain resource arguments, like auto_accept, do not have an EC2 API method for reading the information after peering connection creation. If the argument is set in the provider configuration on an imported resource, this provder will always show a difference. To workaround this behavior, either omit the argument from the configuration or use ignoreChanges to hide the difference, e.g. terraform resource "aws_vpc_peering_connection_accepter" "example" {

... other configuration ...

There is no AWS EC2 API for reading auto_accept

lifecycle { ignore_changes = auto_accept } }

Properties

Link copied to clipboard

A configuration block that describes VPC Peering Connection (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options set for the accepter VPC.

Link copied to clipboard
val acceptStatus: Output<String>

The status of the VPC Peering Connection request.

Link copied to clipboard
val autoAccept: Output<Boolean>?

Whether or not to accept the peering request. Defaults to false.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val peerOwnerId: Output<String>

The AWS account ID of the owner of the requester VPC.

Link copied to clipboard
val peerRegion: Output<String>

The region of the accepter VPC.

Link copied to clipboard
val peerVpcId: Output<String>

The ID of the requester VPC.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A configuration block that describes VPC Peering Connection (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options set for the requester VPC.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

The ID of the accepter VPC.

Link copied to clipboard

The VPC Peering Connection ID to manage.