Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update modules #1524

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws/common/budget.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_budgets_budget" "notify_global" {
}

module "budget_notifier" {
source = "github.com/cds-snc/terraform-modules//spend_notifier?ref=v9.2.6"
source = "github.com/cds-snc/terraform-modules//spend_notifier?ref=v9.6.4"
daily_spend_notifier_hook = var.budget_sre_bot_webhook
weekly_spend_notifier_hook = var.budget_sre_bot_webhook
billing_tag_value = "notification-canada-ca-${var.env}"
Expand Down
20 changes: 12 additions & 8 deletions aws/common/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ resource "aws_s3_bucket_public_access_block" "csv_bucket" {
}

module "csv_bucket_logs" {
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.0.3"
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.1.5"

bucket_name = "notification-canada-ca-${var.env}-csv-upload-logs"
force_destroy = var.force_destroy_s3
billing_tag_value = "notification-canada-ca-${var.env}"
versioning_status = "Enabled"

lifecycle_rule = { "lifecycle_rule" : { "enabled" : "true", "expiration" : { "days" : "90" } } }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lifecycle_rule block should be properly indented for better readability. Consider aligning the nested elements.


Expand Down Expand Up @@ -218,11 +219,12 @@ resource "aws_s3_bucket_public_access_block" "scan_files_document_bucket" {
}

module "document_download_logs" {
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.0.3"
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.1.5"

bucket_name = "notification-canada-ca-${var.env}-document-download-logs"
force_destroy = var.force_destroy_s3
billing_tag_value = "notification-canada-ca-${var.env}"
versioning_status = "Enabled"

lifecycle_rule = { "lifecycle_rule" : { "enabled" : "true", "expiration" : { "days" : "90" } } }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lifecycle_rule attribute is defined as a map with a single key lifecycle_rule. This seems redundant and could be simplified. Consider defining lifecycle_rule directly as an object without the extra nesting.


Expand Down Expand Up @@ -351,11 +353,12 @@ resource "aws_s3_bucket_public_access_block" "athena_bucket" {
}

module "athena_logs_bucket" {
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.0.3"
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.1.5"

bucket_name = "notification-canada-ca-${var.env}-athena-logs"
force_destroy = var.force_destroy_s3
billing_tag_value = "notification-canada-ca-${var.env}"
versioning_status = "Enabled"

lifecycle_rule = { "lifecycle_rule" : { "enabled" : "true", "expiration" : { "days" : "90" } } }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lifecycle_rule block is using a map with a single key-value pair. Consider simplifying it by directly defining the lifecycle rule without the extra map nesting.


Expand All @@ -365,14 +368,15 @@ module "athena_logs_bucket" {
}

module "cbs_logs_bucket" {
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.0.3"
source = "github.com/cds-snc/terraform-modules//S3_log_bucket?ref=v6.1.5"
count = var.create_cbs_bucket ? 1 : 0

bucket_name = var.cbs_satellite_bucket_name
force_destroy = var.force_destroy_s3
billing_tag_value = "notification-canada-ca-${var.env}"
attach_lb_log_delivery_policy = true
attach_elb_log_delivery_policy = true
versioning_status = "Enabled"

lifecycle_rule = { "lifecycle_rule" : { "enabled" : "true", "expiration" : { "days" : "90" } } }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lifecycle_rule block should be updated to use a list of maps instead of a single map. This ensures compatibility with the latest Terraform best practices and module expectations. Example:

lifecycle_rule = [
  {
    id      = "lifecycle_rule"
    enabled = true
    expiration = {
      days = 90
    }
  }
]


Expand All @@ -382,7 +386,7 @@ module "cbs_logs_bucket" {
}

module "sns_sms_usage_report_bucket" {
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.2.3"
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.6.4"

bucket_name = "notification-canada-ca-${var.env}-sms-usage-logs"
force_destroy = var.force_destroy_s3
Expand Down Expand Up @@ -462,7 +466,7 @@ module "sns_sms_usage_report_bucket_us_west_2" {
aws = aws.us-west-2
}

source = "github.com/cds-snc/terraform-modules//S3?ref=v9.2.3"
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.6.4"

bucket_name = "notification-canada-ca-${var.env}-sms-usage-west-2-logs"
force_destroy = var.force_destroy_s3
Expand Down Expand Up @@ -540,7 +544,7 @@ POLICY
}

module "sns_sms_usage_report_sanitized_bucket" {
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.2.3"
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.6.4"

bucket_name = "notification-canada-ca-${var.env}-sms-usage-logs-san"
force_destroy = var.force_destroy_s3
Expand All @@ -557,7 +561,7 @@ module "sns_sms_usage_report_sanitized_bucket_us_west_2" {
aws = aws.us-west-2
}

source = "github.com/cds-snc/terraform-modules//S3?ref=v9.2.3"
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.6.4"

bucket_name = "notification-canada-ca-${var.env}-sms-usage-west-2-logs-san"
force_destroy = var.force_destroy_s3
Expand Down
8 changes: 4 additions & 4 deletions aws/common/slack.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Doc: https://registry.terraform.io/modules/terraform-aws-modules/notify-slack/aws/
module "notify_slack_warning" {
source = "terraform-aws-modules/notify-slack/aws"
version = "6.0.0"
version = "6.4.1"

create_sns_topic = false
sns_topic_name = aws_sns_topic.notification-canada-ca-alert-warning.name
Expand All @@ -19,7 +19,7 @@ module "notify_slack_warning" {

module "notify_slack_ok" {
source = "terraform-aws-modules/notify-slack/aws"
version = "6.0.0"
version = "6.4.1"

create_sns_topic = false
sns_topic_name = aws_sns_topic.notification-canada-ca-alert-ok.name
Expand All @@ -37,7 +37,7 @@ module "notify_slack_ok" {

module "notify_slack_critical" {
source = "terraform-aws-modules/notify-slack/aws"
version = "6.0.0"
version = "6.4.1"

create_sns_topic = false
sns_topic_name = aws_sns_topic.notification-canada-ca-alert-critical.name
Expand All @@ -56,7 +56,7 @@ module "notify_slack_critical" {
# Shared generic slack webhook & topic.
module "notify_slack_general" {
source = "terraform-aws-modules/notify-slack/aws"
version = "6.0.0"
version = "6.4.1"

create_sns_topic = false
sns_topic_name = aws_sns_topic.notification-canada-ca-alert-general.name
Expand Down
Loading