akamai / terraform-provider-akamai

Terraform Akamai provider
https://www.terraform.io/docs/providers/akamai/
Mozilla Public License 2.0
110 stars 98 forks source link

DXE-4439 Provider produced inconsistent final plan for .version when using version akamai_property.latest_version in activation #594

Open DhroovP opened 1 week ago

DhroovP commented 1 week ago

Seeing this bug (seems related to this) when I'm running terraform apply:

│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for
│ akamai_property_activation.prod-production[0] to
│ include new values learned so far during apply, provider
│ "registry.terraform.io/akamai/akamai" produced an invalid new value for
│ .version: was cty.NumberIntVal(33), but now cty.NumberIntVal(34).
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

This seems to happen when there are minor changes in the property, and a new version has to be created and then activated. My resource is:

resource "akamai_property_activation" prod-production" {
  count                          = var.env == "prod" ? 1 : 0
  property_id                    = akamai_property.property[count.index].id
  contact                        = var.contact
  version                        = var.activate_latest_on_production ? akamai_property.property[count.index].latest_version : akamai_property.property[count.index].production_version
  network                        = "PRODUCTION"
  note                           = "Latest version of property"
  auto_acknowledge_rule_warnings = true

  lifecycle {
    ignore_changes = [
      note,
    ]
  }
}

Terraform and Akamai Terraform Provider Versions

Initializing provider plugins...

Affected Resource(s)

Expected Behavior

Latest version should have been activated in production.

Actual Behavior

Inconsistent final plan error.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply with extra arguments: -var activate_latest_on_staging=false -var activate_latest_on_production=true with minor changes in the property itself (along with the version logic in the akamai_property_activation resource above)
DhroovP commented 6 days ago

Quick update, I reverted to 6.3.0 and did not face this error. Hope that helps to pin down where this issue is coming from.

lsadlon commented 6 days ago

Hi @DhroovP

Thanks for reporting it. We are looking into that. Could you also tell us what other resource are you using in your configuration? Are you using akamai_property_rules_builder or json based rules?

BR, Lukasz

DhroovP commented 6 days ago

Hi @lsadlon

I am using the akamai_property_rules_template resource with JSON files. Let me know if I can provide any other information.

Thanks, DhroovP

glenthomas commented 6 days ago

I will delete my previous comment. My configuration was different on plan and apply 🤦‍♂️

chouraamine commented 4 days ago

Hi @DhroovP ,

instead of :

akamai_property.property[count.index].latest_version

You can use :

sum([akamai_property.property[count.index].production_version,1])

There is an issue with .latest_version ...

chouraamine commented 4 days ago

Hi @lsadlon,

Do we know why the production_version and staging_version values in the Tfstate are not the same as the latest_version? Please see the screenshot for reference.

image

Note : that both staging & production are activated on the latest version (so they should be equal to 1)

Regards,

lsadlon commented 4 days ago

Hi @chouraamine

I created internal ticket to investigate this issue. We will come back after we investigation.

BR, Lukasz