AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.ec2transitgateway.getAttachment
Explore with Pulumi AI
Get information on an EC2 Transit Gateway’s attachment to a resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2transitgateway.getAttachment({
    filters: [
        {
            name: "transit-gateway-id",
            values: [exampleAwsEc2TransitGateway.id],
        },
        {
            name: "resource-type",
            values: ["peering"],
        },
    ],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.get_attachment(filters=[
    {
        "name": "transit-gateway-id",
        "values": [example_aws_ec2_transit_gateway["id"]],
    },
    {
        "name": "resource-type",
        "values": ["peering"],
    },
])
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.GetAttachment(ctx, &ec2transitgateway.GetAttachmentArgs{
Filters: []ec2transitgateway.GetAttachmentFilter{
{
Name: "transit-gateway-id",
Values: interface{}{
exampleAwsEc2TransitGateway.Id,
},
},
{
Name: "resource-type",
Values: []string{
"peering",
},
},
},
}, nil);
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 example = Aws.Ec2TransitGateway.GetAttachment.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2TransitGateway.Inputs.GetAttachmentFilterInputArgs
            {
                Name = "transit-gateway-id",
                Values = new[]
                {
                    exampleAwsEc2TransitGateway.Id,
                },
            },
            new Aws.Ec2TransitGateway.Inputs.GetAttachmentFilterInputArgs
            {
                Name = "resource-type",
                Values = new[]
                {
                    "peering",
                },
            },
        },
    });
});
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.GetAttachmentArgs;
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.getAttachment(GetAttachmentArgs.builder()
            .filters(            
                GetAttachmentFilterArgs.builder()
                    .name("transit-gateway-id")
                    .values(exampleAwsEc2TransitGateway.id())
                    .build(),
                GetAttachmentFilterArgs.builder()
                    .name("resource-type")
                    .values("peering")
                    .build())
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getAttachment
      arguments:
        filters:
          - name: transit-gateway-id
            values:
              - ${exampleAwsEc2TransitGateway.id}
          - name: resource-type
            values:
              - peering
Using getAttachment
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 getAttachment(args: GetAttachmentArgs, opts?: InvokeOptions): Promise<GetAttachmentResult>
function getAttachmentOutput(args: GetAttachmentOutputArgs, opts?: InvokeOptions): Output<GetAttachmentResult>def get_attachment(filters: Optional[Sequence[GetAttachmentFilter]] = None,
                   tags: Optional[Mapping[str, str]] = None,
                   transit_gateway_attachment_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetAttachmentResult
def get_attachment_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetAttachmentFilterArgs]]]] = None,
                   tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                   transit_gateway_attachment_id: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetAttachmentResult]func GetAttachment(ctx *Context, args *GetAttachmentArgs, opts ...InvokeOption) (*GetAttachmentResult, error)
