I’m testing a stack that deploys a role, policy and policy attachment, this specific test is to check whether the correct policy is assigned to the role, and therefore I am checking the “aws_iam_role” resource and the “managed_policy_arns” in that object. When deploying to any environment outside of testing and rspec, the state file is as expected and the “aws_iam_role” has an entry under “managed_policy_arns” for the policy that is also created.
When running this via rspec, it “managed_policy_arns” is an empty list/array in the state file created in the /tmp directory. I can see the policy attachment resource is created with the correct values, is there any reason why the state file is not populating as expected?
The resources are deployed as expected with the managed policy attached
Reply
thanks