github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/connect.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  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Manages an EC2 Transit Gateway Connect.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := ec2transitgateway.NewVpcAttachment(ctx, "example", &ec2transitgateway.VpcAttachmentArgs{
    33  //				SubnetIds: pulumi.StringArray{
    34  //					exampleAwsSubnet.Id,
    35  //				},
    36  //				TransitGatewayId: pulumi.Any(exampleAwsEc2TransitGateway.Id),
    37  //				VpcId:            pulumi.Any(exampleAwsVpc.Id),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			_, err = ec2transitgateway.NewConnect(ctx, "attachment", &ec2transitgateway.ConnectArgs{
    43  //				TransportAttachmentId: example.ID(),
    44  //				TransitGatewayId:      pulumi.Any(exampleAwsEc2TransitGateway.Id),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import `aws_ec2_transit_gateway_connect` using the EC2 Transit Gateway Connect identifier. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:ec2transitgateway/connect:Connect example tgw-attach-12345678
    62  // ```
    63  type Connect struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// The tunnel protocol. Valid values: `gre`. Default is `gre`.
    67  	Protocol pulumi.StringPtrOutput `pulumi:"protocol"`
    68  	// Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    69  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    70  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    71  	//
    72  	// Deprecated: Please use `tags` instead.
    73  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    74  	// Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
    75  	TransitGatewayDefaultRouteTableAssociation pulumi.BoolPtrOutput `pulumi:"transitGatewayDefaultRouteTableAssociation"`
    76  	// Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
    77  	TransitGatewayDefaultRouteTablePropagation pulumi.BoolPtrOutput `pulumi:"transitGatewayDefaultRouteTablePropagation"`
    78  	// Identifier of EC2 Transit Gateway.
    79  	TransitGatewayId pulumi.StringOutput `pulumi:"transitGatewayId"`
    80  	// The underlaying VPC attachment
    81  	TransportAttachmentId pulumi.StringOutput `pulumi:"transportAttachmentId"`
    82  }
    83  
    84  // NewConnect registers a new resource with the given unique name, arguments, and options.
    85  func NewConnect(ctx *pulumi.Context,
    86  	name string, args *ConnectArgs, opts ...pulumi.ResourceOption) (*Connect, error) {
    87  	if args == nil {
    88  		return nil, errors.New("missing one or more required arguments")
    89  	}
    90  
    91  	if args.TransitGatewayId == nil {
    92  		return nil, errors.New("invalid value for required argument 'TransitGatewayId'")
    93  	}
    94  	if args.TransportAttachmentId == nil {
    95  		return nil, errors.New("invalid value for required argument 'TransportAttachmentId'")
    96  	}
    97  	opts = internal.PkgResourceDefaultOpts(opts)
    98  	var resource Connect
    99  	err := ctx.RegisterResource("aws:ec2transitgateway/connect:Connect", name, args, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // GetConnect gets an existing Connect resource's state with the given name, ID, and optional
   107  // state properties that are used to uniquely qualify the lookup (nil if not required).
   108  func GetConnect(ctx *pulumi.Context,
   109  	name string, id pulumi.IDInput, state *ConnectState, opts ...pulumi.ResourceOption) (*Connect, error) {
   110  	var resource Connect
   111  	err := ctx.ReadResource("aws:ec2transitgateway/connect:Connect", name, id, state, &resource, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return &resource, nil
   116  }
   117  
   118  // Input properties used for looking up and filtering Connect resources.
   119  type connectState struct {
   120  	// The tunnel protocol. Valid values: `gre`. Default is `gre`.
   121  	Protocol *string `pulumi:"protocol"`
   122  	// Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   123  	Tags map[string]string `pulumi:"tags"`
   124  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   125  	//
   126  	// Deprecated: Please use `tags` instead.
   127  	TagsAll map[string]string `pulumi:"tagsAll"`
   128  	// Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   129  	TransitGatewayDefaultRouteTableAssociation *bool `pulumi:"transitGatewayDefaultRouteTableAssociation"`
   130  	// Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   131  	TransitGatewayDefaultRouteTablePropagation *bool `pulumi:"transitGatewayDefaultRouteTablePropagation"`
   132  	// Identifier of EC2 Transit Gateway.
   133  	TransitGatewayId *string `pulumi:"transitGatewayId"`
   134  	// The underlaying VPC attachment
   135  	TransportAttachmentId *string `pulumi:"transportAttachmentId"`
   136  }
   137  
   138  type ConnectState struct {
   139  	// The tunnel protocol. Valid values: `gre`. Default is `gre`.
   140  	Protocol pulumi.StringPtrInput
   141  	// Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   142  	Tags pulumi.StringMapInput
   143  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   144  	//
   145  	// Deprecated: Please use `tags` instead.
   146  	TagsAll pulumi.StringMapInput
   147  	// Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   148  	TransitGatewayDefaultRouteTableAssociation pulumi.BoolPtrInput
   149  	// Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   150  	TransitGatewayDefaultRouteTablePropagation pulumi.BoolPtrInput
   151  	// Identifier of EC2 Transit Gateway.
   152  	TransitGatewayId pulumi.StringPtrInput
   153  	// The underlaying VPC attachment
   154  	TransportAttachmentId pulumi.StringPtrInput
   155  }
   156  
   157  func (ConnectState) ElementType() reflect.Type {
   158  	return reflect.TypeOf((*connectState)(nil)).Elem()
   159  }
   160  
   161  type connectArgs struct {
   162  	// The tunnel protocol. Valid values: `gre`. Default is `gre`.
   163  	Protocol *string `pulumi:"protocol"`
   164  	// Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   165  	Tags map[string]string `pulumi:"tags"`
   166  	// Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   167  	TransitGatewayDefaultRouteTableAssociation *bool `pulumi:"transitGatewayDefaultRouteTableAssociation"`
   168  	// Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   169  	TransitGatewayDefaultRouteTablePropagation *bool `pulumi:"transitGatewayDefaultRouteTablePropagation"`
   170  	// Identifier of EC2 Transit Gateway.
   171  	TransitGatewayId string `pulumi:"transitGatewayId"`
   172  	// The underlaying VPC attachment
   173  	TransportAttachmentId string `pulumi:"transportAttachmentId"`
   174  }
   175  
   176  // The set of arguments for constructing a Connect resource.
   177  type ConnectArgs struct {
   178  	// The tunnel protocol. Valid values: `gre`. Default is `gre`.
   179  	Protocol pulumi.StringPtrInput
   180  	// Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags pulumi.StringMapInput
   182  	// Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   183  	TransitGatewayDefaultRouteTableAssociation pulumi.BoolPtrInput
   184  	// Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   185  	TransitGatewayDefaultRouteTablePropagation pulumi.BoolPtrInput
   186  	// Identifier of EC2 Transit Gateway.
   187  	TransitGatewayId pulumi.StringInput
   188  	// The underlaying VPC attachment
   189  	TransportAttachmentId pulumi.StringInput
   190  }
   191  
   192  func (ConnectArgs) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*connectArgs)(nil)).Elem()
   194  }
   195  
   196  type ConnectInput interface {
   197  	pulumi.Input
   198  
   199  	ToConnectOutput() ConnectOutput
   200  	ToConnectOutputWithContext(ctx context.Context) ConnectOutput
   201  }
   202  
   203  func (*Connect) ElementType() reflect.Type {
   204  	return reflect.TypeOf((**Connect)(nil)).Elem()
   205  }
   206  
   207  func (i *Connect) ToConnectOutput() ConnectOutput {
   208  	return i.ToConnectOutputWithContext(context.Background())
   209  }
   210  
   211  func (i *Connect) ToConnectOutputWithContext(ctx context.Context) ConnectOutput {
   212  	return pulumi.ToOutputWithContext(ctx, i).(ConnectOutput)
   213  }
   214  
   215  // ConnectArrayInput is an input type that accepts ConnectArray and ConnectArrayOutput values.
   216  // You can construct a concrete instance of `ConnectArrayInput` via:
   217  //
   218  //	ConnectArray{ ConnectArgs{...} }
   219  type ConnectArrayInput interface {
   220  	pulumi.Input
   221  
   222  	ToConnectArrayOutput() ConnectArrayOutput
   223  	ToConnectArrayOutputWithContext(context.Context) ConnectArrayOutput
   224  }
   225  
   226  type ConnectArray []ConnectInput
   227  
   228  func (ConnectArray) ElementType() reflect.Type {
   229  	return reflect.TypeOf((*[]*Connect)(nil)).Elem()
   230  }
   231  
   232  func (i ConnectArray) ToConnectArrayOutput() ConnectArrayOutput {
   233  	return i.ToConnectArrayOutputWithContext(context.Background())
   234  }
   235  
   236  func (i ConnectArray) ToConnectArrayOutputWithContext(ctx context.Context) ConnectArrayOutput {
   237  	return pulumi.ToOutputWithContext(ctx, i).(ConnectArrayOutput)
   238  }
   239  
   240  // ConnectMapInput is an input type that accepts ConnectMap and ConnectMapOutput values.
   241  // You can construct a concrete instance of `ConnectMapInput` via:
   242  //
   243  //	ConnectMap{ "key": ConnectArgs{...} }
   244  type ConnectMapInput interface {
   245  	pulumi.Input
   246  
   247  	ToConnectMapOutput() ConnectMapOutput
   248  	ToConnectMapOutputWithContext(context.Context) ConnectMapOutput
   249  }
   250  
   251  type ConnectMap map[string]ConnectInput
   252  
   253  func (ConnectMap) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*map[string]*Connect)(nil)).Elem()
   255  }
   256  
   257  func (i ConnectMap) ToConnectMapOutput() ConnectMapOutput {
   258  	return i.ToConnectMapOutputWithContext(context.Background())
   259  }
   260  
   261  func (i ConnectMap) ToConnectMapOutputWithContext(ctx context.Context) ConnectMapOutput {
   262  	return pulumi.ToOutputWithContext(ctx, i).(ConnectMapOutput)
   263  }
   264  
   265  type ConnectOutput struct{ *pulumi.OutputState }
   266  
   267  func (ConnectOutput) ElementType() reflect.Type {
   268  	return reflect.TypeOf((**Connect)(nil)).Elem()
   269  }
   270  
   271  func (o ConnectOutput) ToConnectOutput() ConnectOutput {
   272  	return o
   273  }
   274  
   275  func (o ConnectOutput) ToConnectOutputWithContext(ctx context.Context) ConnectOutput {
   276  	return o
   277  }
   278  
   279  // The tunnel protocol. Valid values: `gre`. Default is `gre`.
   280  func (o ConnectOutput) Protocol() pulumi.StringPtrOutput {
   281  	return o.ApplyT(func(v *Connect) pulumi.StringPtrOutput { return v.Protocol }).(pulumi.StringPtrOutput)
   282  }
   283  
   284  // Key-value tags for the EC2 Transit Gateway Connect. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   285  func (o ConnectOutput) Tags() pulumi.StringMapOutput {
   286  	return o.ApplyT(func(v *Connect) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   287  }
   288  
   289  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   290  //
   291  // Deprecated: Please use `tags` instead.
   292  func (o ConnectOutput) TagsAll() pulumi.StringMapOutput {
   293  	return o.ApplyT(func(v *Connect) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   294  }
   295  
   296  // Boolean whether the Connect should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   297  func (o ConnectOutput) TransitGatewayDefaultRouteTableAssociation() pulumi.BoolPtrOutput {
   298  	return o.ApplyT(func(v *Connect) pulumi.BoolPtrOutput { return v.TransitGatewayDefaultRouteTableAssociation }).(pulumi.BoolPtrOutput)
   299  }
   300  
   301  // Boolean whether the Connect should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
   302  func (o ConnectOutput) TransitGatewayDefaultRouteTablePropagation() pulumi.BoolPtrOutput {
   303  	return o.ApplyT(func(v *Connect) pulumi.BoolPtrOutput { return v.TransitGatewayDefaultRouteTablePropagation }).(pulumi.BoolPtrOutput)
   304  }
   305  
   306  // Identifier of EC2 Transit Gateway.
   307  func (o ConnectOutput) TransitGatewayId() pulumi.StringOutput {
   308  	return o.ApplyT(func(v *Connect) pulumi.StringOutput { return v.TransitGatewayId }).(pulumi.StringOutput)
   309  }
   310  
   311  // The underlaying VPC attachment
   312  func (o ConnectOutput) TransportAttachmentId() pulumi.StringOutput {
   313  	return o.ApplyT(func(v *Connect) pulumi.StringOutput { return v.TransportAttachmentId }).(pulumi.StringOutput)
   314  }
   315  
   316  type ConnectArrayOutput struct{ *pulumi.OutputState }
   317  
   318  func (ConnectArrayOutput) ElementType() reflect.Type {
   319  	return reflect.TypeOf((*[]*Connect)(nil)).Elem()
   320  }
   321  
   322  func (o ConnectArrayOutput) ToConnectArrayOutput() ConnectArrayOutput {
   323  	return o
   324  }
   325  
   326  func (o ConnectArrayOutput) ToConnectArrayOutputWithContext(ctx context.Context) ConnectArrayOutput {
   327  	return o
   328  }
   329  
   330  func (o ConnectArrayOutput) Index(i pulumi.IntInput) ConnectOutput {
   331  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Connect {
   332  		return vs[0].([]*Connect)[vs[1].(int)]
   333  	}).(ConnectOutput)
   334  }
   335  
   336  type ConnectMapOutput struct{ *pulumi.OutputState }
   337  
   338  func (ConnectMapOutput) ElementType() reflect.Type {
   339  	return reflect.TypeOf((*map[string]*Connect)(nil)).Elem()
   340  }
   341  
   342  func (o ConnectMapOutput) ToConnectMapOutput() ConnectMapOutput {
   343  	return o
   344  }
   345  
   346  func (o ConnectMapOutput) ToConnectMapOutputWithContext(ctx context.Context) ConnectMapOutput {
   347  	return o
   348  }
   349  
   350  func (o ConnectMapOutput) MapIndex(k pulumi.StringInput) ConnectOutput {
   351  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Connect {
   352  		return vs[0].(map[string]*Connect)[vs[1].(string)]
   353  	}).(ConnectOutput)
   354  }
   355  
   356  func init() {
   357  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectInput)(nil)).Elem(), &Connect{})
   358  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectArrayInput)(nil)).Elem(), ConnectArray{})
   359  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectMapInput)(nil)).Elem(), ConnectMap{})
   360  	pulumi.RegisterOutputType(ConnectOutput{})
   361  	pulumi.RegisterOutputType(ConnectArrayOutput{})
   362  	pulumi.RegisterOutputType(ConnectMapOutput{})
   363  }