aws.networkmanager.CustomerGatewayAssociation
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.networkmanager.GlobalNetwork("example", {description: "example"});
const exampleSite = new aws.networkmanager.Site("example", {globalNetworkId: example.id});
const exampleDevice = new aws.networkmanager.Device("example", {
globalNetworkId: example.id,
siteId: exampleSite.id,
});
const exampleCustomerGateway = new aws.ec2.CustomerGateway("example", {
bgpAsn: "65000",
ipAddress: "172.83.124.10",
type: "ipsec.1",
});
const exampleTransitGateway = new aws.ec2transitgateway.TransitGateway("example", {});
const exampleVpnConnection = new aws.ec2.VpnConnection("example", {
customerGatewayId: exampleCustomerGateway.id,
transitGatewayId: exampleTransitGateway.id,
type: exampleCustomerGateway.type,
staticRoutesOnly: true,
});
const exampleTransitGatewayRegistration = new aws.networkmanager.TransitGatewayRegistration("example", {
globalNetworkId: example.id,
transitGatewayArn: exampleTransitGateway.arn,
}, {
dependsOn: [exampleVpnConnection],
});
const exampleCustomerGatewayAssociation = new aws.networkmanager.CustomerGatewayAssociation("example", {
globalNetworkId: example.id,
customerGatewayArn: exampleCustomerGateway.arn,
deviceId: exampleDevice.id,
}, {
dependsOn: [exampleTransitGatewayRegistration],
});
import pulumi
import pulumi_aws as aws
example = aws.networkmanager.GlobalNetwork("example", description="example")
example_site = aws.networkmanager.Site("example", global_network_id=example.id)
example_device = aws.networkmanager.Device("example",
global_network_id=example.id,
site_id=example_site.id)
example_customer_gateway = aws.ec2.CustomerGateway("example",
bgp_asn="65000",
ip_address="172.83.124.10",
type="ipsec.1")
example_transit_gateway = aws.ec2transitgateway.TransitGateway("example")
example_vpn_connection = aws.ec2.VpnConnection("example",
customer_gateway_id=example_customer_gateway.id,
transit_gateway_id=example_transit_gateway.id,
type=example_customer_gateway.type,
static_routes_only=True)
example_transit_gateway_registration = aws.networkmanager.TransitGatewayRegistration("example",
global_network_id=example.id,
transit_gateway_arn=example_transit_gateway.arn,
opts = pulumi.ResourceOptions(depends_on=[example_vpn_connection]))
example_customer_gateway_association = aws.networkmanager.CustomerGatewayAssociation("example",
global_network_id=example.id,
customer_gateway_arn=example_customer_gateway.arn,
device_id=example_device.id,
opts = pulumi.ResourceOptions(depends_on=[example_transit_gateway_registration]))
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := networkmanager.NewGlobalNetwork(ctx, "example", &networkmanager.GlobalNetworkArgs{
Description: pulumi.String("example"),
})
if err != nil {
return err
}
exampleSite, err := networkmanager.NewSite(ctx, "example", &networkmanager.SiteArgs{
GlobalNetworkId: example.ID(),
})
if err != nil {
return err
}
exampleDevice, err := networkmanager.NewDevice(ctx, "example", &networkmanager.DeviceArgs{
GlobalNetworkId: example.ID(),
SiteId: exampleSite.ID(),
})
if err != nil {
return err
}
exampleCustomerGateway, err := ec2.NewCustomerGateway(ctx, "example", &ec2.CustomerGatewayArgs{
BgpAsn: pulumi.String("65000"),
IpAddress: pulumi.String("172.83.124.10"),
Type: pulumi.String("ipsec.1"),
})
if err != nil {
return err
}
exampleTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "example", nil)
if err != nil {
return err
}
exampleVpnConnection, err := ec2.NewVpnConnection(ctx, "example", &ec2.VpnConnectionArgs{
CustomerGatewayId: exampleCustomerGateway.ID(),
TransitGatewayId: exampleTransitGateway.ID(),
Type: exampleCustomerGateway.Type,
StaticRoutesOnly: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTransitGatewayRegistration, err := networkmanager.NewTransitGatewayRegistration(ctx, "example", &networkmanager.TransitGatewayRegistrationArgs{
GlobalNetworkId: example.ID(),
TransitGatewayArn: exampleTransitGateway.Arn,
}, pulumi.DependsOn([]pulumi.Resource{
exampleVpnConnection,
}))
if err != nil {
return err
}
_, err = networkmanager.NewCustomerGatewayAssociation(ctx, "example", &networkmanager.CustomerGatewayAssociationArgs{
GlobalNetworkId: example.ID(),
CustomerGatewayArn: exampleCustomerGateway.Arn,
DeviceId: exampleDevice.ID(),
}, pulumi.DependsOn([]pulumi.Resource{
exampleTransitGatewayRegistration,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.NetworkManager.GlobalNetwork("example", new()
{
Description = "example",
});
var exampleSite = new Aws.NetworkManager.Site("example", new()
{
GlobalNetworkId = example.Id,
});
var exampleDevice = new Aws.NetworkManager.Device("example", new()
{
GlobalNetworkId = example.Id,
SiteId = exampleSite.Id,
});
var exampleCustomerGateway = new Aws.Ec2.CustomerGateway("example", new()
{
BgpAsn = "65000",
IpAddress = "172.83.124.10",
Type = "ipsec.1",
});
var exampleTransitGateway = new Aws.Ec2TransitGateway.TransitGateway("example");
var exampleVpnConnection = new Aws.Ec2.VpnConnection("example", new()
{
CustomerGatewayId = exampleCustomerGateway.Id,
TransitGatewayId = exampleTransitGateway.Id,
Type = exampleCustomerGateway.Type,
StaticRoutesOnly = true,
});
var exampleTransitGatewayRegistration = new Aws.NetworkManager.TransitGatewayRegistration("example", new()
{
GlobalNetworkId = example.Id,
TransitGatewayArn = exampleTransitGateway.Arn,
}, new CustomResourceOptions
{
DependsOn =
{
exampleVpnConnection,
},
});
var exampleCustomerGatewayAssociation = new Aws.NetworkManager.CustomerGatewayAssociation("example", new()
{
GlobalNetworkId = example.Id,
CustomerGatewayArn = exampleCustomerGateway.Arn,
DeviceId = exampleDevice.Id,
}, new CustomResourceOptions
{
DependsOn =
{
exampleTransitGatewayRegistration,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.networkmanager.GlobalNetwork;
import com.pulumi.aws.networkmanager.GlobalNetworkArgs;
import com.pulumi.aws.networkmanager.Site;
import com.pulumi.aws.networkmanager.SiteArgs;
import com.pulumi.aws.networkmanager.Device;
import com.pulumi.aws.networkmanager.DeviceArgs;
import com.pulumi.aws.ec2.CustomerGateway;
import com.pulumi.aws.ec2.CustomerGatewayArgs;
import com.pulumi.aws.ec2transitgateway.TransitGateway;
import com.pulumi.aws.ec2.VpnConnection;
import com.pulumi.aws.ec2.VpnConnectionArgs;
import com.pulumi.aws.networkmanager.TransitGatewayRegistration;
import com.pulumi.aws.networkmanager.TransitGatewayRegistrationArgs;
import com.pulumi.aws.networkmanager.CustomerGatewayAssociation;
import com.pulumi.aws.networkmanager.CustomerGatewayAssociationArgs;
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 example = new GlobalNetwork("example", GlobalNetworkArgs.builder()
.description("example")
.build());
var exampleSite = new Site("exampleSite", SiteArgs.builder()
.globalNetworkId(example.id())
.build());
var exampleDevice = new Device("exampleDevice", DeviceArgs.builder()
.globalNetworkId(example.id())
.siteId(exampleSite.id())
.build());
var exampleCustomerGateway = new CustomerGateway("exampleCustomerGateway", CustomerGatewayArgs.builder()
.bgpAsn(65000)
.ipAddress("172.83.124.10")
.type("ipsec.1")
.build());
var exampleTransitGateway = new TransitGateway("exampleTransitGateway");
var exampleVpnConnection = new VpnConnection("exampleVpnConnection", VpnConnectionArgs.builder()
.customerGatewayId(exampleCustomerGateway.id())
.transitGatewayId(exampleTransitGateway.id())
.type(exampleCustomerGateway.type())
.staticRoutesOnly(true)
.build());
var exampleTransitGatewayRegistration = new TransitGatewayRegistration("exampleTransitGatewayRegistration", TransitGatewayRegistrationArgs.builder()
.globalNetworkId(example.id())
.transitGatewayArn(exampleTransitGateway.arn())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleVpnConnection)
.build());
var exampleCustomerGatewayAssociation = new CustomerGatewayAssociation("exampleCustomerGatewayAssociation", CustomerGatewayAssociationArgs.builder()
.globalNetworkId(example.id())
.customerGatewayArn(exampleCustomerGateway.arn())
.deviceId(exampleDevice.id())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleTransitGatewayRegistration)
.build());
}
}
resources:
example:
type: aws:networkmanager:GlobalNetwork
properties:
description: example
exampleSite:
type: aws:networkmanager:Site
name: example
properties:
globalNetworkId: ${example.id}
exampleDevice:
type: aws:networkmanager:Device
name: example
properties:
globalNetworkId: ${example.id}
siteId: ${exampleSite.id}
exampleCustomerGateway:
type: aws:ec2:CustomerGateway
name: example
properties:
bgpAsn: 65000
ipAddress: 172.83.124.10
type: ipsec.1
exampleTransitGateway:
type: aws:ec2transitgateway:TransitGateway
name: example
exampleVpnConnection:
type: aws:ec2:VpnConnection
name: example
properties:
customerGatewayId: ${exampleCustomerGateway.id}
transitGatewayId: ${exampleTransitGateway.id}
type: ${exampleCustomerGateway.type}
staticRoutesOnly: true
exampleTransitGatewayRegistration:
type: aws:networkmanager:TransitGatewayRegistration
name: example
properties:
globalNetworkId: ${example.id}
transitGatewayArn: ${exampleTransitGateway.arn}
options:
dependson:
- ${exampleVpnConnection}
exampleCustomerGatewayAssociation:
type: aws:networkmanager:CustomerGatewayAssociation
name: example
properties:
globalNetworkId: ${example.id}
customerGatewayArn: ${exampleCustomerGateway.arn}
deviceId: ${exampleDevice.id}
options:
dependson:
- ${exampleTransitGatewayRegistration}
Create CustomerGatewayAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CustomerGatewayAssociation(name: string, args: CustomerGatewayAssociationArgs, opts?: CustomResourceOptions);
@overload
def CustomerGatewayAssociation(resource_name: str,
args: CustomerGatewayAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CustomerGatewayAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
customer_gateway_arn: Optional[str] = None,
device_id: Optional[str] = None,
global_network_id: Optional[str] = None,
link_id: Optional[str] = None)
func NewCustomerGatewayAssociation(ctx *Context, name string, args CustomerGatewayAssociationArgs, opts ...ResourceOption) (*CustomerGatewayAssociation, error)
public CustomerGatewayAssociation(string name, CustomerGatewayAssociationArgs args, CustomResourceOptions? opts = null)
public CustomerGatewayAssociation(String name, CustomerGatewayAssociationArgs args)
public CustomerGatewayAssociation(String name, CustomerGatewayAssociationArgs args, CustomResourceOptions options)
type: aws:networkmanager:CustomerGatewayAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args CustomerGatewayAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args CustomerGatewayAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args CustomerGatewayAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CustomerGatewayAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CustomerGatewayAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var customerGatewayAssociationResource = new Aws.NetworkManager.CustomerGatewayAssociation("customerGatewayAssociationResource", new()
{
CustomerGatewayArn = "string",
DeviceId = "string",
GlobalNetworkId = "string",
LinkId = "string",
});
example, err := networkmanager.NewCustomerGatewayAssociation(ctx, "customerGatewayAssociationResource", &networkmanager.CustomerGatewayAssociationArgs{
CustomerGatewayArn: pulumi.String("string"),
DeviceId: pulumi.String("string"),
GlobalNetworkId: pulumi.String("string"),
LinkId: pulumi.String("string"),
})
var customerGatewayAssociationResource = new CustomerGatewayAssociation("customerGatewayAssociationResource", CustomerGatewayAssociationArgs.builder()
.customerGatewayArn("string")
.deviceId("string")
.globalNetworkId("string")
.linkId("string")
.build());
customer_gateway_association_resource = aws.networkmanager.CustomerGatewayAssociation("customerGatewayAssociationResource",
customer_gateway_arn="string",
device_id="string",
global_network_id="string",
link_id="string")
const customerGatewayAssociationResource = new aws.networkmanager.CustomerGatewayAssociation("customerGatewayAssociationResource", {
customerGatewayArn: "string",
deviceId: "string",
globalNetworkId: "string",
linkId: "string",
});
type: aws:networkmanager:CustomerGatewayAssociation
properties:
customerGatewayArn: string
deviceId: string
globalNetworkId: string
linkId: string
CustomerGatewayAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The CustomerGatewayAssociation resource accepts the following input properties:
- Customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- Device
Id string - The ID of the device.
- Global
Network stringId - The ID of the global network.
- Link
Id string - The ID of the link.
- Customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- Device
Id string - The ID of the device.
- Global
Network stringId - The ID of the global network.
- Link
Id string - The ID of the link.
- customer
Gateway StringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id String - The ID of the device.
- global
Network StringId - The ID of the global network.
- link
Id String - The ID of the link.
- customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id string - The ID of the device.
- global
Network stringId - The ID of the global network.
- link
Id string - The ID of the link.
- customer_
gateway_ strarn - The Amazon Resource Name (ARN) of the customer gateway.
- device_
id str - The ID of the device.
- global_
network_ strid - The ID of the global network.
- link_
id str - The ID of the link.
- customer
Gateway StringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id String - The ID of the device.
- global
Network StringId - The ID of the global network.
- link
Id String - The ID of the link.
Outputs
All input properties are implicitly available as output properties. Additionally, the CustomerGatewayAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing CustomerGatewayAssociation Resource
Get an existing CustomerGatewayAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: CustomerGatewayAssociationState, opts?: CustomResourceOptions): CustomerGatewayAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
customer_gateway_arn: Optional[str] = None,
device_id: Optional[str] = None,
global_network_id: Optional[str] = None,
link_id: Optional[str] = None) -> CustomerGatewayAssociation
func GetCustomerGatewayAssociation(ctx *Context, name string, id IDInput, state *CustomerGatewayAssociationState, opts ...ResourceOption) (*CustomerGatewayAssociation, error)
public static CustomerGatewayAssociation Get(string name, Input<string> id, CustomerGatewayAssociationState? state, CustomResourceOptions? opts = null)
public static CustomerGatewayAssociation get(String name, Output<String> id, CustomerGatewayAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- Device
Id string - The ID of the device.
- Global
Network stringId - The ID of the global network.
- Link
Id string - The ID of the link.
- Customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- Device
Id string - The ID of the device.
- Global
Network stringId - The ID of the global network.
- Link
Id string - The ID of the link.
- customer
Gateway StringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id String - The ID of the device.
- global
Network StringId - The ID of the global network.
- link
Id String - The ID of the link.
- customer
Gateway stringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id string - The ID of the device.
- global
Network stringId - The ID of the global network.
- link
Id string - The ID of the link.
- customer_
gateway_ strarn - The Amazon Resource Name (ARN) of the customer gateway.
- device_
id str - The ID of the device.
- global_
network_ strid - The ID of the global network.
- link_
id str - The ID of the link.
- customer
Gateway StringArn - The Amazon Resource Name (ARN) of the customer gateway.
- device
Id String - The ID of the device.
- global
Network StringId - The ID of the global network.
- link
Id String - The ID of the link.
Import
Using pulumi import
, import aws_networkmanager_customer_gateway_association
using the global network ID and customer gateway ARN. For example:
$ pulumi import aws:networkmanager/customerGatewayAssociation:CustomerGatewayAssociation example global-network-0d47f6t230mz46dy4,arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-123abc05e04123abc
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.