Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@9oelM

9oelM/block35.tf Secret

Created March 21, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9oelM/9ba78bb7025951e4166a923381436172 to your computer and use it in GitHub Desktop.
Save 9oelM/9ba78bb7025951e4166a923381436172 to your computer and use it in GitHub Desktop.
resource "aws_iam_role" "hello" {
name = "hello_role"
assume_role_policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Principal" : {
# this should be set as the 'default' user on your AWS cli.
# get 'localtf' user's ARN from AWS IAM console
# it should look like: arn:aws:iam::{aws-account-id}:user/localtf
# example: arn:aws:iam::123456789:user/localtf
"AWS" : "arn:aws:iam::123456789:user/localtf"
"Service" : [
"lambda.amazonaws.com"
]
},
"Action" : "sts:AssumeRole"
}
]
})
}
resource "aws_iam_policy" "hello" {
name = "hello_policy"
description = "policy needed to run hello server stack"
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Action" : [
"lambda:*",
"iam:*",
"ecr:*",
"cloudformation:*",
"apigateway:*",
"logs:*",
"route53:*",
"acm:*",
"cloudfront:*",
"ec2:*"
],
"Effect" : "Allow",
"Resource" : "*"
}
]
})
}
resource "aws_iam_role_policy_attachment" "hello" {
role = aws_iam_role.hello.name
policy_arn = aws_iam_policy.hello.arn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment