IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
341 stars 669 forks source link

ibm_tg_connection fails saying connection already added on a new transit gateway #5482

Open prb112 opened 4 months ago

prb112 commented 4 months ago

Community Note

Terraform CLI and Terraform IBM Provider Version

ibm_tg_connection fails saying connection already added on a new transit gateway

Terraform v1.5.5

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Ref: https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/tg_gateway
resource "ibm_tg_gateway" "mac_tg_gw" {
  name           = "${var.vpc_name}-tg"
  location       = var.vpc_region
  global         = false
  resource_group = var.resource_group
}

# Ref: https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/tg_connection
resource "ibm_tg_connection" "vpc_tg_connection" {
  depends_on = [ibm_tg_gateway.mac_tg_gw]

  gateway      = ibm_tg_gateway.mac_tg_gw.id
  network_type = "vpc"
  name         = "${var.vpc_name}-vpc-conn"
  network_id   = var.resource_crn
}

Debug Output

module.vpc_support.module.transit_gateway[0].ibm_resource_tag.tag: Creation complete after 4s [id=crn:v1:bluemix:public:transit:us-east:a/3c24cb272ca44aa1ac9f6e9490ac5ecd::gateway:abdd0781-6c87-45f9-8a42-c0aab192c872] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [10s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [20s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [30s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [40s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [50s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [1m0s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [1m10s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [1m20s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [1m30s elapsed] module.vpc_support.module.transit_gateway[0].ibm_tg_connection.vpc_tg_connection: Still creating... [1m40s elapsed] Error: [ERROR] Create Transit Gateway connection err The requested network is already connected to an existing transit gateway.

Panic Output

n/a

Expected Behavior

201 should have been detected and succeeded. Or should have passed successfully.

Actual Behavior

Error: [ERROR] Create Transit Gateway connection err The requested network is already connected to an existing transit gateway.
{
    "StatusCode": 409,
    "Headers": {
        "Cache-Control": [
            "no-cache,no-store,must-revalidate"
        ],
        "Cf-Cache-Status": [
            "DYNAMIC"
        ],
        "Cf-Ray": [
            "89cceaf62ffc452c-ATL"
        ],
        "Content-Length": [
            "246"
        ],
        "Content-Type": [
            "application/json; charset=utf-8"
        ],
        "Date": [
            "Tue, 02 Jul 2024 07:28:19 GMT"
        ],
        "Server": [
            "cloudflare"
        ],
        "Strict-Transport-Security": [
            "max-age=31536000; includeSubDomains; preload"
        ],
        "Transaction-Id": [
            "xxxxx-6ade-4260-9806-xxxxxxxx"
        ],
        "X-Content-Type-Options": [
            "nosniff"
        ],
        "X-Correlation-Id": [
            "xxxxxxx-6ade-4260-xxxxxx-0c75a3ec7454"
        ],
        "X-Envoy-Upstream-Service-Time": [
            "5817"
        ],
        "X-Frame-Options": [
            "DENY"
        ],
        "X-Request-Id": [
            "99d854dd-5b1f-45e1-8728-9c832e68f946"
        ],
        "X-Xss-Protection": [
            "1; mode=block"
        ]
    },
    "Result": {
        "errors": [
            {
                "code": "invalid_state",
                "message": "The requested network is already connected to an existing transit gateway.",
                "more_info": "https://cloud.ibm.com/apidocs/transit-gateway#error-handling"
            }
        ],
        "trace": "ab9497a8-6ade-4260-9806-0c75a3ec7454"
    },
    "RawResult": null
}

Steps to Reproduce

  1. terraform apply You may have to do this a number of times in parallel in the same account.

Important Factoids

n/a

References

n/a

ocofaigh commented 1 day ago

I'm seeing the same issue intermittently:

2024/11/15 07:59:14 Terraform apply | ---
 2024/11/15 07:59:14 Terraform apply | id: terraform-d1fb7541
 2024/11/15 07:59:14 Terraform apply | summary: |
 2024/11/15 07:59:14 Terraform apply |   [ERROR] Create Transit Gateway connection err The requested network is already connected to an existing transit gateway.
 2024/11/15 07:59:14 Terraform apply |   {
 2024/11/15 07:59:14 Terraform apply |       "StatusCode": 409,
 2024/11/15 07:59:14 Terraform apply |       "Headers": {
 2024/11/15 07:59:14 Terraform apply |           "Cache-Control": [
 2024/11/15 07:59:14 Terraform apply |               "no-cache,no-store,must-revalidate"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Cf-Cache-Status": [
 2024/11/15 07:59:14 Terraform apply |               "DYNAMIC"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Cf-Ray": [
 2024/11/15 07:59:14 Terraform apply |               "8e2d729acf00c953-IAD"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Content-Length": [
 2024/11/15 07:59:14 Terraform apply |               "246"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Content-Type": [
 2024/11/15 07:59:14 Terraform apply |               "application/json; charset=utf-8"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Date": [
 2024/11/15 07:59:14 Terraform apply |               "Fri, 15 Nov 2024 07:15:56 GMT"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Server": [
 2024/11/15 07:59:14 Terraform apply |               "cloudflare"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Strict-Transport-Security": [
 2024/11/15 07:59:14 Terraform apply |               "max-age=31536000; includeSubDomains; preload"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "Transaction-Id": [
 2024/11/15 07:59:14 Terraform apply |               "ab466667-c63c-4a6f-bb4e-efb94ba1703d"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Content-Type-Options": [
 2024/11/15 07:59:14 Terraform apply |               "nosniff"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Correlation-Id": [
 2024/11/15 07:59:14 Terraform apply |               "ab466667-c63c-4a6f-bb4e-efb94ba1703d"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Envoy-Upstream-Service-Time": [
 2024/11/15 07:59:14 Terraform apply |               "55453"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Frame-Options": [
 2024/11/15 07:59:14 Terraform apply |               "DENY"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Request-Id": [
 2024/11/15 07:59:14 Terraform apply |               "b5e9ec51-46a7-4d77-be06-ae28175a3ce2"
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "X-Xss-Protection": [
 2024/11/15 07:59:14 Terraform apply |               "1; mode=block"
 2024/11/15 07:59:14 Terraform apply |           ]
 2024/11/15 07:59:14 Terraform apply |       },
 2024/11/15 07:59:14 Terraform apply |       "Result": {
 2024/11/15 07:59:14 Terraform apply |           "errors": [
 2024/11/15 07:59:14 Terraform apply |               {
 2024/11/15 07:59:14 Terraform apply |                   "code": "invalid_state",
 2024/11/15 07:59:14 Terraform apply |                   "message": "The requested network is already connected to an existing transit gateway.",
 2024/11/15 07:59:14 Terraform apply |                   "more_info": "https://cloud.ibm.com/apidocs/transit-gateway#error-handling"
 2024/11/15 07:59:14 Terraform apply |               }
 2024/11/15 07:59:14 Terraform apply |           ],
 2024/11/15 07:59:14 Terraform apply |           "trace": "ab466667-c63c-4a6f-bb4e-efb94ba1703d"
 2024/11/15 07:59:14 Terraform apply |       },
 2024/11/15 07:59:14 Terraform apply |       "RawResult": null
 2024/11/15 07:59:14 Terraform apply |   }
 2024/11/15 07:59:14 Terraform apply | severity: error
 2024/11/15 07:59:14 Terraform apply | resource: ibm_tg_connection
 2024/11/15 07:59:14 Terraform apply | operation: create
 2024/11/15 07:59:14 Terraform apply | component:
 2024/11/15 07:59:14 Terraform apply |   name: github.com/IBM-Cloud/terraform-provider-ibm
 2024/11/15 07:59:14 Terraform apply |   version: 1.71.1
 2024/11/15 07:59:14 Terraform apply | ---

@Sushmitha are you able to help here please?