terraform-provider-akamai
terraform-provider-akamai copied to clipboard
SECKSD-28884 `akamai_appsec_configuration` unable to reference `data.akamai_group.group.id`
Terraform and Akamai Terraform Provider Versions
terraform -v 1 х │ took 1m 11s │ azr-ed-efs_lmiv_kernanwendung-dev az │ at 13:27:24
Terraform v1.8.2
on darwin_arm64
+ provider registry.terraform.io/akamai/akamai v6.1.0
+ provider registry.terraform.io/hashicorp/azurerm v3.100.0
+ provider registry.terraform.io/hashicorp/random v3.6.1
+ provider registry.terraform.io/hashicorp/time v0.11.1
Affected Resource(s)
Please list the resources as a list, for example:
akamai_appsec_configurationdata.akamai_group.group.id
Expected Behavior
When using akamai_appsec_configuration we need the group_id, which should be possible to get from data.akamai_group.group.id
Actual Behavior
akamai_appsec_configuration only expects the group id to be the numerical part whereas data.akamai_group.group.id will provide the number plus prefix
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Incorrect attribute value type
│
│ on akamai-property.tf line 63, in resource "akamai_appsec_configuration" "abc":
│ 63: group_id = data.akamai_group.group.id
│ ├────────────────
│ │ data.akamai_group.group.id is "grp_123456"
│
│ Inappropriate value for attribute "group_id": a number is required.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- create a new data source
data.akamai_group.group.id - create a new
akamai_appsec_configuration - set
group_id = data.akamai_group.group.id terraform plan
Hello @alexkunde ,
Appsec documentation suggests obtaining of the group id from data.akamai_appsec_contracts_groups.contracts_groups datasource: https://techdocs.akamai.com/terraform/docs/as-ds-contracts-groups
If you would like to use data.akamai_group.group.id I would suggest parsing it: parseint(replace(data.akamai_group.group.id, "grp_", ""), 10)
Best regards, Cyryl
Hi @ckulinsk, thank you for the workaround, but wouldn't it be preferable to not have to use additional functions to implement this with the data field?
Best, Alexander