Skip to content

Commit be5cb01

Browse files
FEATURE ASH-249: Add ElastiCache, ES, Redshift reservation rights (#52)
1 parent 71d35ea commit be5cb01

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ No providers.
104104
| Name | Description | Type | Required |
105105
|------|-------------|------|:--------:|
106106
| <a name="input_account_type"></a> [account\_type](#input\_account\_type) | The type of the AWS account. The possible values are `billing`, `member` and `combined`.<br>Use `billing` if the target account is only for billing purposes (generating CUR report and exporting it to Vertice via S3 bucket).<br>Use `member` if the account contains active workload and you want to allow `VerticeGovernance` role to perform spend optimization actions in the account on your behalf.<br>Use `combined` for both of the above. | `string` | yes |
107-
| <a name="input_billing_policy_addons"></a> [billing\_policy\_addons](#input\_billing\_policy\_addons) | Enable optional add-ons for the `billing`/`combined` account IAM policy. | <pre>object({<br> ec2_ri = optional(bool, true),<br> rds_ri = optional(bool, true),<br> })</pre> | no |
107+
| <a name="input_billing_policy_addons"></a> [billing\_policy\_addons](#input\_billing\_policy\_addons) | Enable optional add-ons for the `billing`/`combined` account IAM policy. | <pre>object({<br> elasticache_ri = optional(bool, true),<br> ec2_ri = optional(bool, true),<br> es_ri = optional(bool, true),<br> rds_ri = optional(bool, true),<br> redshift_ri = optional(bool, true),<br> })</pre> | no |
108108
| <a name="input_cur_bucket_enabled"></a> [cur\_bucket\_enabled](#input\_cur\_bucket\_enabled) | Whether to enable the module that creates S3 bucket for Cost Usage Report data. | `bool` | no |
109109
| <a name="input_cur_bucket_force_destroy"></a> [cur\_bucket\_force\_destroy](#input\_cur\_bucket\_force\_destroy) | A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. | `bool` | no |
110110
| <a name="input_cur_bucket_lifecycle_rules"></a> [cur\_bucket\_lifecycle\_rules](#input\_cur\_bucket\_lifecycle\_rules) | List of maps containing configuration of object lifecycle management on the S3 bucket holding CUR data. | `any` | no |

modules/vertice-governance-role/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ No modules.
4747
| Name | Description | Type | Default | Required |
4848
|------|-------------|------|---------|:--------:|
4949
| <a name="input_account_type"></a> [account\_type](#input\_account\_type) | The type of the AWS account. The possible values are `billing`, `member` and `combined`.<br>Use `billing` if the target account is only for billing purposes (generating CUR report and exporting it to Vertice via S3 bucket).<br>Use `member` if the account contains active workload and you want to allow `VerticeGovernance` role to perform spend optimization actions in the account on your behalf.<br>Use `combined` for both of the above. | `string` | n/a | yes |
50-
| <a name="input_billing_policy_addons"></a> [billing\_policy\_addons](#input\_billing\_policy\_addons) | Enable optional add-ons for the `billing`/`combined` account IAM policy. | <pre>object({<br> ec2_ri = optional(bool, true),<br> rds_ri = optional(bool, true),<br> })</pre> | `{}` | no |
50+
| <a name="input_billing_policy_addons"></a> [billing\_policy\_addons](#input\_billing\_policy\_addons) | Enable optional add-ons for the `billing`/`combined` account IAM policy. | <pre>object({<br> elasticache_ri = optional(bool, true),<br> ec2_ri = optional(bool, true),<br> es_ri = optional(bool, true),<br> rds_ri = optional(bool, true),<br> redshift_ri = optional(bool, true),<br> })</pre> | `{}` | no |
5151
| <a name="input_cur_bucket_name"></a> [cur\_bucket\_name](#input\_cur\_bucket\_name) | The name of the bucket which will be used to store the CUR data for Vertice. | `string` | `null` | no |
5252
| <a name="input_data_export_enabled"></a> [data\_export\_enabled](#input\_data\_export\_enabled) | Include policy enabling access to AWS Data Exports. | `bool` | `false` | no |
5353
| <a name="input_governance_role_additional_policy_json"></a> [governance\_role\_additional\_policy\_json](#input\_governance\_role\_additional\_policy\_json) | Custom additional policy in JSON format to attach to VerticeGovernance role. Default is `null` for no additional policy. | `string` | `null` | no |

modules/vertice-governance-role/iam_policies.tf

+42
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ data "aws_iam_policy_document" "vertice_billing_access" {
9393
]
9494
}
9595

96+
dynamic "statement" {
97+
for_each = var.billing_policy_addons.elasticache_ri ? [1] : []
98+
content {
99+
sid = "VerticeElastiCacheReservedInstancesAccess"
100+
effect = "Allow"
101+
actions = [
102+
"elasticache:DescribeReservedCacheNodes",
103+
"elasticache:DescribeReservedCacheNodesOfferings",
104+
"elasticache:PurchaseReservedCacheNodesOffering",
105+
]
106+
resources = ["*"]
107+
}
108+
}
109+
96110
dynamic "statement" {
97111
for_each = var.billing_policy_addons.ec2_ri ? [1] : []
98112
content {
@@ -115,6 +129,20 @@ data "aws_iam_policy_document" "vertice_billing_access" {
115129
}
116130
}
117131

132+
dynamic "statement" {
133+
for_each = var.billing_policy_addons.es_ri ? [1] : []
134+
content {
135+
sid = "VerticeOpenSearchReservedInstancesAccess"
136+
effect = "Allow"
137+
actions = [
138+
"es:DescribeReservedInstanceOfferings",
139+
"es:DescribeReservedInstances",
140+
"es:PurchaseReservedInstanceOffering",
141+
]
142+
resources = ["*"]
143+
}
144+
}
145+
118146
dynamic "statement" {
119147
for_each = var.billing_policy_addons.rds_ri ? [1] : []
120148
content {
@@ -129,6 +157,20 @@ data "aws_iam_policy_document" "vertice_billing_access" {
129157
resources = ["*"]
130158
}
131159
}
160+
161+
dynamic "statement" {
162+
for_each = var.billing_policy_addons.redshift_ri ? [1] : []
163+
content {
164+
sid = "VerticeRedshiftReservedInstancesAccess"
165+
effect = "Allow"
166+
actions = [
167+
"redshift:DescribeReservedNodeOfferings",
168+
"redshift:DescribeReservedNodes",
169+
"redshift:PurchaseReservedNodeOffering",
170+
]
171+
resources = ["*"]
172+
}
173+
}
132174
}
133175

134176
resource "aws_iam_policy" "vertice_billing_access" {

modules/vertice-governance-role/variables.tf

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ variable "account_type" {
5353
variable "billing_policy_addons" {
5454
description = "Enable optional add-ons for the `billing`/`combined` account IAM policy."
5555
type = object({
56-
ec2_ri = optional(bool, true),
57-
rds_ri = optional(bool, true),
56+
elasticache_ri = optional(bool, true),
57+
ec2_ri = optional(bool, true),
58+
es_ri = optional(bool, true),
59+
rds_ri = optional(bool, true),
60+
redshift_ri = optional(bool, true),
5861
})
5962
default = {}
6063
}

variables.tf

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ variable "governance_role_additional_policy_json" {
5555
variable "billing_policy_addons" {
5656
description = "Enable optional add-ons for the `billing`/`combined` account IAM policy."
5757
type = object({
58-
ec2_ri = optional(bool, true),
59-
rds_ri = optional(bool, true),
58+
elasticache_ri = optional(bool, true),
59+
ec2_ri = optional(bool, true),
60+
es_ri = optional(bool, true),
61+
rds_ri = optional(bool, true),
62+
redshift_ri = optional(bool, true),
6063
})
6164
default = {}
6265
}

0 commit comments

Comments
 (0)