Skip to content

Commit

Permalink
Merge pull request #29 from mackerelio-labs/inline-policy-block-is-de…
Browse files Browse the repository at this point in the history
…precated

[cloudwatch-logs-aggregator] replace deprecated inline_policy block of aws_iam_role resource
  • Loading branch information
Arthur1 authored Oct 7, 2024
2 parents 4155433 + 7ef6087 commit bfb508e
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions cloudwatch-logs-aggregator/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,29 @@ resource "aws_iam_role" "this" {
})

managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
}

resource "aws_iam_role_policy" "this" {
role = aws_iam_role.this.id
name = "cloudwatch-logs-aggregator-lambda"
policy = data.aws_iam_policy_document.this.json
}

inline_policy {
name = "cloudwatch-logs-aggregator-lambda"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = ["ssm:GetParameter"]
Resource = "*"
},
{
Effect = "Allow"
Action = [
"logs:StartQuery",
"logs:StopQuery",
"logs:GetQueryResults",
]
Resource = "*"
},
]
})
data "aws_iam_policy_document" "this" {
version = "2012-10-17"
statement {
effect = "Allow"
actions = ["ssm:GetParameter"]
resources = ["*"]
}
statement {
effect = "Allow"
actions = [
"logs:StartQuery",
"logs:StopQuery",
"logs:GetQueryResults",
]
resources = ["*"]
}
}

Expand Down

0 comments on commit bfb508e

Please sign in to comment.