Plans show `~ policy` changes for an S3 bucket policy built with `jsonencode()` because principal values flip between `"123456789012"` and `"arn:aws:iam::123456789012:root"`.
IntermediateTroubleshootingPlan Errors and Unexpected Replacements
Answer
Likely causes → AWS stores principals in normalized ARN form; your code uses a bare account ID.
Diagnose → Compare aws s3api get-bucket-policy output with your code.
Fix → Write principals in full ARN form, or build the policy with data "aws_iam_policy_document", which the provider compares semantically.
Prevent → Use policy document data sources for every IAM/S3/KMS policy.
More on Plan Errors and Unexpected Replacements
`Error: Invalid for_each argument` — `The "for_each" map includes keys derived from resource attributes that cannot be determined until apply`.Intermediate`The given "for_each" argument value is unsuitable: the "for_each" argument must be a map, or set of strings, and you have provided a value of type list of string.`Beginner`Error: Invalid for_each argument` — `Sensitive values, or values derived from sensitive values, cannot be used as for_each arguments.`Intermediate`Error: Invalid count argument` — `The "count" value depends on resource attributes that cannot be determined until apply`.Intermediate`Error: Unsupported attribute` — `This object has no argument, nested block, or exported attribute named "public_ip_address"`.Beginner`Error: Unsupported attribute` on `module.vpc.private_subnets` — `This object does not have an attribute named "private_subnets"`.Beginner