github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/routeTableAssociation.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 Route Table association.
    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  //			_, err := ec2transitgateway.NewRouteTableAssociation(ctx, "example", &ec2transitgateway.RouteTableAssociationArgs{
    33  //				TransitGatewayAttachmentId: pulumi.Any(exampleAwsEc2TransitGatewayVpcAttachment.Id),
    34  //				TransitGatewayRouteTableId: pulumi.Any(exampleAwsEc2TransitGatewayRouteTable.Id),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import `aws_ec2_transit_gateway_route_table_association` using the EC2 Transit Gateway Route Table identifier, an underscore, and the EC2 Transit Gateway Attachment identifier. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:ec2transitgateway/routeTableAssociation:RouteTableAssociation example tgw-rtb-12345678_tgw-attach-87654321
    52  // ```
    53  type RouteTableAssociation struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
    57  	ReplaceExistingAssociation pulumi.BoolPtrOutput `pulumi:"replaceExistingAssociation"`
    58  	// Identifier of the resource
    59  	ResourceId pulumi.StringOutput `pulumi:"resourceId"`
    60  	// Type of the resource
    61  	ResourceType pulumi.StringOutput `pulumi:"resourceType"`
    62  	// Identifier of EC2 Transit Gateway Attachment.
    63  	TransitGatewayAttachmentId pulumi.StringOutput `pulumi:"transitGatewayAttachmentId"`
    64  	// Identifier of EC2 Transit Gateway Route Table.
    65  	TransitGatewayRouteTableId pulumi.StringOutput `pulumi:"transitGatewayRouteTableId"`
    66  }
    67  
    68  // NewRouteTableAssociation registers a new resource with the given unique name, arguments, and options.
    69  func NewRouteTableAssociation(ctx *pulumi.Context,
    70  	name string, args *RouteTableAssociationArgs, opts ...pulumi.ResourceOption) (*RouteTableAssociation, error) {
    71  	if args == nil {
    72  		return nil, errors.New("missing one or more required arguments")
    73  	}
    74  
    75  	if args.TransitGatewayAttachmentId == nil {
    76  		return nil, errors.New("invalid value for required argument 'TransitGatewayAttachmentId'")
    77  	}
    78  	if args.TransitGatewayRouteTableId == nil {
    79  		return nil, errors.New("invalid value for required argument 'TransitGatewayRouteTableId'")
    80  	}
    81  	opts = internal.PkgResourceDefaultOpts(opts)
    82  	var resource RouteTableAssociation
    83  	err := ctx.RegisterResource("aws:ec2transitgateway/routeTableAssociation:RouteTableAssociation", name, args, &resource, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return &resource, nil
    88  }
    89  
    90  // GetRouteTableAssociation gets an existing RouteTableAssociation resource's state with the given name, ID, and optional
    91  // state properties that are used to uniquely qualify the lookup (nil if not required).
    92  func GetRouteTableAssociation(ctx *pulumi.Context,
    93  	name string, id pulumi.IDInput, state *RouteTableAssociationState, opts ...pulumi.ResourceOption) (*RouteTableAssociation, error) {
    94  	var resource RouteTableAssociation
    95  	err := ctx.ReadResource("aws:ec2transitgateway/routeTableAssociation:RouteTableAssociation", name, id, state, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // Input properties used for looking up and filtering RouteTableAssociation resources.
   103  type routeTableAssociationState struct {
   104  	// Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
   105  	ReplaceExistingAssociation *bool `pulumi:"replaceExistingAssociation"`
   106  	// Identifier of the resource
   107  	ResourceId *string `pulumi:"resourceId"`
   108  	// Type of the resource
   109  	ResourceType *string `pulumi:"resourceType"`
   110  	// Identifier of EC2 Transit Gateway Attachment.
   111  	TransitGatewayAttachmentId *string `pulumi:"transitGatewayAttachmentId"`
   112  	// Identifier of EC2 Transit Gateway Route Table.
   113  	TransitGatewayRouteTableId *string `pulumi:"transitGatewayRouteTableId"`
   114  }
   115  
   116  type RouteTableAssociationState struct {
   117  	// Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
   118  	ReplaceExistingAssociation pulumi.BoolPtrInput
   119  	// Identifier of the resource
   120  	ResourceId pulumi.StringPtrInput
   121  	// Type of the resource
   122  	ResourceType pulumi.StringPtrInput
   123  	// Identifier of EC2 Transit Gateway Attachment.
   124  	TransitGatewayAttachmentId pulumi.StringPtrInput
   125  	// Identifier of EC2 Transit Gateway Route Table.
   126  	TransitGatewayRouteTableId pulumi.StringPtrInput
   127  }
   128  
   129  func (RouteTableAssociationState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*routeTableAssociationState)(nil)).Elem()
   131  }
   132  
   133  type routeTableAssociationArgs struct {
   134  	// Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
   135  	ReplaceExistingAssociation *bool `pulumi:"replaceExistingAssociation"`
   136  	// Identifier of EC2 Transit Gateway Attachment.
   137  	TransitGatewayAttachmentId string `pulumi:"transitGatewayAttachmentId"`
   138  	// Identifier of EC2 Transit Gateway Route Table.
   139  	TransitGatewayRouteTableId string `pulumi:"transitGatewayRouteTableId"`
   140  }
   141  
   142  // The set of arguments for constructing a RouteTableAssociation resource.
   143  type RouteTableAssociationArgs struct {
   144  	// Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
   145  	ReplaceExistingAssociation pulumi.BoolPtrInput
   146  	// Identifier of EC2 Transit Gateway Attachment.
   147  	TransitGatewayAttachmentId pulumi.StringInput
   148  	// Identifier of EC2 Transit Gateway Route Table.
   149  	TransitGatewayRouteTableId pulumi.StringInput
   150  }
   151  
   152  func (RouteTableAssociationArgs) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*routeTableAssociationArgs)(nil)).Elem()
   154  }
   155  
   156  type RouteTableAssociationInput interface {
   157  	pulumi.Input
   158  
   159  	ToRouteTableAssociationOutput() RouteTableAssociationOutput
   160  	ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput
   161  }
   162  
   163  func (*RouteTableAssociation) ElementType() reflect.Type {
   164  	return reflect.TypeOf((**RouteTableAssociation)(nil)).Elem()
   165  }
   166  
   167  func (i *RouteTableAssociation) ToRouteTableAssociationOutput() RouteTableAssociationOutput {
   168  	return i.ToRouteTableAssociationOutputWithContext(context.Background())
   169  }
   170  
   171  func (i *RouteTableAssociation) ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput {
   172  	return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationOutput)
   173  }
   174  
   175  // RouteTableAssociationArrayInput is an input type that accepts RouteTableAssociationArray and RouteTableAssociationArrayOutput values.
   176  // You can construct a concrete instance of `RouteTableAssociationArrayInput` via:
   177  //
   178  //	RouteTableAssociationArray{ RouteTableAssociationArgs{...} }
   179  type RouteTableAssociationArrayInput interface {
   180  	pulumi.Input
   181  
   182  	ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput
   183  	ToRouteTableAssociationArrayOutputWithContext(context.Context) RouteTableAssociationArrayOutput
   184  }
   185  
   186  type RouteTableAssociationArray []RouteTableAssociationInput
   187  
   188  func (RouteTableAssociationArray) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*[]*RouteTableAssociation)(nil)).Elem()
   190  }
   191  
   192  func (i RouteTableAssociationArray) ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput {
   193  	return i.ToRouteTableAssociationArrayOutputWithContext(context.Background())
   194  }
   195  
   196  func (i RouteTableAssociationArray) ToRouteTableAssociationArrayOutputWithContext(ctx context.Context) RouteTableAssociationArrayOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationArrayOutput)
   198  }
   199  
   200  // RouteTableAssociationMapInput is an input type that accepts RouteTableAssociationMap and RouteTableAssociationMapOutput values.
   201  // You can construct a concrete instance of `RouteTableAssociationMapInput` via:
   202  //
   203  //	RouteTableAssociationMap{ "key": RouteTableAssociationArgs{...} }
   204  type RouteTableAssociationMapInput interface {
   205  	pulumi.Input
   206  
   207  	ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput
   208  	ToRouteTableAssociationMapOutputWithContext(context.Context) RouteTableAssociationMapOutput
   209  }
   210  
   211  type RouteTableAssociationMap map[string]RouteTableAssociationInput
   212  
   213  func (RouteTableAssociationMap) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*map[string]*RouteTableAssociation)(nil)).Elem()
   215  }
   216  
   217  func (i RouteTableAssociationMap) ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput {
   218  	return i.ToRouteTableAssociationMapOutputWithContext(context.Background())
   219  }
   220  
   221  func (i RouteTableAssociationMap) ToRouteTableAssociationMapOutputWithContext(ctx context.Context) RouteTableAssociationMapOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationMapOutput)
   223  }
   224  
   225  type RouteTableAssociationOutput struct{ *pulumi.OutputState }
   226  
   227  func (RouteTableAssociationOutput) ElementType() reflect.Type {
   228  	return reflect.TypeOf((**RouteTableAssociation)(nil)).Elem()
   229  }
   230  
   231  func (o RouteTableAssociationOutput) ToRouteTableAssociationOutput() RouteTableAssociationOutput {
   232  	return o
   233  }
   234  
   235  func (o RouteTableAssociationOutput) ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput {
   236  	return o
   237  }
   238  
   239  // Boolean whether the Gateway Attachment should remove any current Route Table association before associating with the specified Route Table. Default value: `false`. This argument is intended for use with EC2 Transit Gateways shared into the current account, otherwise the `transitGatewayDefaultRouteTableAssociation` argument of the `ec2transitgateway.VpcAttachment` resource should be used.
   240  func (o RouteTableAssociationOutput) ReplaceExistingAssociation() pulumi.BoolPtrOutput {
   241  	return o.ApplyT(func(v *RouteTableAssociation) pulumi.BoolPtrOutput { return v.ReplaceExistingAssociation }).(pulumi.BoolPtrOutput)
   242  }
   243  
   244  // Identifier of the resource
   245  func (o RouteTableAssociationOutput) ResourceId() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *RouteTableAssociation) pulumi.StringOutput { return v.ResourceId }).(pulumi.StringOutput)
   247  }
   248  
   249  // Type of the resource
   250  func (o RouteTableAssociationOutput) ResourceType() pulumi.StringOutput {
   251  	return o.ApplyT(func(v *RouteTableAssociation) pulumi.StringOutput { return v.ResourceType }).(pulumi.StringOutput)
   252  }
   253  
   254  // Identifier of EC2 Transit Gateway Attachment.
   255  func (o RouteTableAssociationOutput) TransitGatewayAttachmentId() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *RouteTableAssociation) pulumi.StringOutput { return v.TransitGatewayAttachmentId }).(pulumi.StringOutput)
   257  }
   258  
   259  // Identifier of EC2 Transit Gateway Route Table.
   260  func (o RouteTableAssociationOutput) TransitGatewayRouteTableId() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *RouteTableAssociation) pulumi.StringOutput { return v.TransitGatewayRouteTableId }).(pulumi.StringOutput)
   262  }
   263  
   264  type RouteTableAssociationArrayOutput struct{ *pulumi.OutputState }
   265  
   266  func (RouteTableAssociationArrayOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*[]*RouteTableAssociation)(nil)).Elem()
   268  }
   269  
   270  func (o RouteTableAssociationArrayOutput) ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput {
   271  	return o
   272  }
   273  
   274  func (o RouteTableAssociationArrayOutput) ToRouteTableAssociationArrayOutputWithContext(ctx context.Context) RouteTableAssociationArrayOutput {
   275  	return o
   276  }
   277  
   278  func (o RouteTableAssociationArrayOutput) Index(i pulumi.IntInput) RouteTableAssociationOutput {
   279  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RouteTableAssociation {
   280  		return vs[0].([]*RouteTableAssociation)[vs[1].(int)]
   281  	}).(RouteTableAssociationOutput)
   282  }
   283  
   284  type RouteTableAssociationMapOutput struct{ *pulumi.OutputState }
   285  
   286  func (RouteTableAssociationMapOutput) ElementType() reflect.Type {
   287  	return reflect.TypeOf((*map[string]*RouteTableAssociation)(nil)).Elem()
   288  }
   289  
   290  func (o RouteTableAssociationMapOutput) ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput {
   291  	return o
   292  }
   293  
   294  func (o RouteTableAssociationMapOutput) ToRouteTableAssociationMapOutputWithContext(ctx context.Context) RouteTableAssociationMapOutput {
   295  	return o
   296  }
   297  
   298  func (o RouteTableAssociationMapOutput) MapIndex(k pulumi.StringInput) RouteTableAssociationOutput {
   299  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RouteTableAssociation {
   300  		return vs[0].(map[string]*RouteTableAssociation)[vs[1].(string)]
   301  	}).(RouteTableAssociationOutput)
   302  }
   303  
   304  func init() {
   305  	pulumi.RegisterInputType(reflect.TypeOf((*RouteTableAssociationInput)(nil)).Elem(), &RouteTableAssociation{})
   306  	pulumi.RegisterInputType(reflect.TypeOf((*RouteTableAssociationArrayInput)(nil)).Elem(), RouteTableAssociationArray{})
   307  	pulumi.RegisterInputType(reflect.TypeOf((*RouteTableAssociationMapInput)(nil)).Elem(), RouteTableAssociationMap{})
   308  	pulumi.RegisterOutputType(RouteTableAssociationOutput{})
   309  	pulumi.RegisterOutputType(RouteTableAssociationArrayOutput{})
   310  	pulumi.RegisterOutputType(RouteTableAssociationMapOutput{})
   311  }