You imported an IAM role and the plan wants to remove two managed policy attachments that prod depends on.
IntermediateTroubleshootingImport, Already Exists and State Surgery
Answer
Likely causes → The code uses managed_policy_arns (exclusive management) or aws_iam_role_policy_attachments_exclusive, so Terraform removes attachments not listed in code.
Diagnose → aws iam list-attached-role-policies --role-name app-role
Fix → Add all real attachments to code (or import the existing aws_iam_role_policy_attachment resources) before applying. Note managed_policy_arns is deprecated in AWS provider v5; prefer separate attachment resources.
Prevent → After every import, require a plan with zero changes before merging.
More on Import, Already Exists and State Surgery
Apply fails with `EntityAlreadyExists: Role with name app-role already exists.`Beginner`terraform apply` on a new bucket fails with `BucketAlreadyExists`. You have never created that bucket.Beginner`Error: Resource already managed by Terraform` when running `terraform import aws_s3_bucket.logs acme-logs`.Beginner`Error: Cannot import non-existent remote object` for a resource you can see in the console.Intermediate`Error: Configuration for import target does not exist` when running `terraform plan` with an `import` block.Beginner`terraform plan -generate-config-out=generated.tf` fails with `Conflicting configuration arguments` in the generated file.Intermediate