func GetAttachmentOutput(ctx *Context, args *GetAttachmentOutputArgs, opts ...InvokeOption) GetAttachmentResultOutput> Note: This function is named GetAttachment in the Go SDK.
public static class GetAttachment 
{
    public static Task<GetAttachmentResult> InvokeAsync(GetAttachmentArgs args, InvokeOptions? opts = null)
    public static Output<GetAttachmentResult> Invoke(GetAttachmentInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetAttachmentResult> getAttachment(GetAttachmentArgs args, InvokeOptions options)
public static Output<GetAttachmentResult> getAttachment(GetAttachmentArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2transitgateway/getAttachment:getAttachment
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetAttachment Filter> 
- One or more configuration blocks containing name-values filters. Detailed below.
- Dictionary<string, string>
- Key-value tags for the attachment.
- TransitGateway stringAttachment Id 
- ID of the attachment.
- Filters
[]GetAttachment Filter 
- One or more configuration blocks containing name-values filters. Detailed below.
- map[string]string
- Key-value tags for the attachment.
- TransitGateway stringAttachment Id 
- ID of the attachment.
- filters
List<GetAttachment Filter> 
- One or more configuration blocks containing name-values filters. Detailed below.
- Map<String,String>
- Key-value tags for the attachment.
- transitGateway StringAttachment Id 
- ID of the attachment.
- filters
GetAttachment Filter[] 
- One or more configuration blocks containing name-values filters. Detailed below.
- {[key: string]: string}
- Key-value tags for the attachment.
- transitGateway stringAttachment Id 
- ID of the attachment.
- filters
Sequence[GetAttachment Filter] 
- One or more configuration blocks containing name-values filters. Detailed below.
- Mapping[str, str]
- Key-value tags for the attachment.
- transit_gateway_ strattachment_ id 
- ID of the attachment.
- filters List<Property Map>
- One or more configuration blocks containing name-values filters. Detailed below.
- Map<String>
- Key-value tags for the attachment.
- transitGateway StringAttachment Id 
- ID of the attachment.
getAttachment Result
The following output properties are available:
- Arn string
- ARN of the attachment.
- AssociationState string
- The state of the association (see the underlying AWS API for valid values).
- AssociationTransit stringGateway Route Table Id 
- The ID of the route table for the transit gateway.
- Id string
- The provider-assigned unique ID for this managed resource.
- ResourceId string
- ID of the resource.
- ResourceOwner stringId 
- ID of the AWS account that owns the resource.
- ResourceType string
- Resource type.
- State string
- Attachment state.
- Dictionary<string, string>
- Key-value tags for the attachment.
- TransitGateway stringAttachment Id 
- TransitGateway stringId 
- ID of the transit gateway.
- TransitGateway stringOwner Id 
- The ID of the AWS account that owns the transit gateway.
- Filters
List<GetAttachment Filter> 
- Arn string
- ARN of the attachment.
- AssociationState string
- The state of the association (see the underlying AWS API for valid values).
- AssociationTransit stringGateway Route Table Id 
- The ID of the route table for the transit gateway.
- Id string
- The provider-assigned unique ID for this managed resource.
- ResourceId string
- ID of the resource.
- ResourceOwner stringId 
- ID of the AWS account that owns the resource.
- ResourceType string
- Resource type.
- State string
- Attachment state.
- map[string]string
- Key-value tags for the attachment.
- TransitGateway stringAttachment Id 
- TransitGateway stringId 
- ID of the transit gateway.
- TransitGateway stringOwner Id 
- The ID of the AWS account that owns the transit gateway.
- Filters
[]GetAttachment Filter 
- arn String
- ARN of the attachment.
- associationState String
- The state of the association (see the underlying AWS API for valid values).
- associationTransit StringGateway Route Table Id 
- The ID of the route table for the transit gateway.
- id String
- The provider-assigned unique ID for this managed resource.
- resourceId String
- ID of the resource.
- resourceOwner StringId 
- ID of the AWS account that owns the resource.
- resourceType String
- Resource type.
- state String
- Attachment state.
- Map<String,String>
- Key-value tags for the attachment.
- transitGateway StringAttachment Id 
- transitGateway StringId 
- ID of the transit gateway.
- transitGateway StringOwner Id 
- The ID of the AWS account that owns the transit gateway.
- filters
List<GetAttachment Filter> 
- arn string
- ARN of the attachment.
- associationState string
- The state of the association (see the underlying AWS API for valid values).
- associationTransit stringGateway Route Table Id 
- The ID of the route table for the transit gateway.
- id string
- The provider-assigned unique ID for this managed resource.
- resourceId string
- ID of the resource.
- resourceOwner stringId 
- ID of the AWS account that owns the resource.
- resourceType string
- Resource type.
- state string
- Attachment state.
- {[key: string]: string}
- Key-value tags for the attachment.
- transitGateway stringAttachment Id 
- transitGateway stringId 
- ID of the transit gateway.
- transitGateway stringOwner Id 
- The ID of the AWS account that owns the transit gateway.
- filters
GetAttachment Filter[] 
- arn str
- ARN of the attachment.
- association_state str
- The state of the association (see the underlying AWS API for valid values).
- association_transit_ strgateway_ route_ table_ id 
- The ID of the route table for the transit gateway.
- id str
- The provider-assigned unique ID for this managed resource.
- resource_id str
- ID of the resource.
- resource_owner_ strid 
- ID of the AWS account that owns the resource.
- resource_type str
- Resource type.
- state str
- Attachment state.
- Mapping[str, str]
- Key-value tags for the attachment.
- transit_gateway_ strattachment_ id 
- transit_gateway_ strid 
- ID of the transit gateway.
- transit_gateway_ strowner_ id 
- The ID of the AWS account that owns the transit gateway.
- filters
Sequence[GetAttachment Filter] 
- arn String
- ARN of the attachment.
- associationState String
- The state of the association (see the underlying AWS API for valid values).
- associationTransit StringGateway Route Table Id 
- The ID of the route table for the transit gateway.
- id String
- The provider-assigned unique ID for this managed resource.
- resourceId String
- ID of the resource.
- resourceOwner StringId 
- ID of the AWS account that owns the resource.
- resourceType String
- Resource type.
- state String
- Attachment state.
- Map<String>
- Key-value tags for the attachment.
- transitGateway StringAttachment Id 
- transitGateway StringId 
- ID of the transit gateway.
- transitGateway StringOwner Id 
- The ID of the AWS account that owns the transit gateway.
- filters List<Property Map>
Supporting Types
GetAttachmentFilter  
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
- List of one or more values for the filter.
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values []string
- List of one or more values for the filter.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- List of one or more values for the filter.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values string[]
- List of one or more values for the filter.
- name str
- Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
- List of one or more values for the filter.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values 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 awsTerraform Provider.