1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. getVpnGateway
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ec2.getVpnGateway

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ec2/getVpnGateway:getVpnGateway
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AmazonSideAsn string

    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 filter sub-blocks, which take the following arguments:

    AttachedVpcId string
    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<GetVpnGatewayFilter>
    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.
    Tags Dictionary<string, string>
    Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
    AmazonSideAsn string

    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 filter sub-blocks, which take the following arguments:

    AttachedVpcId string
    ID of a VPC attached to the specific VPN Gateway to retrieve.
    AvailabilityZone string
    Availability Zone of the specific VPN Gateway to retrieve.
    Filters []GetVpnGatewayFilter
    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.
    Tags map[string]string
    Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
    amazonSideAsn String

    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 filter sub-blocks, which take the following arguments:

    attachedVpcId String
    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<GetVpnGatewayFilter>
    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.
    tags Map<String,String>
    Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
    amazonSideAsn string

    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 filter sub-blocks, which take the following arguments:

    attachedVpcId string
    ID of a VPC attached to the specific VPN Gateway to retrieve.
    availabilityZone string
    Availability Zone of the specific VPN Gateway to retrieve.
    filters GetVpnGatewayFilter[]
    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.
    tags {[key: string]: string}
    Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
    amazon_side_asn str

    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 filter sub-blocks, which take the following arguments:

    attached_vpc_id str
    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[GetVpnGatewayFilter]
    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.
    tags Mapping[str, str]
    Map of tags, each pair of which must exactly match a pair on the desired VPN Gateway.
    amazonSideAsn String

    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 filter sub-blocks, which take the following arguments:

    attachedVpcId String
    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.
    tags 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:

    AmazonSideAsn string
    Arn string
    AttachedVpcId string
    AvailabilityZone string
    Id string
    State string
    Tags Dictionary<string, string>
    Filters List<GetVpnGatewayFilter>
    AmazonSideAsn string
    Arn string
    AttachedVpcId string
    AvailabilityZone string
    Id string
    State string
    Tags map[string]string
    Filters []GetVpnGatewayFilter
    amazonSideAsn String
    arn String
    attachedVpcId String
    availabilityZone String
    id String
    state String
    tags Map<String,String>
    filters List<GetVpnGatewayFilter>
    amazonSideAsn string
    arn string
    attachedVpcId string
    availabilityZone string
    id string
    state string
    tags {[key: string]: string}
    filters GetVpnGatewayFilter[]
    amazonSideAsn String
    arn String
    attachedVpcId String
    availabilityZone String
    id String
    state String
    tags 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 aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi