IBM-Cloud / terraform-provider-ibm

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

PowerVS Port Attachment Issue. #5470

Open maulikcapg opened 5 days ago

maulikcapg commented 5 days ago

Community Note

Terraform CLI and Terraform IBM Provider Version

IBM : 1.65.1

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.

resource "ibm_pi_network_port_attach" "port_attach_reserve" {
  count      = length(local.reserve_ips) > 0 ? length(local.reserve_ips) : 0

  pi_cloud_instance_id      = var.powervs_workspace_guid                          // workspace guid
  pi_instance_id            = local.reserve_ips[count.index].pvm_instance_id   // pvm_instance_id
  pi_network_name           = local.reserve_ips[count.index].name               // network name
  pi_network_port_ipaddress = local.reserve_ips[count.index].ip               // ip address from the network cidr
}

Debug Output

IBM Schemetic workspace logs:

 2024/06/24 20:10:31 Terraform apply | Error: failed to Get PI Network Port 06d6ce7f-7b6b-4a7b-8bde-48bac3924dae for Network reserve_network_1: [GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][404] pcloudNetworksPortsGetNotFound  &{Code:0 Description:network does not exist. Check the details and try again or contact support for help, id: 7cc54728-b892-4f2b-8812-cdc26dc4cfb9 Error:network not found Message:}
 2024/06/24 20:10:31 Terraform apply | 
 2024/06/24 20:10:31 Terraform apply |   with module.site1_powervs_instance.ibm_pi_network_port_attach.port_attach_reserve[0],
 2024/06/24 20:10:31 Terraform apply |   on ../../modules/powervs-instance-custom/main.tf line 305, in resource "ibm_pi_network_port_attach" "port_attach_reserve":
 2024/06/24 20:10:31 Terraform apply |  305: resource "ibm_pi_network_port_attach" "port_attach_reserve" {
 2024/06/24 20:10:31 Terraform apply | 
 2024/06/24 20:10:31 Terraform APPLY error: Terraform APPLY errorexit status 1

Panic Output

Expected Behavior

Network is already there so we should not get the error like network does not exist at the time of port attachment.

Actual Behavior

Network is already there and port also get attached but terraform is giving error like network does not exist at the time of port attachment . This issue is intermittent, but we are getting this issue often.

IBM catalog schematic workspace logs:

 2024/06/24 20:10:31 Terraform apply | Error: failed to Get PI Network Port 06d6ce7f-7b6b-4a7b-8bde-48bac3924dae for Network reserve_network_1: [GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][404] pcloudNetworksPortsGetNotFound  &{Code:0 Description:network does not exist. Check the details and try again or contact support for help, id: 7cc54728-b892-4f2b-8812-cdc26dc4cfb9 Error:network not found Message:}
 2024/06/24 20:10:31 Terraform apply | 
 2024/06/24 20:10:31 Terraform apply |   with module.site1_powervs_instance.ibm_pi_network_port_attach.port_attach_reserve[0],
 2024/06/24 20:10:31 Terraform apply |   on ../../modules/powervs-instance-custom/main.tf line 305, in resource "ibm_pi_network_port_attach" "port_attach_reserve":
 2024/06/24 20:10:31 Terraform apply |  305: resource "ibm_pi_network_port_attach" "port_attach_reserve" {
 2024/06/24 20:10:31 Terraform apply | 
 2024/06/24 20:10:31 Terraform APPLY error: Terraform APPLY errorexit status 1

Here port is being attached but we are getting this error through the powervs port attachment resource.

Steps to Reproduce

Important Factoids

References