Interview Prep/Terraform/Authentication and Cloud API Errors

`MalformedPolicyDocument: Has prohibited field Resource` when creating an IAM role.

IntermediateTroubleshootingAuthentication and Cloud API Errors
Answer

Likely causes → You put an identity policy (with Resource) in assume_role_policy. Trust policies must have Principal and Action: sts:AssumeRole, no Resource.

Diagnose → Inspect what's passed to assume_role_policy.

Fix → Separate them: trust policy via data "aws_iam_policy_document" with principals {}; permissions via aws_iam_role_policy or attachments.

Prevent → Name documents clearly (*_trust, *_permissions) in code.

All Terraform questions

More on Authentication and Cloud API Errors