Skip to content

Resource: awsNetworkmanagerCustomerGatewayAssociation

Associates a customer gateway with a device and optionally, with a link. If you specify a link, it must be associated with the specified device.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCustomerGatewayExample = new aws.customerGateway.CustomerGateway(
  this,
  "example",
  {
    bgpAsn: 65000,
    ipAddress: "172.83.124.10",
    type: "ipsec.1",
  }
);
const awsEc2TransitGatewayExample = new aws.ec2TransitGateway.Ec2TransitGateway(
  this,
  "example_1",
  {}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEc2TransitGatewayExample.overrideLogicalId("example");
const awsNetworkmanagerGlobalNetworkExample =
  new aws.networkmanagerGlobalNetwork.NetworkmanagerGlobalNetwork(
    this,
    "example_2",
    {
      description: "example",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNetworkmanagerGlobalNetworkExample.overrideLogicalId("example");
const awsNetworkmanagerSiteExample =
  new aws.networkmanagerSite.NetworkmanagerSite(this, "example_3", {
    globalNetworkId: awsNetworkmanagerGlobalNetworkExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNetworkmanagerSiteExample.overrideLogicalId("example");
const awsVpnConnectionExample = new aws.vpnConnection.VpnConnection(
  this,
  "example_4",
  {
    customerGatewayId: awsCustomerGatewayExample.id,
    staticRoutesOnly: true,
    transitGatewayId: awsEc2TransitGatewayExample.id,
    type: awsCustomerGatewayExample.type,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsVpnConnectionExample.overrideLogicalId("example");
const awsNetworkmanagerDeviceExample =
  new aws.networkmanagerDevice.NetworkmanagerDevice(this, "example_5", {
    globalNetworkId: awsNetworkmanagerGlobalNetworkExample.id,
    siteId: awsNetworkmanagerSiteExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNetworkmanagerDeviceExample.overrideLogicalId("example");
const awsNetworkmanagerTransitGatewayRegistrationExample =
  new aws.networkmanagerTransitGatewayRegistration.NetworkmanagerTransitGatewayRegistration(
    this,
    "example_6",
    {
      depends_on: [`\${${awsVpnConnectionExample.fqn}}`],
      globalNetworkId: awsNetworkmanagerGlobalNetworkExample.id,
      transitGatewayArn: awsEc2TransitGatewayExample.arn,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNetworkmanagerTransitGatewayRegistrationExample.overrideLogicalId("example");
const awsNetworkmanagerCustomerGatewayAssociationExample =
  new aws.networkmanagerCustomerGatewayAssociation.NetworkmanagerCustomerGatewayAssociation(
    this,
    "example_7",
    {
      customerGatewayArn: awsCustomerGatewayExample.arn,
      depends_on: [
        `\${${awsNetworkmanagerTransitGatewayRegistrationExample.fqn}}`,
      ],
      deviceId: awsNetworkmanagerDeviceExample.id,
      globalNetworkId: awsNetworkmanagerGlobalNetworkExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNetworkmanagerCustomerGatewayAssociationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • customerGatewayArn - (Required) The Amazon Resource Name (ARN) of the customer gateway.
  • deviceId - (Required) The ID of the device.
  • globalNetworkId - (Required) The ID of the global network.
  • linkId - (Optional) The ID of the link.

Attributes Reference

No additional attributes are exported.

Import

awsNetworkmanagerCustomerGatewayAssociation can be imported using the global network ID and customer gateway ARN, e.g.

$ terraform import aws_networkmanager_customer_gateway_association.example global-network-0d47f6t230mz46dy4,arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-123abc05e04123abc