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

aws.ec2transitgateway.getAttachment

Explore with Pulumi AI

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

    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 dictionary

    The following arguments are supported:

    Filters List<GetAttachmentFilter>
    One or more configuration blocks containing name-values filters. Detailed below.
    Tags Dictionary<string, string>
    Key-value tags for the attachment.
    TransitGatewayAttachmentId string
    ID of the attachment.
    Filters []GetAttachmentFilter
    One or more configuration blocks containing name-values filters. Detailed below.
    Tags map[string]string
    Key-value tags for the attachment.
    TransitGatewayAttachmentId string
    ID of the attachment.
    filters List<GetAttachmentFilter>
    One or more configuration blocks containing name-values filters. Detailed below.
    tags Map<String,String>
    Key-value tags for the attachment.
    transitGatewayAttachmentId String
    ID of the attachment.
    filters GetAttachmentFilter[]
    One or more configuration blocks containing name-values filters. Detailed below.
    tags {[key: string]: string}
    Key-value tags for the attachment.
    transitGatewayAttachmentId string
    ID of the attachment.
    filters Sequence[GetAttachmentFilter]
    One or more configuration blocks containing name-values filters. Detailed below.
    tags Mapping[str, str]
    Key-value tags for the attachment.
    transit_gateway_attachment_id str
    ID of the attachment.
    filters List<Property Map>
    One or more configuration blocks containing name-values filters. Detailed below.
    tags Map<String>
    Key-value tags for the attachment.
    transitGatewayAttachmentId String
    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).
    AssociationTransitGatewayRouteTableId string
    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.
    ResourceOwnerId string
    ID of the AWS account that owns the resource.
    ResourceType string
    Resource type.
    State string
    Attachment state.
    Tags Dictionary<string, string>
    Key-value tags for the attachment.
    TransitGatewayAttachmentId string
    TransitGatewayId string
    ID of the transit gateway.
    TransitGatewayOwnerId string
    The ID of the AWS account that owns the transit gateway.
    Filters List<GetAttachmentFilter>
    Arn string
    ARN of the attachment.
    AssociationState string
    The state of the association (see the underlying AWS API for valid values).
    AssociationTransitGatewayRouteTableId string
    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.
    ResourceOwnerId string
    ID of the AWS account that owns the resource.
    ResourceType string
    Resource type.
    State string
    Attachment state.
    Tags map[string]string
    Key-value tags for the attachment.
    TransitGatewayAttachmentId string
    TransitGatewayId string
    ID of the transit gateway.
    TransitGatewayOwnerId string
    The ID of the AWS account that owns the transit gateway.
    Filters []GetAttachmentFilter
    arn String
    ARN of the attachment.
    associationState String
    The state of the association (see the underlying AWS API for valid values).
    associationTransitGatewayRouteTableId String
    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.
    resourceOwnerId String
    ID of the AWS account that owns the resource.
    resourceType String
    Resource type.
    state String
    Attachment state.
    tags Map<String,String>
    Key-value tags for the attachment.
    transitGatewayAttachmentId String
    transitGatewayId String
    ID of the transit gateway.
    transitGatewayOwnerId String
    The ID of the AWS account that owns the transit gateway.
    filters List<GetAttachmentFilter>
    arn string
    ARN of the attachment.
    associationState string
    The state of the association (see the underlying AWS API for valid values).
    associationTransitGatewayRouteTableId string
    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.
    resourceOwnerId string
    ID of the AWS account that owns the resource.
    resourceType string
    Resource type.
    state string
    Attachment state.
    tags {[key: string]: string}
    Key-value tags for the attachment.
    transitGatewayAttachmentId string
    transitGatewayId string
    ID of the transit gateway.
    transitGatewayOwnerId string
    The ID of the AWS account that owns the transit gateway.
    filters GetAttachmentFilter[]
    arn str
    ARN of the attachment.
    association_state str
    The state of the association (see the underlying AWS API for valid values).
    association_transit_gateway_route_table_id str
    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_id str
    ID of the AWS account that owns the resource.
    resource_type str
    Resource type.
    state str
    Attachment state.
    tags Mapping[str, str]
    Key-value tags for the attachment.
    transit_gateway_attachment_id str
    transit_gateway_id str
    ID of the transit gateway.
    transit_gateway_owner_id str
    The ID of the AWS account that owns the transit gateway.
    filters Sequence[GetAttachmentFilter]
    arn String
    ARN of the attachment.
    associationState String
    The state of the association (see the underlying AWS API for valid values).
    associationTransitGatewayRouteTableId String
    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.
    resourceOwnerId String
    ID of the AWS account that owns the resource.
    resourceType String
    Resource type.
    state String
    Attachment state.
    tags Map<String>
    Key-value tags for the attachment.
    transitGatewayAttachmentId String
    transitGatewayId String
    ID of the transit gateway.
    transitGatewayOwnerId String
    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 aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi