Skip to content

Commit 4876b72

Browse files
nictom-awstnicholson-awscyphronix
authored
fixed tf deprecation added benchmark 3 (#296)
* fixed tf deprecation added benchmark 3 * updating variable definitions for CKV_AWS_338; also missing end curly brace --------- Co-authored-by: tnicholson-aws <tnicholson@beyondtrust.com> Co-authored-by: cyphronix <57731583+cyphronix@users.noreply.github.com>
1 parent 3123563 commit 4876b72

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

aws_sra_examples/terraform/common/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ resource "local_file" "config_file_creation" {
144144
# Security Hub Settings
145145
########################################################################
146146
disable_security_hub = false
147-
cis_standard_version = "1.4.0"
147+
cis_standard_version = "3.0.0"
148148
compliance_frequency = "7"
149149
securityhub_control_tower_regions_only = true
150150
enable_cis_standard = false

aws_sra_examples/terraform/common/sra_execution_role/main.tf

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ resource "aws_iam_role" "sra_execution_role" {
1313
Action = "sts:AssumeRole",
1414
Effect = "Allow",
1515
Principal = {
16-
AWS = "arn:${var.aws_partition}:iam::${var.management_account_id}:root"
16+
AWS = format("arn:%s:iam::%s:root", var.aws_partition, var.management_account_id)
1717
}
1818
}]
1919
})
2020

21-
managed_policy_arns = [
22-
"arn:${var.aws_partition}:iam::aws:policy/AdministratorAccess"
23-
]
24-
2521
tags = {
2622
"sra-solution" = var.solution_name
2723
}
24+
}
25+
26+
resource "aws_iam_role_policy_attachment" "sra_execution_role_admin_policy" {
27+
role = aws_iam_role.sra_execution_role.name
28+
policy_arn = format("arn:%s:iam::aws:policy/AdministratorAccess", var.aws_partition)
2829
}

aws_sra_examples/terraform/solutions/security_hub/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Please navigate to the [installing the AWS SRA Solutions](./../../README.md#inst
182182
| Name | Description | Type | Default | Required |
183183
|------|-------------|------|---------|:--------:|
184184
| <a name="input_audit_account_id"></a> [audit\_account\_id](#input\_audit\_account\_id) | AWS Account ID of the Control Tower Audit account. | `string` | n/a | yes |
185-
| <a name="input_cis_standard_version"></a> [cis\_standard\_version](#input\_cis\_standard\_version) | CIS Standard Version | `string` | `"1.4.0"` | no |
185+
| <a name="input_cis_standard_version"></a> [cis\_standard\_version](#input\_cis\_standard\_version) | CIS Standard Version | `string` | `"3.0.0"` | no |
186186
| <a name="input_compliance_frequency"></a> [compliance\_frequency](#input\_compliance\_frequency) | Frequency to Check for Organizational Compliance (in days between 1 and 30, default is 7) | `number` | `7` | no |
187187
| <a name="input_control_tower_lifecycle_rule_name"></a> [control\_tower\_lifecycle\_rule\_name](#input\_control\_tower\_lifecycle\_rule\_name) | The name of the AWS Control Tower Life Cycle Rule | `string` | `"sra-securityhub-org-trigger"` | no |
188188
| <a name="input_create_lambda_log_group"></a> [create\_lambda\_log\_group](#input\_create\_lambda\_log\_group) | Indicates whether a CloudWatch Log Group should be explicitly created for the Lambda function | `bool` | `false` | no |

aws_sra_examples/terraform/solutions/security_hub/configuration/variables.tf

+5-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ variable "lambda_log_group_kms_key" {
129129
variable "lambda_log_group_retention" {
130130
description = "Specifies the number of days you want to retain log events"
131131
type = number
132-
default = 14
132+
default = 365
133+
validation {
134+
condition = var.lambda_log_group_retention >= 365
135+
error_message = "Cloudwatch log group retention must be at least 365 days to meet CKV_AWS338 best practice."
136+
}
133137
}
134138

135139
variable "lambda_log_level" {

aws_sra_examples/terraform/solutions/security_hub/variables.tf

+10-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ variable "sra_solution_name" {
3737
variable "cis_standard_version" {
3838
description = "CIS Standard Version"
3939
type = string
40-
default = "1.4.0"
40+
default = "3.0.0"
41+
validation {
42+
condition = contains(["NONE", "1.2.0", "1.4.0", "3.0.0"], var.cis_standard_version)
43+
error_message = "Valid values for cis_standard_version are NONE, 1.2.0, 1.4.0, or 3.0.0."
44+
}
4145
}
4246

4347
variable "compliance_frequency" {
@@ -155,7 +159,11 @@ variable "lambda_log_group_kms_key" {
155159
variable "lambda_log_group_retention" {
156160
description = "Specifies the number of days you want to retain log events"
157161
type = number
158-
default = 14
162+
default = 365
163+
validation {
164+
condition = var.lambda_log_group_retention >= 365
165+
error_message = "Cloudwatch log group retention must be at least 365 days to meet CKV_AWS_338 best practice."
166+
}
159167
}
160168

161169
variable "lambda_log_level" {

0 commit comments

Comments
 (0)