NEW: added cloudhealth role

This commit is contained in:
xpk 2021-01-27 11:52:54 +08:00
parent 9fafa93c9d
commit 213fc9a9fe
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
3 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,7 @@ module iam-module {
project = var.project
aws-region-short = var.aws-region-short
default-tags = local.default-tags
create-cloudhealth-resources = false
cloudheath-ext-id1 = "87adcc8d76e0bc18ac67e1c4a7acbc"
cloudheath-ext-id2 = "68c32aa2f429c59528ae79c713159f"
}

View File

@ -1,4 +1,5 @@
resource aws_iam_role cloudhealth-role {
count = var.create-cloudhealth-resources ? 1 : 0
name = "CloudHealth-Role"
tags = var.default-tags
assume_role_policy = <<EOF
@ -26,6 +27,7 @@ EOF
}
resource "aws_iam_policy" "CloudHealth-Policy" {
count = var.create-cloudhealth-resources ? 1 : 0
name = "CloudHealthPolicy"
policy = <<-EOF
{
@ -132,7 +134,8 @@ EOF
}
resource "aws_iam_role_policy_attachment" "cloudhealth-role-policy-attach" {
role = aws_iam_role.cloudhealth-role.name
policy_arn = aws_iam_policy.CloudHealth-Policy.arn
count = var.create-cloudhealth-resources ? 1 : 0
role = aws_iam_role.cloudhealth-role[1].name
policy_arn = aws_iam_policy.CloudHealth-Policy[1].arn
}

View File

@ -8,6 +8,12 @@ variable "cloudtrail-retain-days" {
type = number
default = 90
}
variable "create-cloudhealth-resources" {
type = bool
default = false
}
variable "cloudheath-ext-id1" {}
variable "cloudheath-ext-id2" {}