aws.ec2.getVpnGateway
Explore with Pulumi AI
The VPN Gateway data source provides details about a specific VPN gateway.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const selected = aws.ec2.getVpnGateway({
    filters: [{
        name: "tag:Name",
        values: ["vpn-gw"],
    }],
});
export const vpnGatewayId = selected.then(selected => selected.id);
import pulumi
import pulumi_aws as aws
selected = aws.ec2.get_vpn_gateway(filters=[{
    "name": "tag:Name",
    "values": ["vpn-gw"],
}])
pulumi.export("vpnGatewayId", selected.id)
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 {
		selected, err := ec2.LookupVpnGateway(ctx, &ec2.LookupVpnGatewayArgs{
			Filters: []ec2.GetVpnGatewayFilter{
				{
					Name: "tag:Name",
					Values: []string{
						"vpn-gw",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpnGatewayId", selected.Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var selected = Aws.Ec2.GetVpnGateway.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2.Inputs.GetVpnGatewayFilterInputArgs
            {
                Name = "tag:Name",
                Values = new[]
                {
                    "vpn-gw",
                },
            },
        },
    });
    return new Dictionary<string, object?>
    {
        ["vpnGatewayId"] = selected.Apply(getVpnGatewayResult => getVpnGatewayResult.Id),
    };
});
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.GetVpnGatewayArgs;
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 selected = Ec2Functions.getVpnGateway(GetVpnGatewayArgs.builder()
            .filters(GetVpnGatewayFilterArgs.builder()
                .name("tag:Name")
                .values("vpn-gw")
                .build())
            .build());
        ctx.export("vpnGatewayId", selected.applyValue(getVpnGatewayResult -> getVpnGatewayResult.id()));
    }
}
variables:
  selected:
    fn::invoke:
      function: aws:ec2:getVpnGateway
      arguments:
        filters:
          - name: tag:Name
            values:
              - vpn-gw
outputs:
  vpnGatewayId: ${selected.id}
Using getVpnGateway
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 getVpnGateway(args: GetVpnGatewayArgs, opts?: InvokeOptions): Promise<GetVpnGatewayResult>
function getVpnGatewayOutput(args: GetVpnGatewayOutputArgs, opts?: InvokeOptions): Output<GetVpnGatewayResult>def get_vpn_gateway(amazon_side_asn: Optional[str] = None,
                    attached_vpc_id: Optional[str] = None,
                    availability_zone: Optional[str] = None,
                    filters: Optional[Sequence[GetVpnGatewayFilter]] = None,
                    id: Optional[str] = None,
                    state: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetVpnGatewayResult
def get_vpn_gateway_output(amazon_side_asn: Optional[pulumi.Input[str]] = None,
                    attached_vpc_id: Optional[pulumi.Input[str]] = None,
                    availability_zone: Optional[pulumi.Input[str]] = None,
                    filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpnGatewayFilterArgs]]]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    state: Optional[pulumi.Input[str]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetVpnGatewayResult]func LookupVpnGateway(ctx *Context, args *LookupVpnGatewayArgs, opts ...InvokeOption) (*LookupVpnGatewayResult, error)
