Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Created April 15, 2020 06:35
Show Gist options
  • Save wshihadeh/de368d17bdd77962574d0f699735751d to your computer and use it in GitHub Desktop.
Save wshihadeh/de368d17bdd77962574d0f699735751d to your computer and use it in GitHub Desktop.
aws_iam_role
resource "aws_iam_role" "stop_start_ec2_role" {
name = "StopStartEC2Role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "lambda_role_policy" {
role = "${aws_iam_role.stop_start_ec2_role.name}"
policy_arn = "${aws_iam_policy.stop_start_ec2_policy.arn}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment