Skip to content

SECKSD-37186 akamai_appsec_rule fails with strconv.Atoi error when security_policy_id contains underscores #730

@fcelas

Description

@fcelas

Terraform Version
v1.13.0

Affected Resource(s)

  • akamai_appsec_rule

Terraform Configuration Files

resource "akamai_appsec_rule" "example_rule" {
  config_id          = 98672
  security_policy_id = "2_251403" -> The issue happens because the policy ID contains an underscore
  rule_id            = 3000403
  rule_action        = "alert"
}

Debug Output / Error Message

module.security.akamai_appsec_rule.example_rule: Refreshing state... [id=98672:3000403:2_251403]
╷
│ Error: strconv.Atoi: parsing "2_251403": invalid syntax
│
╵

Expected Behavior
The provider should treat security_policy_id as a string, accepting alphanumeric values or values containing underscores (e.g., 2_251403, hmgo_283918), which are standard formats for Security Policy IDs in Akamai.

Other resources like akamai_appsec_ip_geo or akamai_appsec_waf_protection handle these IDs correctly, but akamai_appsec_rule seems to force an Integer conversion.

Actual Behavior
The execution fails during terraform plan or terraform import. The error strconv.Atoi: parsing "2_251403": invalid syntax indicates that the provider code is attempting to convert the string ID into an integer using Go's strconv.Atoi function, which fails due to the non-numeric character (_).

Steps to Reproduce

  1. Configure an akamai_appsec_rule resource.
  2. Set the security_policy_id to a valid Akamai Policy ID that contains an underscore (e.g., 2_251403).
  3. Run terraform plan.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions