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