1. Packages
  2. AWS
  3. API Docs
  4. ec2transitgateway
  5. getVpcAttachment
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ec2transitgateway.getVpcAttachment

Explore with Pulumi AI

Get information on an EC2 Transit Gateway VPC Attachment.

Example Usage

By Filter

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.ec2transitgateway.getVpcAttachment({
    filters: [{
        name: "vpc-id",
        values: ["vpc-12345678"],
    }],
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.get_vpc_attachment(filters=[{
    "name": "vpc-id",
    "values": ["vpc-12345678"],
}])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupVpcAttachment(ctx, &ec2transitgateway.LookupVpcAttachmentArgs{
			Filters: []ec2transitgateway.GetVpcAttachmentFilter{
				{
					Name: "vpc-id",
					Values: []string{
						"vpc-12345678",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetVpcAttachment.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2TransitGateway.Inputs.GetVpcAttachmentFilterInputArgs
            {
                Name = "vpc-id",
                Values = new[]
                {
                    "vpc-12345678",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetVpcAttachmentArgs;
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 example = Ec2transitgatewayFunctions.getVpcAttachment(GetVpcAttachmentArgs.builder()
            .filters(GetVpcAttachmentFilterArgs.builder()
                .name("vpc-id")
                .values("vpc-12345678")
                .build())
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getVpcAttachment
      arguments:
        filters:
          - name: vpc-id
            values:
              - vpc-12345678
Copy

By Identifier

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.ec2transitgateway.getVpcAttachment({
    id: "tgw-attach-12345678",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.get_vpc_attachment(id="tgw-attach-12345678")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupVpcAttachment(ctx, &ec2transitgateway.LookupVpcAttachmentArgs{
			Id: pulumi.StringRef("tgw-attach-12345678"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetVpcAttachment.Invoke(new()
    {
        Id = "tgw-attach-12345678",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetVpcAttachmentArgs;
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 example = Ec2transitgatewayFunctions.getVpcAttachment(GetVpcAttachmentArgs.builder()
            .id("tgw-attach-12345678")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getVpcAttachment
      arguments:
        id: tgw-attach-12345678
Copy

Using getVpcAttachment

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 getVpcAttachment(args: GetVpcAttachmentArgs, opts?: InvokeOptions): Promise<GetVpcAttachmentResult>
function getVpcAttachmentOutput(args: GetVpcAttachmentOutputArgs, opts?: InvokeOptions): Output<GetVpcAttachmentResult>
Copy
def get_vpc_attachment(filters: Optional[Sequence[GetVpcAttachmentFilter]] = None,
                       id: Optional[str] = None,
                       tags: Optional[Mapping[str, str]] = None,
                       opts: Optional[InvokeOptions] = None) -> GetVpcAttachmentResult
def get_vpc_attachment_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcAttachmentFilterArgs]]]] = None,
                       id: Optional[pulumi.Input[str]] = None,
                       tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetVpcAttachmentResult]
Copy
func LookupVpcAttachment(ctx *Context, args *LookupVpcAttachmentArgs, opts ...InvokeOption) (*LookupVpcAttachmentResult, error)
func LookupVpcAttachmentOutput(ctx *Context, args *LookupVpcAttachmentOutputArgs, opts ...InvokeOption) LookupVpcAttachmentResultOutput
Copy

> Note: This function is named LookupVpcAttachment in the Go SDK.

public static class GetVpcAttachment 
{
    public static Task<GetVpcAttachmentResult> InvokeAsync(GetVpcAttachmentArgs args, InvokeOptions? opts = null)
    public static Output<GetVpcAttachmentResult> Invoke(GetVpcAttachmentInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetVpcAttachmentResult> getVpcAttachment(GetVpcAttachmentArgs args, InvokeOptions options)
public static Output<GetVpcAttachmentResult> getVpcAttachment(GetVpcAttachmentArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ec2transitgateway/getVpcAttachment:getVpcAttachment
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetVpcAttachmentFilter>
One or more configuration blocks containing name-values filters. Detailed below.
Id string
Identifier of the EC2 Transit Gateway VPC Attachment.
Tags Dictionary<string, string>
Key-value tags for the EC2 Transit Gateway VPC Attachment
Filters []GetVpcAttachmentFilter
One or more configuration blocks containing name-values filters. Detailed below.
Id string
Identifier of the EC2 Transit Gateway VPC Attachment.
Tags map[string]string
Key-value tags for the EC2 Transit Gateway VPC Attachment
filters List<GetVpcAttachmentFilter>
One or more configuration blocks containing name-values filters. Detailed below.
id String
Identifier of the EC2 Transit Gateway VPC Attachment.
tags Map<String,String>
Key-value tags for the EC2 Transit Gateway VPC Attachment
filters GetVpcAttachmentFilter[]
One or more configuration blocks containing name-values filters. Detailed below.
id string
Identifier of the EC2 Transit Gateway VPC Attachment.
tags {[key: string]: string}
Key-value tags for the EC2 Transit Gateway VPC Attachment
filters Sequence[GetVpcAttachmentFilter]
One or more configuration blocks containing name-values filters. Detailed below.
id str
Identifier of the EC2 Transit Gateway VPC Attachment.
tags Mapping[str, str]
Key-value tags for the EC2 Transit Gateway VPC Attachment
filters List<Property Map>
One or more configuration blocks containing name-values filters. Detailed below.
id String
Identifier of the EC2 Transit Gateway VPC Attachment.
tags Map<String>
Key-value tags for the EC2 Transit Gateway VPC Attachment

getVpcAttachment Result

The following output properties are available:

ApplianceModeSupport string
Whether Appliance Mode support is enabled.
Arn string
ARN of the attachment.
DnsSupport string
Whether DNS support is enabled.
Id string
EC2 Transit Gateway VPC Attachment identifier
Ipv6Support string
Whether IPv6 support is enabled.
SecurityGroupReferencingSupport string
Whether Security Group Referencing Support is enabled.
SubnetIds List<string>
Identifiers of EC2 Subnets.
Tags Dictionary<string, string>
Key-value tags for the EC2 Transit Gateway VPC Attachment
TransitGatewayId string
EC2 Transit Gateway identifier
VpcId string
Identifier of EC2 VPC.
VpcOwnerId string
Identifier of the AWS account that owns the EC2 VPC.
Filters List<GetVpcAttachmentFilter>
ApplianceModeSupport string
Whether Appliance Mode support is enabled.
Arn string
ARN of the attachment.
DnsSupport string
Whether DNS support is enabled.
Id string
EC2 Transit Gateway VPC Attachment identifier
Ipv6Support string
Whether IPv6 support is enabled.
SecurityGroupReferencingSupport string
Whether Security Group Referencing Support is enabled.
SubnetIds []string
Identifiers of EC2 Subnets.
Tags map[string]string
Key-value tags for the EC2 Transit Gateway VPC Attachment
TransitGatewayId string
EC2 Transit Gateway identifier
VpcId string
Identifier of EC2 VPC.
VpcOwnerId string
Identifier of the AWS account that owns the EC2 VPC.
Filters []GetVpcAttachmentFilter
applianceModeSupport String
Whether Appliance Mode support is enabled.
arn String
ARN of the attachment.
dnsSupport String
Whether DNS support is enabled.
id String
EC2 Transit Gateway VPC Attachment identifier
ipv6Support String
Whether IPv6 support is enabled.
securityGroupReferencingSupport String
Whether Security Group Referencing Support is enabled.
subnetIds List<String>
Identifiers of EC2 Subnets.
tags Map<String,String>
Key-value tags for the EC2 Transit Gateway VPC Attachment
transitGatewayId String
EC2 Transit Gateway identifier
vpcId String
Identifier of EC2 VPC.
vpcOwnerId String
Identifier of the AWS account that owns the EC2 VPC.
filters List<GetVpcAttachmentFilter>
applianceModeSupport string
Whether Appliance Mode support is enabled.
arn string
ARN of the attachment.
dnsSupport string
Whether DNS support is enabled.
id string
EC2 Transit Gateway VPC Attachment identifier
ipv6Support string
Whether IPv6 support is enabled.
securityGroupReferencingSupport string
Whether Security Group Referencing Support is enabled.
subnetIds string[]
Identifiers of EC2 Subnets.
tags {[key: string]: string}
Key-value tags for the EC2 Transit Gateway VPC Attachment
transitGatewayId string
EC2 Transit Gateway identifier
vpcId string
Identifier of EC2 VPC.
vpcOwnerId string
Identifier of the AWS account that owns the EC2 VPC.
filters GetVpcAttachmentFilter[]
appliance_mode_support str
Whether Appliance Mode support is enabled.
arn str
ARN of the attachment.
dns_support str
Whether DNS support is enabled.
id str
EC2 Transit Gateway VPC Attachment identifier
ipv6_support str
Whether IPv6 support is enabled.
security_group_referencing_support str
Whether Security Group Referencing Support is enabled.
subnet_ids Sequence[str]
Identifiers of EC2 Subnets.
tags Mapping[str, str]
Key-value tags for the EC2 Transit Gateway VPC Attachment
transit_gateway_id str
EC2 Transit Gateway identifier
vpc_id str
Identifier of EC2 VPC.
vpc_owner_id str
Identifier of the AWS account that owns the EC2 VPC.
filters Sequence[GetVpcAttachmentFilter]
applianceModeSupport String
Whether Appliance Mode support is enabled.
arn String
ARN of the attachment.
dnsSupport String
Whether DNS support is enabled.
id String
EC2 Transit Gateway VPC Attachment identifier
ipv6Support String
Whether IPv6 support is enabled.
securityGroupReferencingSupport String
Whether Security Group Referencing Support is enabled.
subnetIds List<String>
Identifiers of EC2 Subnets.
tags Map<String>
Key-value tags for the EC2 Transit Gateway VPC Attachment
transitGatewayId String
EC2 Transit Gateway identifier
vpcId String
Identifier of EC2 VPC.
vpcOwnerId String
Identifier of the AWS account that owns the EC2 VPC.
filters List<Property Map>

Supporting Types

GetVpcAttachmentFilter

Name This property is required. string
Name of the filter.
Values This property is required. List<string>
List of one or more values for the filter.
Name This property is required. string
Name of the filter.
Values This property is required. []string
List of one or more values for the filter.
name This property is required. String
Name of the filter.
values This property is required. List<String>
List of one or more values for the filter.
name This property is required. string
Name of the filter.
values This property is required. string[]
List of one or more values for the filter.
name This property is required. str
Name of the filter.
values This property is required. Sequence[str]
List of one or more values for the filter.
name This property is required. String
Name of the filter.
values This property is required. List<String>
List of one or more values for the filter.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.