getCustomerGateway

Get an existing AWS Customer Gateway.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var foo = Output.Create(Aws.Ec2.GetCustomerGateway.InvokeAsync(new Aws.Ec2.GetCustomerGatewayArgs
        {
            Filters = 
            {
                new Aws.Ec2.Inputs.GetCustomerGatewayFilterArgs
                {
                    Name = "tag:Name",
                    Values = 
                    {
                        "foo-prod",
                    },
                },
            },
        }));
        var main = new Aws.Ec2.VpnGateway("main", new Aws.Ec2.VpnGatewayArgs
        {
            VpcId = aws_vpc.Main.Id,
            AmazonSideAsn = "7224",
        });
        var transit = new Aws.Ec2.VpnConnection("transit", new Aws.Ec2.VpnConnectionArgs
        {
            VpnGatewayId = main.Id,
            CustomerGatewayId = foo.Apply(foo => foo.Id),
            Type = foo.Apply(foo => foo.Type),
            StaticRoutesOnly = false,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		foo, err := ec2.LookupCustomerGateway(ctx, &ec2.LookupCustomerGatewayArgs{
			Filters: []ec2.GetCustomerGatewayFilter{
				ec2.GetCustomerGatewayFilter{
					Name: "tag:Name",
					Values: []string{
						"foo-prod",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		main, err := ec2.NewVpnGateway(ctx, "main", &ec2.VpnGatewayArgs{
			VpcId:         pulumi.Any(aws_vpc.Main.Id),
			AmazonSideAsn: pulumi.String("7224"),
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewVpnConnection(ctx, "transit", &ec2.VpnConnectionArgs{
			VpnGatewayId:      main.ID(),
			CustomerGatewayId: pulumi.String(foo.Id),
			Type:              pulumi.String(foo.Type),
			StaticRoutesOnly:  pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

foo = aws.ec2.get_customer_gateway(filters=[aws.ec2.GetCustomerGatewayFilterArgs(
    name="tag:Name",
    values=["foo-prod"],
)])
main = aws.ec2.VpnGateway("main",
    vpc_id=aws_vpc["main"]["id"],
    amazon_side_asn="7224")
transit = aws.ec2.VpnConnection("transit",
    vpn_gateway_id=main.id,
    customer_gateway_id=foo.id,
    type=foo.type,
    static_routes_only=False)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const foo = aws.ec2.getCustomerGateway({
    filters: [{
        name: "tag:Name",
        values: ["foo-prod"],
    }],
});
const main = new aws.ec2.VpnGateway("main", {
    vpcId: aws_vpc.main.id,
    amazonSideAsn: 7224,
});
const transit = new aws.ec2.VpnConnection("transit", {
    vpnGatewayId: main.id,
    customerGatewayId: foo.then(foo => foo.id),
    type: foo.then(foo => foo.type),
    staticRoutesOnly: false,
});

Using getCustomerGateway

function getCustomerGateway(args: GetCustomerGatewayArgs, opts?: InvokeOptions): Promise<GetCustomerGatewayResult>
def get_customer_gateway(filters: Optional[Sequence[GetCustomerGatewayFilter]] = None,
                         id: Optional[str] = None,
                         tags: Optional[Mapping[str, str]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetCustomerGatewayResult
func LookupCustomerGateway(ctx *Context, args *LookupCustomerGatewayArgs, opts ...InvokeOption) (*LookupCustomerGatewayResult, error)

Note: This function is named LookupCustomerGateway in the Go SDK.

public static class GetCustomerGateway {
    public static Task<GetCustomerGatewayResult> InvokeAsync(GetCustomerGatewayArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filters List<GetCustomerGatewayFilter>
One or more [name-value pairs][dcg-filters] to filter by.
Id string
The ID of the gateway.
Tags Dictionary<string, string>
Map of key-value pairs assigned to the gateway.
Filters []GetCustomerGatewayFilter
One or more [name-value pairs][dcg-filters] to filter by.
Id string
The ID of the gateway.
Tags map[string]string
Map of key-value pairs assigned to the gateway.
filters GetCustomerGatewayFilter[]
One or more [name-value pairs][dcg-filters] to filter by.
id string
The ID of the gateway.
tags {[key: string]: string}
Map of key-value pairs assigned to the gateway.
filters Sequence[GetCustomerGatewayFilter]
One or more [name-value pairs][dcg-filters] to filter by.
id str
The ID of the gateway.
tags Mapping[str, str]
Map of key-value pairs assigned to the gateway.

getCustomerGateway Result

The following output properties are available:

Arn string
The ARN of the customer gateway.
BgpAsn int
(Optional) The gateway’s Border Gateway Protocol (BGP) Autonomous System Number (ASN).
DeviceName string
(Optional) A name for the customer gateway device.
Id string
IpAddress string
(Optional) The IP address of the gateway’s Internet-routable external interface.
Tags Dictionary<string, string>
Map of key-value pairs assigned to the gateway.
Type string
(Optional) The type of customer gateway. The only type AWS supports at this time is “ipsec.1”.
Filters List<GetCustomerGatewayFilter>
Arn string
The ARN of the customer gateway.
BgpAsn int
(Optional) The gateway’s Border Gateway Protocol (BGP) Autonomous System Number (ASN).
DeviceName string
(Optional) A name for the customer gateway device.
Id string
IpAddress string
(Optional) The IP address of the gateway’s Internet-routable external interface.
Tags map[string]string
Map of key-value pairs assigned to the gateway.
Type string
(Optional) The type of customer gateway. The only type AWS supports at this time is “ipsec.1”.
Filters []GetCustomerGatewayFilter
arn string
The ARN of the customer gateway.
bgpAsn number
(Optional) The gateway’s Border Gateway Protocol (BGP) Autonomous System Number (ASN).
deviceName string
(Optional) A name for the customer gateway device.
id string
ipAddress string
(Optional) The IP address of the gateway’s Internet-routable external interface.
tags {[key: string]: string}
Map of key-value pairs assigned to the gateway.
type string
(Optional) The type of customer gateway. The only type AWS supports at this time is “ipsec.1”.
filters GetCustomerGatewayFilter[]
arn str
The ARN of the customer gateway.
bgp_asn int
(Optional) The gateway’s Border Gateway Protocol (BGP) Autonomous System Number (ASN).
device_name str
(Optional) A name for the customer gateway device.
id str
ip_address str
(Optional) The IP address of the gateway’s Internet-routable external interface.
tags Mapping[str, str]
Map of key-value pairs assigned to the gateway.
type str
(Optional) The type of customer gateway. The only type AWS supports at this time is “ipsec.1”.
filters Sequence[GetCustomerGatewayFilter]

Supporting Types

GetCustomerGatewayFilter

Name string
Values List<string>
Name string
Values []string
name string
values string[]
name str
values Sequence[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.