IBM-Cloud / terraform-provider-ibm

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

Migrate older "ibm_is_instance" to latest with reserved_ip ( [ERROR] Error getting network interface reserved ip ) #3765

Open wosteven opened 2 years ago

wosteven commented 2 years ago

Community Note

Terraform CLI and Terraform IBM Provider Version

terraform --version

Terraform v0.15.0 on linux_amd64 provider registry.terraform.io/ibm-cloud/ibm v1.41.0

Affected Resource(s)

ibm_is_instance

Terraform Configuration Files

Created some VSIs time ago like this ( using primary_ipv4_address to assign a specific IP )

resource "ibm_is_instance" "nat_vsi_instance" {
  for_each = local.vsi_instances

  ...
  primary_network_interface {
    subnet               = each.value.subnet.id
    security_groups      = [ibm_is_security_group.nat_vsi_sg.id]
    primary_ipv4_address = each.value.primary_ip
    allow_ip_spoofing    = false
  }

  tags = var.tags
 ...

Debug Output

with new tf provider TF fails with

ibm_is_instance.es_client_vsi_instance: Refreshing state... [id=02d7_ddffd835-c787-4fe7-a238-a1aad14f9d2c] ibm_is_instance.nat_vsi_instance["vsi2"]: Refreshing state... [id=02d7_d503aaa9-c387-4a53-bf1a-f2481b2c22f7] ibm_is_instance.nat_vsi_instance["vsi1"]: Refreshing state... [id=02c7_23a14e32-87c3-423e-af30-ac03400b060c] ibm_is_instance.nat_vsi_instance["vsi0"]: Refreshing state... [id=02c7_efd248ff-792f-4644-ab38-bf7c4ca43d86] ╷ │ Error: [ERROR] Error getting network interface reserved ip(02c7-1e014c11-30b0-4b32-a9f8-243b11145a86) attached to the instance network interface(02c7-ff1cab15-4556-4a67-85be-bd70c258000d): internal error has occurred │ { │ "StatusCode": 500, │ "Headers": { │ "Cache-Control": [ │ "max-age=0, no-cache, no-store, must-revalidate" │ ], │ "Cf-Cache-Status": [ │ "DYNAMIC" │ ], │ "Cf-Ray": [ │ "70924349a92f9088-FRA" │ ], │ "Content-Length": [ │ "125" │ ], │ "Content-Type": [ │ "application/json" │ ], │ "Date": [ │ "Tue, 10 May 2022 11:16:27 GMT" │ ], │ "Expect-Ct": [ │ "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" │ ], │ "Expires": [ │ "-1" │ ], │ "Pragma": [ │ "no-cache" │ ], │ "Server": [ │ "cloudflare" │ ], │ "Strict-Transport-Security": [ │ "max-age=31536000; includeSubDomains" │ ], │ "Vary": [ │ "Accept-Encoding" │ ], │ "X-Content-Type-Options": [ │ "nosniff" │ ], │ "X-Request-Id": [ │ "fb3085d3-c0b8-4021-8fa3-b995d09add27" │ ], │ "X-Xss-Protection": [ │ "1; mode=block" │ ] │ }, │ "Result": { │ "errors": [ │ { │ "code": "internal_error", │ "message": "internal error has occurred" │ } │ ], │ "trace": "fb3085d3-c0b8-4021-8fa3-b995d09add27" │ }, │ "RawResult": null │ }

Panic Output

Expected Behavior

works (automatically migrated to "new primary_ip/reserved_ip" - or directions provided on how to migrate existing infrastructure from new to old IBM provider)

Actual Behavior

terraform plan fails with Error Code 500:

  "StatusCode": 500,
  "code": "internal_error",
  "message": "internal error has occurred"```

Steps to Reproduce

Important Factoids

References

wosteven commented 2 years ago

Update: we also found that listing reserved IPs on specific subnets fails in general, independently from TF (so also fails in UI and also on CLI, but only on specific subnets). We opened a Cloud Case to let support check this.

I'll keep this updated ... maybe it's not a specific TF provider error/bug - but something in the backend.