func LookupVpnGatewayOutput(ctx *Context, args *LookupVpnGatewayOutputArgs, opts ...InvokeOption) LookupVpnGatewayResultOutput> Note: This function is named LookupVpnGateway in the Go SDK.
public static class GetVpnGateway 
{
    public static Task<GetVpnGatewayResult> InvokeAsync(GetVpnGatewayArgs args, InvokeOptions? opts = null)
    public static Output<GetVpnGatewayResult> Invoke(GetVpnGatewayInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVpnGatewayResult> getVpnGateway(GetVpnGatewayArgs args, InvokeOptions options)
public static Output<GetVpnGatewayResult> getVpnGateway(GetVpnGatewayArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2/getVpnGateway:getVpnGateway
  arguments:
    # arguments dictionaryThe following arguments are supported:
- AmazonSide stringAsn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- AttachedVpc stringId 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- AvailabilityZone string
- Availability Zone of the specific VPN Gateway to retrieve.
- Filters
List<GetVpn Gateway Filter> 
- Custom filter block as described below.
- Id string
- ID of the specific VPN Gateway to retrieve.
- State string
- State of the specific VPN Gateway to retrieve.
- Dictionary<string, string>
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
- AmazonSide stringAsn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- AttachedVpc stringId 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- AvailabilityZone string
- Availability Zone of the specific VPN Gateway to retrieve.
- Filters
[]GetVpn Gateway Filter 
- Custom filter block as described below.
- Id string
- ID of the specific VPN Gateway to retrieve.
- State string
- State of the specific VPN Gateway to retrieve.
- map[string]string
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
- amazonSide StringAsn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- attachedVpc StringId 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- availabilityZone String
- Availability Zone of the specific VPN Gateway to retrieve.
- filters
List<GetVpn Gateway Filter> 
- Custom filter block as described below.
- id String
- ID of the specific VPN Gateway to retrieve.
- state String
- State of the specific VPN Gateway to retrieve.
- Map<String,String>
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
- amazonSide stringAsn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- attachedVpc stringId 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- availabilityZone string
- Availability Zone of the specific VPN Gateway to retrieve.
- filters
GetVpn Gateway Filter[] 
- Custom filter block as described below.
- id string
- ID of the specific VPN Gateway to retrieve.
- state string
- State of the specific VPN Gateway to retrieve.
- {[key: string]: string}
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
- amazon_side_ strasn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- attached_vpc_ strid 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- availability_zone str
- Availability Zone of the specific VPN Gateway to retrieve.
- filters
Sequence[GetVpn Gateway Filter] 
- Custom filter block as described below.
- id str
- ID of the specific VPN Gateway to retrieve.
- state str
- State of the specific VPN Gateway to retrieve.
- Mapping[str, str]
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
- amazonSide StringAsn 
- Autonomous System Number (ASN) for the Amazon side of the specific VPN Gateway to retrieve. - More complex filters can be expressed using one or more - filtersub-blocks, which take the following arguments:
- attachedVpc StringId 
- ID of a VPC attached to the specific VPN Gateway to retrieve.
- availabilityZone String
- Availability Zone of the specific VPN Gateway to retrieve.
- filters List<Property Map>
- Custom filter block as described below.
- id String
- ID of the specific VPN Gateway to retrieve.
- state String
- State of the specific VPN Gateway to retrieve.
- Map<String>
- Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
getVpnGateway Result
The following output properties are available:
- AmazonSide stringAsn 
- Arn string
- AttachedVpc stringId 
- AvailabilityZone string
- Id string
- State string
- Dictionary<string, string>
- Filters
List<GetVpn Gateway Filter> 
- AmazonSide stringAsn 
- Arn string
- AttachedVpc stringId 
- AvailabilityZone string
- Id string
- State string
- map[string]string
- Filters
[]GetVpn Gateway Filter 
- amazonSide StringAsn 
- arn String
- attachedVpc StringId 
- availabilityZone String
- id String
- state String
- Map<String,String>
- filters
List<GetVpn Gateway Filter> 
- amazonSide stringAsn 
- arn string
- attachedVpc stringId 
- availabilityZone string
- id string
- state string
- {[key: string]: string}
- filters
GetVpn Gateway Filter[] 
- amazon_side_ strasn 
- arn str
- attached_vpc_ strid 
- availability_zone str
- id str
- state str
- Mapping[str, str]
- filters
Sequence[GetVpn Gateway Filter] 
- amazonSide StringAsn 
- arn String
- attachedVpc StringId 
- availabilityZone String
- id String
- state String
- Map<String>
- filters List<Property Map>
Supporting Types
GetVpnGatewayFilter   
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values []string
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values string[]
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
- name str
- Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field. A VPN Gateway will be selected if any one of the given values matches.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.