Skip to content

Commit 1f1d64a

Browse files
committed
chore: working on reducing the noise in the terraform diff
1 parent d35435c commit 1f1d64a

File tree

17 files changed

+155
-278
lines changed

17 files changed

+155
-278
lines changed

.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,10 @@ Frequently (quartley at least) check and upgrade:
113113
| <a name="input_enable_teams"></a> [enable\_teams](#input\_enable\_teams) | To send to teams, set to true | `bool` | `false` | no |
114114
| <a name="input_identity_center_role"></a> [identity\_center\_role](#input\_identity\_center\_role) | The name of the role to use when redirecting through Identity Center | `string` | `null` | no |
115115
| <a name="input_identity_center_start_url"></a> [identity\_center\_start\_url](#input\_identity\_center\_start\_url) | The start URL of your Identity Center instance | `string` | `null` | no |
116-
| <a name="input_post_icons_url"></a> [post\_icons\_url](#input\_post\_icons\_url) | URLs (not base64 encoded!) to publically available icons for highlighting posts of error and/or warning status. Ideally 50px square. Set to non-existent URLs to disable icons | <pre>object({<br/> error_url = string<br/> warning_url = string<br/> })</pre> | <pre>{<br/> "error_url": "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-attention-icon.png",<br/> "warning_url": "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-warning-icon.png"<br/>}</pre> | no |
117-
| <a name="input_slack"></a> [slack](#input\_slack) | The configuration for Slack notifications | <pre>object({<br/> lambda_name = optional(string, "slack-notify")<br/> # The name of the lambda function to create <br/> lambda_description = optional(string, "Lambda function to send slack notifications")<br/> # The description for the slack lambda<br/> secret_name = optional(string)<br/> # An optional secret name in secrets manager to use for the slack configuration <br/> webhook_url = optional(string)<br/> # The webhook url to post to<br/> filter_policy = optional(string)<br/> # An optional SNS subscription filter policy to apply<br/> filter_policy_scope = optional(string)<br/> # If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"<br/> })</pre> | `null` | no |
116+
| <a name="input_slack"></a> [slack](#input\_slack) | The configuration for Slack notifications | <pre>object({<br/> lambda_name = optional(string, "slack-notify")<br/> # The name of the lambda function to create<br/> lambda_description = optional(string, "Lambda function to send slack notifications")<br/> # The description for the slack lambda<br/> secret_name = optional(string)<br/> # An optional secret name in secrets manager to use for the slack configuration<br/> webhook_url = optional(string)<br/> # The webhook url to post to<br/> filter_policy = optional(string)<br/> # An optional SNS subscription filter policy to apply<br/> filter_policy_scope = optional(string)<br/> # If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"<br/> })</pre> | `null` | no |
118117
| <a name="input_sns_topic_policy"></a> [sns\_topic\_policy](#input\_sns\_topic\_policy) | The policy to attach to the sns topic, else we default to account root | `string` | `null` | no |
119118
| <a name="input_subscribers"></a> [subscribers](#input\_subscribers) | Optional list of custom subscribers to the SNS topic | <pre>map(object({<br/> protocol = string<br/> # The protocol to use. The possible values for this are: sqs, sms, lambda, application. (http or https are partially supported, see below).<br/> endpoint = string<br/> # The endpoint to send data to, the contents will vary with the protocol. (see below for more information)<br/> endpoint_auto_confirms = bool<br/> # Boolean indicating whether the end point is capable of auto confirming subscription e.g., PagerDuty (default is false)<br/> raw_message_delivery = bool<br/> # Boolean indicating whether or not to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property) (default is false)<br/> }))</pre> | `{}` | no |
120-
| <a name="input_teams"></a> [teams](#input\_teams) | The configuration for teams notifications | <pre>object({<br/> lambda_name = optional(string, "teams-notify")<br/> # The name of the lambda function to create <br/> lambda_description = optional(string, "Lambda function to send teams notifications")<br/> # The description for the teams lambda<br/> secret_name = optional(string)<br/> # An optional secret name in secrets manager to use for the slack configuration <br/> webhook_url = optional(string)<br/> # The webhook url to post to<br/> filter_policy = optional(string)<br/> # An optional SNS subscription filter policy to apply<br/> filter_policy_scope = optional(string)<br/> # If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"<br/> })</pre> | `null` | no |
119+
| <a name="input_teams"></a> [teams](#input\_teams) | The configuration for teams notifications | <pre>object({<br/> lambda_name = optional(string, "teams-notify")<br/> # The name of the lambda function to create<br/> lambda_description = optional(string, "Lambda function to send teams notifications")<br/> # The description for the teams lambda<br/> secret_name = optional(string)<br/> # An optional secret name in secrets manager to use for the slack configuration<br/> webhook_url = optional(string)<br/> # The webhook url to post to<br/> filter_policy = optional(string)<br/> # An optional SNS subscription filter policy to apply<br/> filter_policy_scope = optional(string)<br/> # If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"<br/> })</pre> | `null` | no |
121120

122121
## Outputs
123122

data.tf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11

2-
## Find the current AWS account ID
2+
## Find the current AWS account ID
33
data "aws_caller_identity" "current" {}
4+
45
## Find the current AWS region
56
data "aws_region" "current" {}
67

7-
## Provision an SNS IAM policy allowing the account root
8+
## Find the aws partition
9+
data "aws_partition" "current" {}
10+
11+
## Provision an SNS IAM policy allowing the account root
812
data "aws_iam_policy_document" "current" {
913
statement {
1014
sid = "AllowAccountRoot"
@@ -54,28 +58,28 @@ data "aws_iam_policy_document" "current" {
5458
}
5559
}
5660

57-
## Find the slack secret if required
61+
## Find the slack secret if required
5862
data "aws_secretsmanager_secret" "slack" {
5963
count = local.enable_slack_secret ? 1 : 0
6064

6165
name = var.slack.secret_name
6266
}
6367

64-
## Find the latest version of the slack secret if required
68+
## Find the latest version of the slack secret if required
6569
data "aws_secretsmanager_secret_version" "slack" {
6670
count = local.enable_slack_secret ? 1 : 0
6771

6872
secret_id = data.aws_secretsmanager_secret.slack[0].id
6973
}
7074

71-
## Find the teams secret if required
75+
## Find the teams secret if required
7276
data "aws_secretsmanager_secret" "teams" {
7377
count = local.enable_teams_secret ? 1 : 0
7478

7579
name = var.teams.secret_name
7680
}
7781

78-
## Find the latest version of the teams secret if required
82+
## Find the latest version of the teams secret if required
7983
data "aws_secretsmanager_secret_version" "teams" {
8084
count = local.enable_teams_secret ? 1 : 0
8185

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ resource "aws_sns_topic_subscription" "subscribers" {
4444
module "notify" {
4545
source = "./modules/notify"
4646

47+
aws_partition = data.aws_partition.current.partition
48+
aws_region = data.aws_region.current.name
49+
aws_account_id = data.aws_caller_identity.current.account_id
4750
accounts_id_to_name = var.accounts_id_to_name
4851
cloudwatch_log_group_kms_key_id = var.cloudwatch_log_group_kms_key_id
4952
cloudwatch_log_group_retention_in_days = var.cloudwatch_log_group_retention
@@ -53,7 +56,6 @@ module "notify" {
5356
enable_teams = var.enable_teams
5457
identity_center_role = var.identity_center_role
5558
identity_center_start_url = var.identity_center_start_url
56-
post_icons_url = var.post_icons_url
5759
recreate_missing_package = false
5860
sns_topic_name = var.sns_topic_name
5961
tags = var.tags

modules/notify/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/notify/README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,52 +93,43 @@ Subsumed by appvia's GNU V3 license; [see license](../../LICENSE).
9393

9494
| Name | Version |
9595
|------|---------|
96-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.8 |
96+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0.0 |
9797
| <a name="provider_local"></a> [local](#provider\_local) | >= 2.5.0 |
9898

9999
## Inputs
100100

101101
| Name | Description | Type | Default | Required |
102102
|------|-------------|------|---------|:--------:|
103+
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS account ID | `string` | n/a | yes |
104+
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | The AWS region to deploy to | `string` | n/a | yes |
103105
| <a name="input_sns_topic_name"></a> [sns\_topic\_name](#input\_sns\_topic\_name) | The name of the SNS topic to create | `string` | n/a | yes |
104106
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | n/a | yes |
105107
| <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 |
106108
| <a name="input_architecture"></a> [architecture](#input\_architecture) | Instruction set architecture for your Lambda function. Valid values are "x86\_64" or "arm64". | `string` | `"arm64"` | no |
109+
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | The partition in which the resource is located. A partition is a group of AWS Regions. Each AWS account is scoped to one partition. | `string` | `"aws"` | no |
107110
| <a name="input_aws_powertools_service_name"></a> [aws\_powertools\_service\_name](#input\_aws\_powertools\_service\_name) | The service name to use | `string` | `"appvia-notifications"` | no |
108111
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data for Lambda | `string` | `null` | no |
109112
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | Specifies the number of days you want to retain log events in log group for Lambda. | `number` | `0` | no |
110113
| <a name="input_create_sns_topic"></a> [create\_sns\_topic](#input\_create\_sns\_topic) | Whether to create new SNS topic | `bool` | `true` | no |
111114
| <a name="input_delivery_channels"></a> [delivery\_channels](#input\_delivery\_channels) | The configuration for Slack notifications | <pre>map(object({<br/> lambda_name = optional(string, "delivery_channel")<br/> # The name of the lambda function to create<br/> lambda_description = optional(string, "Lambda function to send notifications")<br/> # The description for the lambda<br/> secret_name = optional(string)<br/> # An optional secret name in secrets manager to use for the slack configuration<br/> webhook_url = optional(string)<br/> # The webhook url to post to<br/> filter_policy = optional(string)<br/> # An optional SNS subscription filter policy to apply<br/> filter_policy_scope = optional(string)<br/> # If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"<br/> }))</pre> | `null` | no |
112115
| <a name="input_enable_slack"></a> [enable\_slack](#input\_enable\_slack) | To send to slack, set to true | `bool` | `false` | no |
113-
| <a name="input_enable_sns_topic_delivery_status_logs"></a> [enable\_sns\_topic\_delivery\_status\_logs](#input\_enable\_sns\_topic\_delivery\_status\_logs) | Whether to enable SNS topic delivery status logs | `bool` | `false` | no |
114116
| <a name="input_enable_teams"></a> [enable\_teams](#input\_enable\_teams) | To send to teams, set to true | `bool` | `false` | no |
115-
| <a name="input_iam_policy_path"></a> [iam\_policy\_path](#input\_iam\_policy\_path) | Path of policies to that should be added to IAM role for Lambda Function | `string` | `null` | no |
116117
| <a name="input_iam_role_boundary_policy_arn"></a> [iam\_role\_boundary\_policy\_arn](#input\_iam\_role\_boundary\_policy\_arn) | The ARN of the policy that is used to set the permissions boundary for the role | `string` | `null` | no |
117118
| <a name="input_iam_role_name_prefix"></a> [iam\_role\_name\_prefix](#input\_iam\_role\_name\_prefix) | A unique role name beginning with the specified prefix | `string` | `"lambda"` | no |
118119
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | Path of IAM role to use for Lambda Function | `string` | `null` | no |
119120
| <a name="input_identity_center_role"></a> [identity\_center\_role](#input\_identity\_center\_role) | The name of the role to use when redirecting through Identity Center | `string` | `null` | no |
120121
| <a name="input_identity_center_start_url"></a> [identity\_center\_start\_url](#input\_identity\_center\_start\_url) | The start URL of your Identity Center instance | `string` | `null` | no |
121122
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | ARN of the KMS key used for decrypting slack webhook url | `string` | `""` | no |
122-
| <a name="input_lambda_attach_dead_letter_policy"></a> [lambda\_attach\_dead\_letter\_policy](#input\_lambda\_attach\_dead\_letter\_policy) | Controls whether SNS/SQS dead letter notification policy should be added to IAM role for Lambda Function | `bool` | `false` | no |
123-
| <a name="input_lambda_dead_letter_target_arn"></a> [lambda\_dead\_letter\_target\_arn](#input\_lambda\_dead\_letter\_target\_arn) | The ARN of an SNS topic or SQS queue to notify when an invocation fails. | `string` | `null` | no |
124123
| <a name="input_lambda_function_ephemeral_storage_size"></a> [lambda\_function\_ephemeral\_storage\_size](#input\_lambda\_function\_ephemeral\_storage\_size) | Amount of ephemeral storage (/tmp) in MB your Lambda Function can use at runtime. Valid value between 512 MB to 10,240 MB (10 GB). | `number` | `512` | no |
125124
| <a name="input_lambda_function_s3_bucket"></a> [lambda\_function\_s3\_bucket](#input\_lambda\_function\_s3\_bucket) | S3 bucket to store artifacts | `string` | `null` | no |
126125
| <a name="input_lambda_function_store_on_s3"></a> [lambda\_function\_store\_on\_s3](#input\_lambda\_function\_store\_on\_s3) | Whether to store produced artifacts on S3 or locally. | `bool` | `false` | no |
127126
| <a name="input_lambda_role"></a> [lambda\_role](#input\_lambda\_role) | IAM role attached to the Lambda Function. If this is set then a role will not be created for you. | `string` | `""` | no |
128127
| <a name="input_lambda_source_path"></a> [lambda\_source\_path](#input\_lambda\_source\_path) | The source path of the custom Lambda function | `string` | `null` | no |
129-
| <a name="input_post_icons_url"></a> [post\_icons\_url](#input\_post\_icons\_url) | URLs (not base64 encoded!) to publically available icons for highlighting posts of error and/or warning status. Ideally 50px square. | <pre>object({<br/> error_url = string<br/> warning_url = string<br/> })</pre> | <pre>{<br/> "error_url": "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-attention-icon.png",<br/> "warning_url": "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-warning-icon.png"<br/>}</pre> | no |
130128
| <a name="input_powertools_layer_arn_suffix"></a> [powertools\_layer\_arn\_suffix](#input\_powertools\_layer\_arn\_suffix) | The suffix of the ARN to use for AWS Powertools lambda layer (must match the architecture:https://docs.powertools.aws.dev/lambda/python/latest/. | `string` | `"AWSLambdaPowertoolsPythonV2-Arm64:79"` | no |
131129
| <a name="input_python_runtime"></a> [python\_runtime](#input\_python\_runtime) | The lambda python runtime | `string` | `"python3.12"` | no |
132130
| <a name="input_recreate_missing_package"></a> [recreate\_missing\_package](#input\_recreate\_missing\_package) | Whether to recreate missing Lambda package if it is missing locally or not | `bool` | `true` | no |
133131
| <a name="input_reserved_concurrent_executions"></a> [reserved\_concurrent\_executions](#input\_reserved\_concurrent\_executions) | The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations | `number` | `-1` | no |
134-
| <a name="input_sns_topic_feedback_role_description"></a> [sns\_topic\_feedback\_role\_description](#input\_sns\_topic\_feedback\_role\_description) | Description of IAM role to use for SNS topic delivery status logging | `string` | `null` | no |
135-
| <a name="input_sns_topic_feedback_role_force_detach_policies"></a> [sns\_topic\_feedback\_role\_force\_detach\_policies](#input\_sns\_topic\_feedback\_role\_force\_detach\_policies) | Specifies to force detaching any policies the IAM role has before destroying it. | `bool` | `true` | no |
136-
| <a name="input_sns_topic_feedback_role_name"></a> [sns\_topic\_feedback\_role\_name](#input\_sns\_topic\_feedback\_role\_name) | Name of the IAM role to use for SNS topic delivery status logging | `string` | `null` | no |
137-
| <a name="input_sns_topic_feedback_role_path"></a> [sns\_topic\_feedback\_role\_path](#input\_sns\_topic\_feedback\_role\_path) | Path of IAM role to use for SNS topic delivery status logging | `string` | `null` | no |
138-
| <a name="input_sns_topic_feedback_role_permissions_boundary"></a> [sns\_topic\_feedback\_role\_permissions\_boundary](#input\_sns\_topic\_feedback\_role\_permissions\_boundary) | The ARN of the policy that is used to set the permissions boundary for the IAM role used by SNS topic delivery status logging | `string` | `null` | no |
139132
| <a name="input_sns_topic_kms_key_id"></a> [sns\_topic\_kms\_key\_id](#input\_sns\_topic\_kms\_key\_id) | ARN of the KMS key used for enabling SSE on the topic | `string` | `""` | no |
140-
| <a name="input_sns_topic_lambda_feedback_role_arn"></a> [sns\_topic\_lambda\_feedback\_role\_arn](#input\_sns\_topic\_lambda\_feedback\_role\_arn) | IAM role for SNS topic delivery status logs. If this is set then a role will not be created for you. | `string` | `""` | no |
141-
| <a name="input_sns_topic_lambda_feedback_sample_rate"></a> [sns\_topic\_lambda\_feedback\_sample\_rate](#input\_sns\_topic\_lambda\_feedback\_sample\_rate) | The percentage of successful deliveries to log | `number` | `100` | no |
142133
| <a name="input_trigger_on_package_timestamp"></a> [trigger\_on\_package\_timestamp](#input\_trigger\_on\_package\_timestamp) | Whether to recreate the Lambda package if the timestamp changes | `bool` | `true` | no |
143134

144135
## Outputs

modules/notify/data.tf

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
account_id_name_mappings.py
2-
notification_emblems.py

0 commit comments

Comments
 (0)