Last active
March 29, 2022 11:47
-
-
Save khaliqgant/cff9a8bae11c36dbf9c2abbfd4876b31 to your computer and use it in GitHub Desktop.
[Terraform Template File] Template file with variables #terraform #infrastructure
This file contains hidden or 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 "template_file" "codebuild" { | |
template = file("${path.module}/policies/role-policy.json") | |
vars = { | |
aws_s3_bucket_arn = module.aws_s3_bucket.arn[0] | |
} | |
} | |
role-policy.json | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Resource": [ | |
"*" | |
], | |
"Action": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents", | |
"ecr:GetAuthorizationToken", | |
"ecr:InitiateLayerUpload", | |
"ecr:UploadLayerPart", | |
"ecr:CompleteLayerUpload", | |
"ecr:BatchCheckLayerAvailability", | |
"ecr:GetDownloadUrlForLayer", | |
"ecr:BatchGetImage", | |
"ecr:PutImage", | |
"ecs:RunTask", | |
"eks:DescribeCluster", | |
"secretsmanager:GetSecretValue", | |
"iam:PassRole", | |
"codeartifact:GetAuthorizationToken", | |
"codeartifact:GetRepositoryEndpoint", | |
"codeartifact:ReadFromRepository" | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": "sts:GetServiceBearerToken", | |
"Resource": "*", | |
"Condition": { | |
"StringEquals": { | |
"sts:AWSServiceName": "codeartifact.amazonaws.com" | |
} | |
} | |
}, | |
{ | |
"Effect":"Allow", | |
"Action": [ | |
"s3:GetObject", | |
"s3:GetObjectVersion", | |
"s3:GetBucketVersioning", | |
"s3:List*", | |
"s3:PutObject" | |
], | |
"Resource": [ | |
"${aws_s3_bucket_arn}", | |
"${aws_s3_bucket_arn}/*" | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ssm:GetParameters" | |
], | |
"Resource": [ | |
"arn:aws:ssm:*:*:parameter/codedeploy/*" | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"kms:Decrypt" | |
], | |
"Resource": "arn:aws:kms:*:*:alias/aws/ssm" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment