Failure to detect drift in aws_iam_instance_profile resource #7160
Labels
bug
Addresses a defect in current functionality.
service/iam
Issues and PRs that pertain to the iam service.
Milestone
This issue was originally opened by @milh0use as hashicorp/terraform#20023. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
0.11.11 (provider.aws 1.52.0)
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
I've read the excellent article on drift, but we've hit a situation where terraform-managed infrastructure was modified in the AWS console and a
terraform apply
failed to restore the changes as it failed to detect a modification of the configuration (the list of roles attached to the instance profile) of an aws_iam_instance_profile resource. I would have thought this is a change that terraform could potentially detect and fix.Actual Behavior
terraform plan
recognises that deleted resources need to be recreated but doesn't restore all the links between the resources.Steps to Reproduce
Note that in the steps below, some of the steps might happen automatically when other steps are done (such as removing a role from an instance profile might happen automatically when you delete the role). A colleague made the changes in the AWS console and I only have the CloudTrail log as evidence of what happened.
Now run a
terraform plan
. Terraform detects that it needs to recreate the deleted resources, but doesn't notice that the configuration of the instance profile has changed such that it is no longer linked to the example_role role.Additional Context
References
The text was updated successfully, but these errors were encountered: