Skip to content

Commit 0772b34

Browse files
authored
Merge pull request #62 from appvia/feat/sa-519
feat(module): bump notification module and replace accounts id var
2 parents 96c7073 + b50d14a commit 0772b34

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module "account_baseline_alarms" {
4343
|------|-------------|------|---------|:--------:|
4444
| <a name="input_notification"></a> [notification](#input\_notification) | The configuration for how to send notifications. | <pre>object({<br/> email = optional(object({<br/> addresses = list(string)<br/> }), null)<br/> slack = optional(object({<br/> lambda_name = optional(string, "alarms-notifications")<br/> webhook_url = string<br/> }), null)<br/> teams = optional(object({<br/> webhook_url = string<br/> }), null)<br/> })</pre> | n/a | yes |
4545
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | n/a | yes |
46-
| <a name="input_accounts_id_to_name"></a> [accounts\_id\_to\_name](#input\_accounts\_id\_to\_name) | A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name | `map(string)` | `{}` | no |
46+
| <a name="input_accounts_id_to_name_parameter_arn"></a> [accounts\_id\_to\_name\_parameter\_arn](#input\_accounts\_id\_to\_name\_parameter\_arn) | The ARN of the parameter that contains the account ID to name mapping. This ARN will be attached to lambda execution role as a resource, therefore a valid resource must exist. e.g 'arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts\_id\_to\_name\_mapping' to enable the lambda retrieve values from ssm. | `string` | `null` | no |
4747
| <a name="input_alarm_namespace"></a> [alarm\_namespace](#input\_alarm\_namespace) | The cloudwatch alarm namespace. | `string` | `"cis-benchmark"` | no |
4848
| <a name="input_cloudtrail_log_group_name"></a> [cloudtrail\_log\_group\_name](#input\_cloudtrail\_log\_group\_name) | The name of the CloudTrail log group to filter on. | `string` | `"aws-controltower/CloudTrailLogs"` | no |
4949
| <a name="input_cloudwatch_log_group_retention"></a> [cloudwatch\_log\_group\_retention](#input\_cloudwatch\_log\_group\_retention) | The retention period for the cloudwatch log group (for lambda function logs) in days | `string` | `"0"` | no |

main.tf

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
## Provision the notifications
33
module "notifications" {
44
source = "appvia/notifications/aws"
5-
version = "1.1.0"
5+
version = "2.0.0"
66

7-
allowed_aws_services = ["cloudwatch.amazonaws.com"]
8-
create_sns_topic = var.create_sns_topic
9-
email = local.email_configuration
10-
enable_slack = local.enable_slack
11-
slack = local.slack_configuration
12-
sns_topic_name = var.sns_topic_name
13-
tags = var.tags
14-
accounts_id_to_name = var.accounts_id_to_name
15-
cloudwatch_log_group_retention = var.cloudwatch_log_group_retention
16-
identity_center_start_url = var.identity_center_start_url
17-
identity_center_role = var.identity_center_role
7+
accounts_id_to_name_parameter_arn = var.accounts_id_to_name_parameter_arn
8+
allowed_aws_services = ["cloudwatch.amazonaws.com"]
9+
cloudwatch_log_group_retention = var.cloudwatch_log_group_retention
10+
create_sns_topic = var.create_sns_topic
11+
email = local.email_configuration
12+
enable_slack = local.enable_slack
13+
identity_center_role = var.identity_center_role
14+
identity_center_start_url = var.identity_center_start_url
15+
slack = local.slack_configuration
16+
sns_topic_name = var.sns_topic_name
17+
tags = var.tags
1818
}

variables.tf

+9-4
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ variable "tags" {
151151
type = map(string)
152152
}
153153

154-
variable "accounts_id_to_name" {
155-
description = "A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name"
156-
type = map(string)
157-
default = {}
154+
variable "accounts_id_to_name_parameter_arn" {
155+
description = "The ARN of the parameter that contains the account ID to name mapping. This ARN will be attached to lambda execution role as a resource, therefore a valid resource must exist. e.g 'arn:aws:ssm:eu-west-2:0123456778:parameter/myorg/configmaps/accounts_id_to_name_mapping' to enable the lambda retrieve values from ssm."
156+
type = string
157+
default = null
158+
159+
validation {
160+
condition = var.accounts_id_to_name_parameter_arn == null ? true : can(regex("^arn:[^:]+:ssm:[a-z0-9-]+:[0-9]{12}:parameter/.+$", var.accounts_id_to_name_parameter_arn))
161+
error_message = "The accounts_id_to_name_parameter_arn must be a valid SSM parameter ARN."
162+
}
158163
}
159164

160165
variable "cloudwatch_log_group_retention" {

0 commit comments

Comments
 (0)