terraform/ecc-aws-054-iam_policies_full_administrative_privileges/green/iam.tf (40 lines of code) (raw):

resource "aws_iam_policy" "this" { name = "054_policy_green" policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Action": [ "ec2:Describe*" ], "Effect": "Allow", "Resource": "*" } ] } EOF } resource "aws_iam_role" "this" { name = "054_role_green" assume_role_policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "sts:AssumeRole", "Principal": { "Service": [ "lambda.amazonaws.com" ] } } ] } EOF } resource "aws_iam_role_policy_attachment" "this" { role = aws_iam_role.this.name policy_arn = aws_iam_policy.this.arn }