Package com.pulumi.aws.directconnect
Class GatewayAssociation
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.directconnect.GatewayAssociation
-
public class GatewayAssociation extends com.pulumi.resources.CustomResourceAssociates a Direct Connect Gateway with a VGW or transit gateway. To create a cross-account association, create an `aws.directconnect.GatewayAssociationProposal` resource in the AWS account that owns the VGW or transit gateway and then accept the proposal in the AWS account that owns the Direct Connect Gateway by creating an `aws.directconnect.GatewayAssociation` resource with the `proposalId` and `associatedGatewayOwnerAccountId` attributes set. ## Example Usage ### VPN Gateway Association
### Transit Gateway Associationpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.directconnect.Gateway; import com.pulumi.aws.directconnect.GatewayArgs; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.VpnGateway; import com.pulumi.aws.ec2.VpnGatewayArgs; import com.pulumi.aws.directconnect.GatewayAssociation; import com.pulumi.aws.directconnect.GatewayAssociationArgs; 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 example = new Gateway("example", GatewayArgs.builder() .name("example") .amazonSideAsn("64512") .build()); var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder() .cidrBlock("10.255.255.0/28") .build()); var exampleVpnGateway = new VpnGateway("exampleVpnGateway", VpnGatewayArgs.builder() .vpcId(exampleVpc.id()) .build()); var exampleGatewayAssociation = new GatewayAssociation("exampleGatewayAssociation", GatewayAssociationArgs.builder() .dxGatewayId(example.id()) .associatedGatewayId(exampleVpnGateway.id()) .build()); } }
### Allowed Prefixespackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.directconnect.Gateway; import com.pulumi.aws.directconnect.GatewayArgs; import com.pulumi.aws.ec2transitgateway.TransitGateway; import com.pulumi.aws.directconnect.GatewayAssociation; import com.pulumi.aws.directconnect.GatewayAssociationArgs; 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 example = new Gateway("example", GatewayArgs.builder() .name("example") .amazonSideAsn("64512") .build()); var exampleTransitGateway = new TransitGateway("exampleTransitGateway"); var exampleGatewayAssociation = new GatewayAssociation("exampleGatewayAssociation", GatewayAssociationArgs.builder() .dxGatewayId(example.id()) .associatedGatewayId(exampleTransitGateway.id()) .allowedPrefixes( "10.255.255.0/30", "10.255.255.8/30") .build()); } }
## Import Using `pulumi import`, import Direct Connect gateway associations using `dxGatewayId` together with `associatedGatewayId`. For example: ```sh $ pulumi import aws:directconnect/gatewayAssociation:GatewayAssociation example 345508c3-7215-4aef-9832-07c125d5bd0f/vgw-98765432 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.directconnect.Gateway; import com.pulumi.aws.directconnect.GatewayArgs; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.VpnGateway; import com.pulumi.aws.ec2.VpnGatewayArgs; import com.pulumi.aws.directconnect.GatewayAssociation; import com.pulumi.aws.directconnect.GatewayAssociationArgs; 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 example = new Gateway("example", GatewayArgs.builder() .name("example") .amazonSideAsn("64512") .build()); var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder() .cidrBlock("10.255.255.0/28") .build()); var exampleVpnGateway = new VpnGateway("exampleVpnGateway", VpnGatewayArgs.builder() .vpcId(exampleVpc.id()) .build()); var exampleGatewayAssociation = new GatewayAssociation("exampleGatewayAssociation", GatewayAssociationArgs.builder() .dxGatewayId(example.id()) .associatedGatewayId(exampleVpnGateway.id()) .allowedPrefixes( "210.52.109.0/24", "175.45.176.0/22") .build()); } }
-
-
Constructor Summary
Constructors Constructor Description GatewayAssociation(java.lang.String name)GatewayAssociation(java.lang.String name, GatewayAssociationArgs args)GatewayAssociation(java.lang.String name, GatewayAssociationArgs 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<java.util.List<java.lang.String>>allowedPrefixes()com.pulumi.core.Output<java.lang.String>associatedGatewayId()com.pulumi.core.Output<java.lang.String>associatedGatewayOwnerAccountId()com.pulumi.core.Output<java.lang.String>associatedGatewayType()com.pulumi.core.Output<java.lang.String>dxGatewayAssociationId()com.pulumi.core.Output<java.lang.String>dxGatewayId()com.pulumi.core.Output<java.lang.String>dxGatewayOwnerAccountId()static GatewayAssociationget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, GatewayAssociationState 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.String>>proposalId()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>transitGatewayAttachmentId()
-
-
-
Constructor Detail
-
GatewayAssociation
public GatewayAssociation(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
GatewayAssociation
public GatewayAssociation(java.lang.String name, GatewayAssociationArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
GatewayAssociation
public GatewayAssociation(java.lang.String name, GatewayAssociationArgs 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
-
allowedPrefixes
public com.pulumi.core.Output<java.util.List<java.lang.String>> allowedPrefixes()
- Returns:
- VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured. > **NOTE:** `dxGatewayId` and `associatedGatewayId` must be specified for single account Direct Connect gateway associations. > **NOTE:** If the `associatedGatewayId` is in another region, an alias in a new provider block for that region should be specified.
-
associatedGatewayId
public com.pulumi.core.Output<java.lang.String> associatedGatewayId()
- Returns:
- The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.
-
associatedGatewayOwnerAccountId
public com.pulumi.core.Output<java.lang.String> associatedGatewayOwnerAccountId()
- Returns:
- The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.
-
associatedGatewayType
public com.pulumi.core.Output<java.lang.String> associatedGatewayType()
- Returns:
- The type of the associated gateway, `transitGateway` or `virtualPrivateGateway`.
-
dxGatewayAssociationId
public com.pulumi.core.Output<java.lang.String> dxGatewayAssociationId()
- Returns:
- The ID of the Direct Connect gateway association.
-
dxGatewayId
public com.pulumi.core.Output<java.lang.String> dxGatewayId()
- Returns:
- The ID of the Direct Connect gateway.
-
dxGatewayOwnerAccountId
public com.pulumi.core.Output<java.lang.String> dxGatewayOwnerAccountId()
- Returns:
- The ID of the AWS account that owns the Direct Connect gateway.
-
proposalId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> proposalId()
- Returns:
- The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.
-
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.
-
transitGatewayAttachmentId
public com.pulumi.core.Output<java.lang.String> transitGatewayAttachmentId()
- Returns:
- The ID of the Transit Gateway Attachment when the type is `transitGateway`.
-
get
public static GatewayAssociation get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable GatewayAssociationState 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.
-
-