FlexibleEngineCloud / terraform-provider-flexibleengine

Terraform flexibleengine provider
https://www.terraform.io/docs/providers/flexibleengine/
Mozilla Public License 2.0
30 stars 53 forks source link

flexibleengine_cce_addon_v3: autoscaler status change breaks indempotency #650

Closed q-b closed 2 years ago

q-b commented 3 years ago

Hi,

I applied the autoscaler addon using v1.25.0 of the provider. The terraform run was successful:

...
flexibleengine_cce_addon_v3.addons["autoscaler"]: Creation complete after 1m23s [id=a6fd3...1b2d]
flexibleengine_cce_addon_v3.addons["metrics-server"]: Creation complete after 1m23s [id=a6f4...1f31]

Apply complete! Resources: 2 added, 0 changed, 2 destroyed.

However, a subsequent run resulted in the following output:

Terraform detected the following changes made outside of Terraform since the last "terraform apply":

  # flexibleengine_cce_addon_v3.addons["autoscaler"] has been changed
  ~ resource "flexibleengine_cce_addon_v3" "addons" {
        id            = "a6fd3...1b2d"
      ~ status        = "available" -> "running"
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Field status could be ignored using lifecycle but I suspect it would lead to other problems. I am not sure what the proper solution would be...

ShiChangkuo commented 3 years ago

status is just a read-only field that synchronized from the cloud side. which command have you executed?

q-b commented 3 years ago

Just a plan:

$ terraform plan
...
flexibleengine_cce_addon_v3.addons["autoscaler"]: Refreshing state... [id=a6fd3...1b2d]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the last "terraform apply":

  # flexibleengine_cce_addon_v3.addons["autoscaler"] has been changed
  ~ resource "flexibleengine_cce_addon_v3" "addons" {
        id            = "a6fd3...1b2d"
      ~ status        = "available" -> "running"
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

No changes. Your infrastructure matches the configuration.

Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan.
Releasing state lock. This may take a few moments...
ShiChangkuo commented 3 years ago

It is a new feature since Terraform Version 0.15.4 https://support.hashicorp.com/hc/en-us/articles/4405950960147-New-Feature-Objects-have-changed-outside-of-Terraform-

you can execute terraform refresh to sync the state.

ShiChangkuo commented 2 years ago

I'm going to close this issue because there are no updates for 20 days. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.