github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/getVpnAttachment.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package ec2transitgateway
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Get information on an EC2 Transit Gateway VPN Attachment.
    15  //
    16  // > EC2 Transit Gateway VPN Attachments are implicitly created by VPN Connections referencing an EC2 Transit Gateway so there is no managed resource. For ease, the `ec2.VpnConnection` resource includes a `transitGatewayAttachmentId` attribute which can replace some usage of this data source. For tagging the attachment, see the `ec2.Tag` resource.
    17  //
    18  // ## Example Usage
    19  //
    20  // ### By Transit Gateway and VPN Connection Identifiers
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			_, err := ec2transitgateway.GetVpnAttachment(ctx, &ec2transitgateway.GetVpnAttachmentArgs{
    36  //				TransitGatewayId: pulumi.StringRef(exampleAwsEc2TransitGateway.Id),
    37  //				VpnConnectionId:  pulumi.StringRef(exampleAwsVpnConnection.Id),
    38  //			}, nil)
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  //
    49  // ### Filter
    50  //
    51  // <!--Start PulumiCodeChooser -->
    52  // ```go
    53  // package main
    54  //
    55  // import (
    56  //
    57  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    58  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    59  //
    60  // )
    61  //
    62  //	func main() {
    63  //		pulumi.Run(func(ctx *pulumi.Context) error {
    64  //			_, err := ec2transitgateway.GetVpnAttachment(ctx, &ec2transitgateway.GetVpnAttachmentArgs{
    65  //				Filters: []ec2transitgateway.GetVpnAttachmentFilter{
    66  //					{
    67  //						Name: "resource-id",
    68  //						Values: []string{
    69  //							"some-resource",
    70  //						},
    71  //					},
    72  //				},
    73  //			}, nil)
    74  //			if err != nil {
    75  //				return err
    76  //			}
    77  //			return nil
    78  //		})
    79  //	}
    80  //
    81  // ```
    82  // <!--End PulumiCodeChooser -->
    83  func GetVpnAttachment(ctx *pulumi.Context, args *GetVpnAttachmentArgs, opts ...pulumi.InvokeOption) (*GetVpnAttachmentResult, error) {
    84  	opts = internal.PkgInvokeDefaultOpts(opts)
    85  	var rv GetVpnAttachmentResult
    86  	err := ctx.Invoke("aws:ec2transitgateway/getVpnAttachment:getVpnAttachment", args, &rv, opts...)
    87  	if err != nil {
    88  		return nil, err
    89  	}
    90  	return &rv, nil
    91  }
    92  
    93  // A collection of arguments for invoking getVpnAttachment.
    94  type GetVpnAttachmentArgs struct {
    95  	// Configuration block(s) for filtering. Detailed below.
    96  	Filters []GetVpnAttachmentFilter `pulumi:"filters"`
    97  	// Map of tags, each pair of which must exactly match a pair on the desired Transit Gateway VPN Attachment.
    98  	Tags map[string]string `pulumi:"tags"`
    99  	// Identifier of the EC2 Transit Gateway.
   100  	TransitGatewayId *string `pulumi:"transitGatewayId"`
   101  	// Identifier of the EC2 VPN Connection.
   102  	VpnConnectionId *string `pulumi:"vpnConnectionId"`
   103  }
   104  
   105  // A collection of values returned by getVpnAttachment.
   106  type GetVpnAttachmentResult struct {
   107  	Filters []GetVpnAttachmentFilter `pulumi:"filters"`
   108  	// The provider-assigned unique ID for this managed resource.
   109  	Id string `pulumi:"id"`
   110  	// Key-value tags for the EC2 Transit Gateway VPN Attachment
   111  	Tags             map[string]string `pulumi:"tags"`
   112  	TransitGatewayId *string           `pulumi:"transitGatewayId"`
   113  	VpnConnectionId  *string           `pulumi:"vpnConnectionId"`
   114  }
   115  
   116  func GetVpnAttachmentOutput(ctx *pulumi.Context, args GetVpnAttachmentOutputArgs, opts ...pulumi.InvokeOption) GetVpnAttachmentResultOutput {
   117  	return pulumi.ToOutputWithContext(context.Background(), args).
   118  		ApplyT(func(v interface{}) (GetVpnAttachmentResult, error) {
   119  			args := v.(GetVpnAttachmentArgs)
   120  			r, err := GetVpnAttachment(ctx, &args, opts...)
   121  			var s GetVpnAttachmentResult
   122  			if r != nil {
   123  				s = *r
   124  			}
   125  			return s, err
   126  		}).(GetVpnAttachmentResultOutput)
   127  }
   128  
   129  // A collection of arguments for invoking getVpnAttachment.
   130  type GetVpnAttachmentOutputArgs struct {
   131  	// Configuration block(s) for filtering. Detailed below.
   132  	Filters GetVpnAttachmentFilterArrayInput `pulumi:"filters"`
   133  	// Map of tags, each pair of which must exactly match a pair on the desired Transit Gateway VPN Attachment.
   134  	Tags pulumi.StringMapInput `pulumi:"tags"`
   135  	// Identifier of the EC2 Transit Gateway.
   136  	TransitGatewayId pulumi.StringPtrInput `pulumi:"transitGatewayId"`
   137  	// Identifier of the EC2 VPN Connection.
   138  	VpnConnectionId pulumi.StringPtrInput `pulumi:"vpnConnectionId"`
   139  }
   140  
   141  func (GetVpnAttachmentOutputArgs) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*GetVpnAttachmentArgs)(nil)).Elem()
   143  }
   144  
   145  // A collection of values returned by getVpnAttachment.
   146  type GetVpnAttachmentResultOutput struct{ *pulumi.OutputState }
   147  
   148  func (GetVpnAttachmentResultOutput) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*GetVpnAttachmentResult)(nil)).Elem()
   150  }
   151  
   152  func (o GetVpnAttachmentResultOutput) ToGetVpnAttachmentResultOutput() GetVpnAttachmentResultOutput {
   153  	return o
   154  }
   155  
   156  func (o GetVpnAttachmentResultOutput) ToGetVpnAttachmentResultOutputWithContext(ctx context.Context) GetVpnAttachmentResultOutput {
   157  	return o
   158  }
   159  
   160  func (o GetVpnAttachmentResultOutput) Filters() GetVpnAttachmentFilterArrayOutput {
   161  	return o.ApplyT(func(v GetVpnAttachmentResult) []GetVpnAttachmentFilter { return v.Filters }).(GetVpnAttachmentFilterArrayOutput)
   162  }
   163  
   164  // The provider-assigned unique ID for this managed resource.
   165  func (o GetVpnAttachmentResultOutput) Id() pulumi.StringOutput {
   166  	return o.ApplyT(func(v GetVpnAttachmentResult) string { return v.Id }).(pulumi.StringOutput)
   167  }
   168  
   169  // Key-value tags for the EC2 Transit Gateway VPN Attachment
   170  func (o GetVpnAttachmentResultOutput) Tags() pulumi.StringMapOutput {
   171  	return o.ApplyT(func(v GetVpnAttachmentResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   172  }
   173  
   174  func (o GetVpnAttachmentResultOutput) TransitGatewayId() pulumi.StringPtrOutput {
   175  	return o.ApplyT(func(v GetVpnAttachmentResult) *string { return v.TransitGatewayId }).(pulumi.StringPtrOutput)
   176  }
   177  
   178  func (o GetVpnAttachmentResultOutput) VpnConnectionId() pulumi.StringPtrOutput {
   179  	return o.ApplyT(func(v GetVpnAttachmentResult) *string { return v.VpnConnectionId }).(pulumi.StringPtrOutput)
   180  }
   181  
   182  func init() {
   183  	pulumi.RegisterOutputType(GetVpnAttachmentResultOutput{})
   184  }