IBM-Cloud / terraform-provider-ibm

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

`ibm_is_instance`: Unable to upgrade to 1.39+ #3619

Closed lra closed 2 years ago

lra commented 2 years ago

Community Note

Terraform CLI and Terraform IBM Provider Version

Terraform v1.1.6
on linux_amd64
+ provider registry.terraform.io/ibm-cloud/ibm v1.39.0

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_is_instance" "sdm_gateways" {
  name           = "something"
  vpc            = ibm_is_vpc.this.id
  zone           = var.availability_zone
  image          = data.ibm_is_image.this.id
  keys           = [ibm_is_ssh_key.sdm_gateways.id]
  profile        = "cx2-2x4"
  resource_group = var.resource_group_id

  primary_network_interface {
    subnet          = ibm_is_subnet.public.id
    security_groups = [ibm_is_security_group.sdm_gateways.id]
  }
}

Expected Behavior

Under ibm-cloud/ibm v1.38.2, we get a clean terraform plan. When we upgrade to ibm-cloud/ibm v1.39.0, we should also have a clean terraform plan.

Actual Behavior

The IBM provider v1.39 wants to recreate our ibm_is_instance instances:

# module.strongdm_gateway_ibm_seismic_us_south.ibm_is_instance.sdm_gateways[0] must be replaced
-/+ resource "ibm_is_instance" "sdm_gateways" {
      ~ bandwidth                         = 4000 -> (known after apply)
      ~ crn                               = "crn:v1:bluemix:public:is:us-south-1:a/REDACTED::instance:REDACTED" -> (known after apply)
      + default_trusted_profile_auto_link = true # forces replacement
      ~ disks                             = [] -> (known after apply)
      ~ gpu                               = [] -> (known after apply)
      ~ id                                = "instance:REDACTED" -> (known after apply)
      ~ memory                            = 4 -> (known after apply)
      ~ metadata_service_enabled          = false -> (known after apply)
        name                              = "instance:REDACTED"
      ~ placement_target                  = [] -> (known after apply)
      ~ resource_controller_url           = "https://cloud.ibm.com/vpc-ext/compute/vs" -> (known after apply)
      ~ resource_crn                      = "crn:v1:bluemix:public:is:us-south-1:a/instance:REDACTED::instance:instance:REDACTED" -> (known after apply)
      ~ resource_group_name               = "instance:REDACTED" -> (known after apply)
      ~ resource_name                     = "instance:REDACTED" -> (known after apply)
      ~ resource_status                   = "running" -> (known after apply)
      ~ status                            = "running" -> (known after apply)
      ~ status_reasons                    = [] -> (known after apply)
      ~ tags                              = [] -> (known after apply)
      ~ total_network_bandwidth           = 3000 -> (known after apply)
      ~ total_volume_bandwidth            = 1000 -> (known after apply)
      ~ vcpu                              = [
          - {
              - architecture = "amd64"
              - count        = 2
            },
        ] -> (known after apply)
      ~ volume_attachments                = [
          - {
              - id          = "instance:REDACTED"
              - name        = "instance:REDACTED"
              - volume_crn  = "crn:v1:bluemix:public:is:us-south-1:a/instance:REDACTED::volume:instance:REDACTED"
              - volume_id   = "instance:REDACTED"
              - volume_name = "einstance:REDACTED"
            },
        ] -> (known after apply)
        # (8 unchanged attributes hidden)

The important part is: + default_trusted_profile_auto_link = true # forces replacement

Steps to Reproduce

  1. Create a ibm_is_instance resource with ibm-cloud/ibm v1.38.2 without setting default_trusted_profile_auto_link.
  2. Upgrade to ibm-cloud/ibm v1.39.0
  3. Terraform wants to replace the instance
deepaksibm commented 2 years ago

We have identified the issue and are working on it. as a workaround please use the below lifecycle argument

lifecycle {    ignore_changes = [  

        # Ignore changes to default_trusted_profile_auto_link, e.g.  to avoid force_new
          default_trusted_profile_auto_link,    ]  }
}
muchafel commented 2 years ago

same issue here... we were not careful enough which caused vsi recreation :(

lra commented 2 years ago

Fix confirmed in https://github.com/IBM-Cloud/terraform-provider-ibm/releases/tag/v1.39.1