claranet / terraform-aws-lambda

Terraform module for AWS Lambda functions
MIT License
157 stars 127 forks source link

Use safer aws_iam_role_policy_attachment #62

Closed nitrocode closed 4 years ago

nitrocode commented 4 years ago

Drop aws_iam_policy_attachment due to the resource warning

WARNING: The aws_iam_policy_attachment resource creates exclusive attachments of IAM policies. Across the entire AWS account, all of the users/roles/groups to which a single policy is attached must be declared by a single aws_iam_policy_attachment resource. This means that even any users/roles/groups that have the attached policy via any other mechanism (including other Terraform resources) will have that attached policy revoked by this resource. Consider aws_iam_role_policy_attachment, aws_iam_user_policy_attachment, or aws_iam_group_policy_attachment instead. These resources do not enforce exclusive attachment of an IAM policy.

Use instead the aws_iam_role_policy_attachment

nitrocode commented 4 years ago

https://github.com/claranet/terraform-aws-lambda/pull/63 is better