Skip to content

Terraform provider creates PUT request for updating TGW Attachment with regionId and TgwId swapped #695

@markotrapani

Description

@markotrapani

When we try to update an existing TGW Attachment's CIDR with the following TF script:

# Here is the attachment information for the new one.

resource "rediscloud_active_active_transit_gateway_attachment" "this" {
   attachment_status = "available"
   attachment_uid    = "<attachment_uid>"
   aws_account_id    = "<account_id>"
   aws_tgw_uid       = "<tgw_uid>"
   cidrs             = [
       "192.168.64.0/18",
       "10.15.0.0/16",
   ]
   id                = "<sub_id>/616"
   region_id         = "37"
   status            = "available"
   subscription_id   = "<sub_id>"
   tgw_id            = 616
}

However, the API request sent by TF looked like...

PUT /v1/subscriptions/2972099/regions/616/transitGateways/37/attachment

... when it should have been:

/v1/subscriptions/2972099/regions/37/transitGateways/616/attachment

Relevant Terraform Provider code: Code file

Line 185 is currently...

err = api.Client.TransitGatewayAttachments.UpdateActiveActive(ctx, subId, tgwId, regionId, cidrs)

...but should have regionId and tgwId swapped from their current positions...

err = api.Client.TransitGatewayAttachments.UpdateActiveActive(ctx, subId, regionId, tgwId, cidrs)

... to ensure the PUT request is constructed correctly:

/v1/subscriptions/{subscriptionId}/regions/{regionId}/transitGateways/{TgwId}/attachment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions