Created
May 1, 2023 01:06
-
-
Save KyMidd/c909ee8a5190ad30c51a9c7aced3879a to your computer and use it in GitHub Desktop.
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
| # Build data source to find AWS account id | |
| data "aws_caller_identity" "current" {} | |
| # Get region | |
| data "aws_region" "current" {} | |
| resource "aws_iam_role_policy" "GitHubCopRepoTrigger_Cloudwatch" { | |
| name = "Cloudwatch" | |
| role = aws_iam_role.GitHubCopNewRepoTriggerRole.id | |
| policy = jsonencode( | |
| { | |
| "Version" : "2012-10-17", | |
| "Statement" : [ | |
| { | |
| "Effect" : "Allow", | |
| "Action" : "logs:CreateLogGroup", | |
| "Resource" : "arn:aws:logs:us-east-1:${data.aws_caller_identity.current.id}:*" | |
| }, | |
| { | |
| "Effect" : "Allow", | |
| "Action" : [ | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], | |
| "Resource" : [ | |
| "arn:aws:logs:${data.aws_region.current.name}:${data.aws_caller_identity.current.id}:log-group:/aws/lambda/GitHubCopRepoTrigger:*" | |
| ] | |
| } | |
| ] | |
| } | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment