Skip to content

Commit

Permalink
Merge pull request #174 from cloudnativedaysjp/mackerel-aws-integration
Browse files Browse the repository at this point in the history
MackerelのAWSインテグレーションを実行するIAMロール
  • Loading branch information
ne-sachirou authored Sep 26, 2024
2 parents 374c5dd + 2aae2bb commit 36e966d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions o11y_infra/prd/mackerel_aws_integration.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
data "aws_iam_policy_document" "mackerel_aws_integration_assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]
effect = "Allow"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::217452466226:root"]
}
condition {
test = "StringEquals"
variable = "sts:ExternalId"
values = ["P6vnw10qZcylI8QWWXOxX1oneICZOrShzBAnFCf6"]
}
}
}

data "aws_iam_policy_document" "mackerel_aws_integration_inline_policy" {
statement {
actions = [
"AWSBudgetsReadOnlyAccess",
"AmazonEC2ReadOnlyAccess",
"AmazonElastiCacheReadOnlyAccess",
"AmazonRDSReadOnlyAccess",
"AmazonSQSReadOnlyAccess",
"CloudWatchReadOnlyAccess",
"ecs:Describe*",
"ecs:List*",
"sqs:ListQueueTags"
]
effect = "Allow"
resources = ["*"]
}
}

resource "aws_iam_role" "mackerel_aws_integration" {
name = "mackerel-aws-integration"
path = "/"
assume_role_policy = data.aws_iam_policy_document.mackerel_aws_integration_assume_role_policy.json
inline_policy {
name = "mackerel-aws-integration"
policy = data.aws_iam_policy_document.mackerel_aws_integration_inline_policy.json
}
}

0 comments on commit 36e966d

Please sign in to comment.