Terraform failure during image tag change

Hi, we are trying to change image tag for existing container via Terraform. The tag changes in some containers, but then we get an error:

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.agent-api.qovery_container.container, provider "provider[\"registry.terraform.io/qovery/qovery\"]" produced an unexpected new value:
│ .built_in_environment_variables: planned set element cty.ObjectVal(map[string]cty.Value{"description":cty.StringVal("Container tag"),
│ "id":cty.StringVal("b000758d-9bf4-4619-aa87-ded8eae44f46"), "key":cty.StringVal("QOVERY_CONTAINER_Z2EFB9B9F_TAG"), "value":cty.StringVal("PR--8aa0dd0f")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Can this be fixed?

Hello @km1414,

I’m checking

Do you have other cases ?
According to what I see, you can upgrade to the latest version of our provider and everything should work.

Just tried again, provider version is already latest:

    qovery = {
      source  = "qovery/qovery"
      version = "0.37.0"
    }
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.agent-api.qovery_container.container, provider "provider[\"registry.terraform.io/qovery/qovery\"]" produced an unexpected new value:
│ .built_in_environment_variables: planned set element cty.ObjectVal(map[string]cty.Value{"description":cty.StringVal("Container tag"),
│ "id":cty.StringVal("12a5eec3-745f-4d63-854c-b6fb7c404f8d"), "key":cty.StringVal("QOVERY_CONTAINER_Z0102F164_TAG"), "value":cty.StringVal("PR--fa186375")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.agent-api-cron.qovery_container.container, provider "provider[\"registry.terraform.io/qovery/qovery\"]" produced an unexpected new value:
│ .built_in_environment_variables: planned set element cty.ObjectVal(map[string]cty.Value{"description":cty.StringVal("Container tag"),
│ "id":cty.StringVal("93af682c-78dd-4a0b-8345-5426d7a42174"), "key":cty.StringVal("QOVERY_CONTAINER_ZBF005843_TAG"), "value":cty.StringVal("PR--fa186375")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Do you apply terraform with some specific options ?
Can you share your terraform client version ?

Currently we use Terraform “1.7.5”. No specific options, just terraform apply "plan".

Updated Terraform version to latest “1.9.3”, result still the same:

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.agent-api-cron.qovery_container.container, provider "provider[\"registry.terraform.io/qovery/qovery\"]" produced an unexpected new value:
│ .built_in_environment_variables: planned set element cty.ObjectVal(map[string]cty.Value{"description":cty.StringVal("Container tag"),
│ "id":cty.StringVal("93af682c-78dd-4a0b-8345-5426d7a42174"), "key":cty.StringVal("QOVERY_CONTAINER_ZBF005843_TAG"), "value":cty.StringVal("PR--790cbc03")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.agent-api.qovery_container.container, provider "provider[\"registry.terraform.io/qovery/qovery\"]" produced an unexpected new value:
│ .built_in_environment_variables: planned set element cty.ObjectVal(map[string]cty.Value{"description":cty.StringVal("Container tag"),
│ "id":cty.StringVal("12a5eec3-745f-4d63-854c-b6fb7c404f8d"), "key":cty.StringVal("QOVERY_CONTAINER_Z0102F164_TAG"), "value":cty.StringVal("PR--790cbc03")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Hello @km1414,

I’m still struggling to reproduce your issue on my side.
Do you use some particular options when you generate the plan that you then use for your terraform apply ?

Could you share me in private message the terraform files you’re using ?

Ok, I could share more details later. Just a quick idea - maybe it could be somehow related to the fact, that image tags are not recognized by Qovery (but still works when starting service)?

We use Scaleway registry as discussed here: Default container registry for Scaleway cluster - #8 by Melvin_Zottola

It should have no impact, the warning No tag found you have here in the console is linked to an issue on our side concerning the way we are retrieving the tags from a scaleway registry (it’s only a display issue). We are going to fix it soon.

For the original issue, I have on my side the same terraform message as yours displayed in WARNING only during terraform plan. But not on the terraform apply

To write a conclusion following our private messages, the issue came from a configuration impacting the built in environment variables:

lifecycle {
   ignore_changes = [built_in_environment_variables]
   }

This cannot be used as the built_in_environment_variables can contain changes (e.g when you change your container tag).

Today, terraform displays by default in the plan every element inside the built_in_environment_variables: this is a behavior already reported on terraform side

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.