UPD: fine-grained billing access

This commit is contained in:
xpk 2023-07-17 21:50:41 +08:00
parent 561904d529
commit 185036deeb
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -1,4 +1,4 @@
resource aws_iam_role cloudhealth-role {
resource "aws_iam_role" "cloudhealth-role" {
count = var.create-cloudhealth-resources ? 1 : 0
name = "CloudHealth-Role"
tags = var.default-tags
@ -29,12 +29,13 @@ EOF
resource "aws_iam_policy" "CloudHealth-Policy" {
count = var.create-cloudhealth-resources ? 1 : 0
name = "CloudHealthPolicy"
policy = <<-EOF
{
"Version": "2012-10-17",
"Statement": [
policy = jsonencode(
{
"Action": [
"Version" : "2012-10-17",
"Statement" : [
{
"Sid" : "CloudhealthAccess",
"Action" : [
"autoscaling:Describe*",
"cloudformation:ListStacks",
"cloudformation:ListStackResources",
@ -123,7 +124,14 @@ resource "aws_iam_policy" "CloudHealth-Policy" {
"sqs:ListQueues",
"storagegateway:List*",
"storagegateway:Describe*",
"workspaces:Describe*",
"workspaces:Describe*"
],
"Resource" : "*",
"Effect" : "Allow"
},
{
"Sid" : "FineGrainedBillingAccess",
"Action" : [
"account:Get*",
"billing:Get*",
"billing:List*",
@ -144,12 +152,12 @@ resource "aws_iam_policy" "CloudHealth-Policy" {
"tax:Get*",
"tax:List*"
],
"Resource": "*",
"Effect": "Allow"
"Resource" : "*",
"Effect" : "Allow"
}
]
}
EOF
}
)
}
resource "aws_iam_role_policy_attachment" "cloudhealth-role-policy-attach" {