IBM-Cloud / terraform-provider-ibm

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

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

Open prb112 opened 3 days ago

prb112 commented 3 days 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