Content provider code wants to be updated to new product code ID (prd_Fresca to prd_SPM)
jgdev522 opened this issue · comments
Hi there,
I am having an issue after I have properties created. They have been managed with Terraform for several months now. None of the code listed below has changed and I have been building properties with this code since implementing with base_property module and product code default has always been prd_SPM. Today I ran a Terraform apply and was told that the product code id changed and Terraform needed to update it. Obviously this failed because the cp code is immutable. I am now blocked from making any changes. Right now I have 11 different properties that want to changes the product code back to prod_SPM.
source = "hashicorp/aws"
version = "~> 5.20.0"
}
akamai = {
source = "akamai/akamai"
version = "~> 5.5.0"
}
}
required_version = ">= 1.4"
Affected Resource(s)
- ION_Premier
- property_manager
Terraform Configuration Files
Module/base_property/cp-code.tf -
resource "akamai_cp_code" "this" {
name = var.domain_name
contract_id = data.akamai_contract.this.id
group_id = data.akamai_group.this.id
product_id = var.product_id
}
Module/base_property/vars.tf -
variable "product_id" {
type = string
default = "prd_SPM"
Module/base_property/property.tf -
resource "akamai_property" "this" {
depends_on = [akamai_edge_hostname.this]
name = "${var.domain_name}-${var.env_name}"
product_id = var.product_id
contract_id = data.akamai_contract.this.id
group_id = data.akamai_group.this.id
rule_format = var.rule_format
rules = var.rule_json
dynamic "hostnames" {
for_each = local.true_edge_hostnames
content {
cname_from = replace(trimsuffix(hostnames.key, ".${var.domain_suffix}"), "/-v[0-9]/", "")
cname_to = hostnames.key
cert_provisioning_type = var.cert_type
=================================================================
January 22nd 2024 14:27:49
Error: cp code attribute 'product_id' cannot be changed after creation (immutable)
with module.prp-default["admin"].module.base_property.akamai_cp_code.this,
on modules/base-property/cp-code.tf line 1, in resource "akamai_cp_code" "this":
1: resource "akamai_cp_code" "this" {
Expected Behavior
Expected behavior would be for the product_id to not be modified. All of my properties were built with product code SPM as default value.
Actual Behavior
It is trying to change the product id from prd_fresca back to to prd_spm which is what is in the state file and how the code executes
This is the Terraform plan output for the cpcode changes for 11 of my properties
module.prp-xxxx["xxx-xxx-xx"].module.base_property.akamai_cp_code.this will be updated in-place
Info
~ resource "akamai_cp_code" "this" {
Info
id = "1234567"
Info
name = "xxx-xxx-xx.xxxx.xxxxxxxxxxx.com"
Info
~ product_id = "prd_Fresca" -> "prd_SPM"
Info
# (2 unchanged attributes hidden)
Plan: 0 to add, 11 to change, 0 to destroy.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- terraform plan
- terraform apply
Important Factoids
CPCodes are listed as both in Akamai CLI
command:
akamai pm lcp -c x-xxxxxx -g grp_xxxxx | grep fresca
output:
│"cpc_xxxxxxx"│"xx.xxx.xxx.com" │"prd_Fresca, prd_SPM" │"2022-10-12T15:47:34Z"│
added property.tf code
When looking in the cli some product coes are listed as "prd_SPM, prd_Fresca"
and others are listed as "prd_Fresca, prd_SPM" . Originally when the properties were created they were all listed as "prd_SPM" only with no "prd_fresca". As I mentioned in the issue I have 11 properties stating the need to change the product ID code. I have other properties that are not stating this in the TF plan. It seems the properties that have "prd_SPM", "prd_fresca"
first in the list are fine. It is only the properties that have "prd_fresca", "prd_SPM" that are asking to be changed.