Terraform not applying changes to existing IAM policy attachment in AWS despite correct configuration
I'm trying to figure out I'm reviewing some code and I recently switched to I've tried everything I can think of but I've looked through the documentation and I'm still confused about I am having an issue with Terraform where it does not seem to apply changes to an existing IAM policy attachment..... I am using Terraform version 1.2.0 and my provider version is aws = "~> 3.0". The specific resource I am trying to manage is an IAM role that should have a new policy attached, but when I run `terraform apply`, it indicates that no changes will be made. Here is the relevant snippet of my Terraform configuration: ```hcl resource "aws_iam_role" "my_role" { name = "my_role" assume_role_policy = jsonencode({ Version = "2012-10-17" Statement = [{ Effect = "Allow" Principal = { Service = "ec2.amazonaws.com" } Action = "sts:AssumeRole" }] }) } resource "aws_iam_policy" "my_policy" { name = "my_policy" policy = jsonencode({ Version = "2012-10-17" Statement = [{ Effect = "Allow" Action = "s3:ListBucket" Resource = "*" }] }) } resource "aws_iam_role_policy_attachment" "my_role_policy_attachment" { role = aws_iam_role.my_role.name policy_arn = aws_iam_policy.my_policy.arn } ``` I initially created the role and attached the policy, and now I want to add another policy attachment. However, when I modify the policy or try to add an additional attachment, Terraform states that "No changes are required". I've tried running `terraform plan` and `terraform apply` multiple times, and even added a `lifecycle` block to the `aws_iam_role_policy_attachment` to prevent it from being recreated, but nothing seems to work. How can I force Terraform to recognize that changes need to be applied to the IAM policy attachments? Is there something I might be missing in my approach? Any insight would be greatly appreciated! This is part of a larger CLI tool I'm building. I recently upgraded to Hcl 3.9. Is there a better approach? Any examples would be super helpful. Could someone point me to the right documentation? This issue appeared after updating to Hcl stable.