Skip to content

[Bug]: SID validation at plan time is invalidly applied to ALL policies #40639

Closed
@JacobAllenAbkes

Description

@JacobAllenAbkes

Terraform Core Version

1.7

AWS Provider Version

5.82

Affected Resource(s)

aws_iam_policy_document

Expected Behavior

We should not blanket apply plan time validation against the SID because each service may have it's own policies on allowed characters. This is a breaking change.

Actual Behavior

We blanket apply the plan time validation against the SID.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_kms_key" "name" {
  description         = "something"
  policy              = data.aws_iam_policy_document.name.json
}


data "aws_iam_policy_document" "name" {
  version                 = "2012-10-17"

  statement {
    sid    = "Allow spaces"
    effect = "Allow"
    actions = [
      "kms:Decrypt"
    ]
    resources = ["*"]
  }
}

Steps to Reproduce

Create an IAM policy document resource, have the SID include spaces

Attach the policy as a KMS policy

Debug Output

│ with aws_iam_policy_document.name,
│ on file line X, in data "aws_iam_policy_document" "name":
│ line#: sid = "Allow spaces"

Panic Output

No response

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md

https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.regressionPertains to a degraded workflow resulting from an upstream patch or internal enhancement.service/iamIssues and PRs that pertain to the iam service.service/kmsIssues and PRs that pertain to the kms service.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions