AWS v6.60.0 published on Tuesday, Nov 19, 2024 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: aws:ec2transitgateway/getAttachment:getAttachment
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Get
Attachment Filter>  - One or more configuration blocks containing name-values filters. Detailed below.
 - Dictionary<string, string>
 - Key-value tags for the attachment.
 - Transit
Gateway stringAttachment Id  - ID of the attachment.
 
- Filters
[]Get
Attachment Filter  - One or more configuration blocks containing name-values filters. Detailed below.
 - map[string]string
 - Key-value tags for the attachment.
 - Transit
Gateway stringAttachment Id  - ID of the attachment.
 
- filters
List<Get
Attachment Filter>  - One or more configuration blocks containing name-values filters. Detailed below.
 - Map<String,String>
 - Key-value tags for the attachment.
 - transit
Gateway StringAttachment Id  - ID of the attachment.
 
- filters
Get
Attachment Filter[]  - One or more configuration blocks containing name-values filters. Detailed below.
 - {[key: string]: string}
 - Key-value tags for the attachment.
 - transit
Gateway stringAttachment Id  - ID of the attachment.
 
- filters
Sequence[Get
Attachment 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.
 - transit
Gateway StringAttachment Id  - ID of the attachment.
 
getAttachment Result
The following output properties are available:
- Arn string
 - ARN of the attachment.
 - Association
State string - The state of the association (see the underlying AWS API for valid values).
 - Association
Transit 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.
 - Resource
Id string - ID of the resource.
 - Resource
Owner stringId  - ID of the AWS account that owns the resource.
 - Resource
Type string - Resource type.
 - State string
 - Attachment state.
 - Dictionary<string, string>
 - Key-value tags for the attachment.
 - Transit
Gateway stringAttachment Id  - Transit
Gateway stringId  - ID of the transit gateway.
 - Transit
Gateway stringOwner Id  - The ID of the AWS account that owns the transit gateway.
 - Filters
List<Get
Attachment Filter>  
- Arn string
 - ARN of the attachment.
 - Association
State string - The state of the association (see the underlying AWS API for valid values).
 - Association
Transit 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.
 - Resource
Id string - ID of the resource.
 - Resource
Owner stringId  - ID of the AWS account that owns the resource.
 - Resource
Type string - Resource type.
 - State string
 - Attachment state.
 - map[string]string
 - Key-value tags for the attachment.
 - Transit
Gateway stringAttachment Id  - Transit
Gateway stringId  - ID of the transit gateway.
 - Transit
Gateway stringOwner Id  - The ID of the AWS account that owns the transit gateway.
 - Filters
[]Get
Attachment Filter  
- arn String
 - ARN of the attachment.
 - association
State String - The state of the association (see the underlying AWS API for valid values).
 - association
Transit 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.
 - resource
Id String - ID of the resource.
 - resource
Owner StringId  - ID of the AWS account that owns the resource.
 - resource
Type String - Resource type.
 - state String
 - Attachment state.
 - Map<String,String>
 - Key-value tags for the attachment.
 - transit
Gateway StringAttachment Id  - transit
Gateway StringId  - ID of the transit gateway.
 - transit
Gateway StringOwner Id  - The ID of the AWS account that owns the transit gateway.
 - filters
List<Get
Attachment Filter>  
- arn string
 - ARN of the attachment.
 - association
State string - The state of the association (see the underlying AWS API for valid values).
 - association
Transit 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.
 - resource
Id string - ID of the resource.
 - resource
Owner stringId  - ID of the AWS account that owns the resource.
 - resource
Type string - Resource type.
 - state string
 - Attachment state.
 - {[key: string]: string}
 - Key-value tags for the attachment.
 - transit
Gateway stringAttachment Id  - transit
Gateway stringId  - ID of the transit gateway.
 - transit
Gateway stringOwner Id  - The ID of the AWS account that owns the transit gateway.
 - filters
Get
Attachment 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[Get
Attachment Filter]  
- arn String
 - ARN of the attachment.
 - association
State String - The state of the association (see the underlying AWS API for valid values).
 - association
Transit 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.
 - resource
Id String - ID of the resource.
 - resource
Owner StringId  - ID of the AWS account that owns the resource.
 - resource
Type String - Resource type.
 - state String
 - Attachment state.
 - Map<String>
 - Key-value tags for the attachment.
 - transit
Gateway StringAttachment Id  - transit
Gateway StringId  - ID of the transit gateway.
 - transit
Gateway 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.