Try AWS Native preview for resources not in the classic version.
AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi
aws.ec2.getCustomerGateway
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi
Get an existing AWS Customer Gateway.
Example Usage
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: mainAwsVpc.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,
});
import pulumi
import pulumi_aws as aws
foo = aws.ec2.get_customer_gateway(filters=[{
"name": "tag:Name",
"values": ["foo-prod"],
}])
main = aws.ec2.VpnGateway("main",
vpc_id=main_aws_vpc["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)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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{
{
Name: "tag:Name",
Values: []string{
"foo-prod",
},
},
},
}, nil)
if err != nil {
return err
}
main, err := ec2.NewVpnGateway(ctx, "main", &ec2.VpnGatewayArgs{
VpcId: pulumi.Any(mainAwsVpc.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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var foo = Aws.Ec2.GetCustomerGateway.Invoke(new()
{
Filters = new[]
{
new Aws.Ec2.Inputs.GetCustomerGatewayFilterInputArgs
{
Name = "tag:Name",
Values = new[]
{
"foo-prod",
},
},
},
});
var main = new Aws.Ec2.VpnGateway("main", new()
{
VpcId = mainAwsVpc.Id,
AmazonSideAsn = "7224",
});
var transit = new Aws.Ec2.VpnConnection("transit", new()
{
VpnGatewayId = main.Id,
CustomerGatewayId = foo.Apply(getCustomerGatewayResult => getCustomerGatewayResult.Id),
Type = foo.Apply(getCustomerGatewayResult => getCustomerGatewayResult.Type),
StaticRoutesOnly = false,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetCustomerGatewayArgs;
import com.pulumi.aws.ec2.VpnGateway;
import com.pulumi.aws.ec2.VpnGatewayArgs;
import com.pulumi.aws.ec2.VpnConnection;
import com.pulumi.aws.ec2.VpnConnectionArgs;
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) {
final var foo = Ec2Functions.getCustomerGateway(GetCustomerGatewayArgs.builder()
.filters(GetCustomerGatewayFilterArgs.builder()
.name("tag:Name")
.values("foo-prod")
.build())
.build());
var main = new VpnGateway("main", VpnGatewayArgs.builder()
.vpcId(mainAwsVpc.id())
.amazonSideAsn(7224)
.build());
var transit = new VpnConnection("transit", VpnConnectionArgs.builder()
.vpnGatewayId(main.id())
.customerGatewayId(foo.applyValue(getCustomerGatewayResult -> getCustomerGatewayResult.id()))
.type(foo.applyValue(getCustomerGatewayResult -> getCustomerGatewayResult.type()))
.staticRoutesOnly(false)
.build());
}
}
resources:
main:
type: aws:ec2:VpnGateway
properties:
vpcId: ${mainAwsVpc.id}
amazonSideAsn: 7224
transit:
type: aws:ec2:VpnConnection
properties:
vpnGatewayId: ${main.id}
customerGatewayId: ${foo.id}
type: ${foo.type}
staticRoutesOnly: false
variables:
foo:
fn::invoke:
Function: aws:ec2:getCustomerGateway
Arguments:
filters:
- name: tag:Name
values:
- foo-prod
Using getCustomerGateway
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getCustomerGateway(args: GetCustomerGatewayArgs, opts?: InvokeOptions): Promise<GetCustomerGatewayResult>
function getCustomerGatewayOutput(args: GetCustomerGatewayOutputArgs, opts?: InvokeOptions): Output<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
def get_customer_gateway_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetCustomerGatewayFilterArgs]]]] = None,
id: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCustomerGatewayResult]
func LookupCustomerGateway(ctx *Context, args *LookupCustomerGatewayArgs, opts ...InvokeOption) (*LookupCustomerGatewayResult, error)
func LookupCustomerGatewayOutput(ctx *Context, args *LookupCustomerGatewayOutputArgs, opts ...InvokeOption) LookupCustomerGatewayResultOutput
> Note: This function is named LookupCustomerGateway
in the Go SDK.
public static class GetCustomerGateway
{
public static Task<GetCustomerGatewayResult> InvokeAsync(GetCustomerGatewayArgs args, InvokeOptions? opts = null)
public static Output<GetCustomerGatewayResult> Invoke(GetCustomerGatewayInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCustomerGatewayResult> getCustomerGateway(GetCustomerGatewayArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ec2/getCustomerGateway:getCustomerGateway
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Customer Gateway Filter> - One or more name-value pairs to filter by.
- Id string
- ID of the gateway.
- Dictionary<string, string>
- Map of key-value pairs assigned to the gateway.
- Filters
[]Get
Customer Gateway Filter - One or more name-value pairs to filter by.
- Id string
- ID of the gateway.
- map[string]string
- Map of key-value pairs assigned to the gateway.
- filters
List<Get
Customer Gateway Filter> - One or more name-value pairs to filter by.
- id String
- ID of the gateway.
- Map<String,String>
- Map of key-value pairs assigned to the gateway.
- filters
Get
Customer Gateway Filter[] - One or more name-value pairs to filter by.
- id string
- ID of the gateway.
- {[key: string]: string}
- Map of key-value pairs assigned to the gateway.
- filters
Sequence[Get
Customer Gateway Filter] - One or more name-value pairs to filter by.
- id str
- ID of the gateway.
- Mapping[str, str]
- Map of key-value pairs assigned to the gateway.
- filters List<Property Map>
- One or more name-value pairs to filter by.
- id String
- ID of the gateway.
- Map<String>
- Map of key-value pairs assigned to the gateway.
getCustomerGateway Result
The following output properties are available:
- Arn string
- ARN of the customer gateway.
- Bgp
Asn int - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- Bgp
Asn intExtended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- Certificate
Arn string - ARN for the customer gateway certificate.
- Device
Name string - Name for the customer gateway device.
- Id string
- Ip
Address string - IP address of the gateway's Internet-routable external interface.
- Dictionary<string, string>
- Map of key-value pairs assigned to the gateway.
- Type string
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- Filters
List<Get
Customer Gateway Filter>
- Arn string
- ARN of the customer gateway.
- Bgp
Asn int - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- Bgp
Asn intExtended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- Certificate
Arn string - ARN for the customer gateway certificate.
- Device
Name string - Name for the customer gateway device.
- Id string
- Ip
Address string - IP address of the gateway's Internet-routable external interface.
- map[string]string
- Map of key-value pairs assigned to the gateway.
- Type string
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- Filters
[]Get
Customer Gateway Filter
- arn String
- ARN of the customer gateway.
- bgp
Asn Integer - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- bgp
Asn IntegerExtended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- certificate
Arn String - ARN for the customer gateway certificate.
- device
Name String - Name for the customer gateway device.
- id String
- ip
Address String - IP address of the gateway's Internet-routable external interface.
- Map<String,String>
- Map of key-value pairs assigned to the gateway.
- type String
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- filters
List<Get
Customer Gateway Filter>
- arn string
- ARN of the customer gateway.
- bgp
Asn number - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- bgp
Asn numberExtended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- certificate
Arn string - ARN for the customer gateway certificate.
- device
Name string - Name for the customer gateway device.
- id string
- ip
Address string - IP address of the gateway's Internet-routable external interface.
- {[key: string]: string}
- Map of key-value pairs assigned to the gateway.
- type string
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- filters
Get
Customer Gateway Filter[]
- arn str
- ARN of the customer gateway.
- bgp_
asn int - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- bgp_
asn_ intextended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- certificate_
arn str - ARN for the customer gateway certificate.
- device_
name str - Name for the customer gateway device.
- id str
- ip_
address str - IP address of the gateway's Internet-routable external interface.
- Mapping[str, str]
- Map of key-value pairs assigned to the gateway.
- type str
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- filters
Sequence[Get
Customer Gateway Filter]
- arn String
- ARN of the customer gateway.
- bgp
Asn Number - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- bgp
Asn NumberExtended - Gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
- certificate
Arn String - ARN for the customer gateway certificate.
- device
Name String - Name for the customer gateway device.
- id String
- ip
Address String - IP address of the gateway's Internet-routable external interface.
- Map<String>
- Map of key-value pairs assigned to the gateway.
- type String
- Type of customer gateway. The only type AWS supports at this time is "ipsec.1".
- filters List<Property Map>
Supporting Types
GetCustomerGatewayFilter
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.
AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi