Created
March 8, 2018 14:13
-
-
Save nabarunchatterjee/d406bc5e517fe65f30a4e22f929974b3 to your computer and use it in GitHub Desktop.
Trust relationship role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_iam_policy_document" "latest-random-assume-role-policy-document" { | |
statement { | |
actions = ["sts:AssumeRole"] | |
principals { | |
type = "Service" | |
identifiers = ["ec2.amazonaws.com"] | |
} | |
} | |
} | |
data "aws_iam_policy_document" "latest-random-policy-document" { | |
statement { | |
actions = ["s3:Get*", "s3:List*"] | |
resources = ["*"] | |
} | |
statement { | |
actions = ["ec2:*", "iam:PassRole", "cloudwatch:GetMetricStatistics", "cloudwatch:DescribeAlarms", "ecs:*", "elasticloadbalancing:*", "rds:*", "opsworks:*", "route53:*", "s3:*"] | |
resources = ["*"] | |
} | |
} | |
resource "aws_iam_policy" "latest-random-policy" { | |
name = "latest-random-policy" | |
path = "/terraform/" | |
policy = "${data.aws_iam_policy_document.latest-random-policy-document.json}" | |
} | |
resource "aws_iam_role" "latest-random-role" { | |
name = "latest-random-role" | |
assume_role_policy = "${data.aws_iam_policy_document.latest-random-assume-role-policy-document.json}" | |
} | |
resource "aws_iam_role_policy_attachment" "latest-random-attachment" { | |
role = "${aws_iam_role.latest-random-role.name}" | |
policy_arn = "${aws_iam_policy.latest-random-policy.arn}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment