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

chore: reduce number of Nagware emails and Slack notifications #591

Merged

Conversation

craigzour
Copy link
Contributor

@craigzour craigzour commented Feb 6, 2024

Summary | Résumé

related to cds-snc/platform-forms-client#3202

  • Added new free disk space step in some of the Github workflows (more information below)
  • Renamed lambda trigger resources
  • Reworked Nagware to always send emails no matter how old is the detected form response. Nagware will now run on Tuesdays, Thursdays and Sundays. It will only send email on Tuesday and Thursday and will send Slack notifications on Sunday.
  • Added missing environment variable in Nagware and Form archiver lambdas (to reach PostgreSQL while running in Localstack)

New free disk space step in Github workflows

For some reason that still need some investigation, our Github workflow (terraform-plan-staging) has started reaching the limit of the Github runner disk space. There are multiple people on the internet that have encountered the same issue and one of the solutions that always comes back is to use a script that will delete unnecessary resources in the machine.

Here is the Github action I used: free-disk-space

Here is the disk usage (given by the free disk space Github action) when running the terraform-plan-staging workflow:

============ BEGINNING OF WORKFLOW ===============

== BEFORE CLEAN-UP ==

$ dh -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        73G   53G   21G  73% /

== AFTER CLEAN-UP ==

$ dh -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        73G   29G   44G  40% /

============ END OF WORKFLOW ===============

$ dh -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        73G   40G   33G  55% /

@craigzour craigzour self-assigned this Feb 6, 2024
@craigzour craigzour changed the title chore: rename lambda trigger resources chore: reduce number of Nagware emails and Slack notifications Feb 6, 2024
@craigzour craigzour force-pushed the chore/reduce-nagware-emails-and-slack-notifications branch 2 times, most recently from e085303 to e43ed67 Compare February 7, 2024 17:08
@craigzour craigzour force-pushed the chore/reduce-nagware-emails-and-slack-notifications branch from e43ed67 to 3b8b332 Compare February 7, 2024 18:22
@craigzour craigzour force-pushed the chore/reduce-nagware-emails-and-slack-notifications branch from 3b8b332 to b1ce7aa Compare February 7, 2024 19:52
Copy link

github-actions bot commented Feb 7, 2024

⚠ Terrform update available

Terraform: 1.7.2 (using 1.6.6)
Terragrunt: 0.55.1 (using 0.54.8)

Copy link

github-actions bot commented Feb 7, 2024

Staging: secrets

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

⚠️   Warning: resources will be destroyed by this change!

Plan: 1 to add, 0 to change, 1 to destroy
Show summary
CHANGE NAME
recreate aws_secretsmanager_secret_version.notify_callback_bearer_token
Show plan
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # aws_secretsmanager_secret_version.notify_callback_bearer_token must be replaced
-/+ resource "aws_secretsmanager_secret_version" "notify_callback_bearer_token" {
      ~ arn            = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:notify_callback_bearer_token-aXJPLs" -> (known after apply)
      ~ id             = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:notify_callback_bearer_token-aXJPLs|4A43D97C-2937-4E91-A924-ADF60955E459" -> (known after apply)
      ~ secret_string  = (sensitive value) # forces replacement
      ~ version_id     = "4A43D97C-2937-4E91-A924-ADF60955E459" -> (known after apply)
      ~ version_stages = [
          - "AWSPREVIOUS",
        ] -> (known after apply)
        # (1 unchanged attribute hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.freshdesk_api_key"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.notify_api_key"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.notify_callback_bearer_token"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.recaptcha_secret"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.token_secret"]

24 tests, 19 passed, 5 warnings, 0 failures, 0 exceptions

Copy link

github-actions bot commented Feb 7, 2024

Staging: dynamodb

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

Plan: 0 to add, 1 to change, 0 to destroy
Show summary
CHANGE NAME
update aws_dynamodb_table.audit_logs
Show plan
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_dynamodb_table.audit_logs will be updated in-place
  ~ resource "aws_dynamodb_table" "audit_logs" {
        id                          = "AuditLogs"
        name                        = "AuditLogs"
        tags                        = {}
        # (13 unchanged attributes hidden)

      ~ ttl {
          + attribute_name = "ArchiveDate"
            # (1 unchanged attribute hidden)
        }

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.audit_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.reliability_queue"]
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.vault"]

22 tests, 19 passed, 3 warnings, 0 failures, 0 exceptions

Copy link

github-actions bot commented Feb 7, 2024

Staging: app

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

Plan: 1 to add, 0 to change, 0 to destroy
Show summary
CHANGE NAME
add aws_ecs_task_definition.form_viewer
Show plan
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_ecs_task_definition.form_viewer will be created
  + resource "aws_ecs_task_definition" "form_viewer" {
      + arn                      = (known after apply)
      + arn_without_revision     = (known after apply)
      + container_definitions    = jsonencode(
            [
              + {
                  + environment      = [
                      + {
                          + name  = "AUDIT_LOG_QUEUE_URL"
                          + value = "https://sqs.ca-central-1.amazonaws.com/687401027353/audit_log_queue"
                        },
                      + {
                          + name  = "COGNITO_CLIENT_ID"
                          + value = "17bsg3b2b7q5snon007rru264u"
                        },
                      + {
                          + name  = "COGNITO_ENDPOINT_URL"
                          + value = "cognito-idp.ca-central-1.amazonaws.com/ca-central-1_Cguq9JNQ1"
                        },
                      + {
                          + name  = "EMAIL_ADDRESS_CONTACT_US"
                          + value = "assistance+forms-formulaires@cds-snc.ca"
                        },
                      + {
                          + name  = "EMAIL_ADDRESS_SUPPORT"
                          + value = "assistance+forms-formulaires@cds-snc.ca"
                        },
                      + {
                          + name  = "METRIC_PROVIDER"
                          + value = "stdout"
                        },
                      + {
                          + name  = "NEXTAUTH_URL"
                          + value = "https://forms-staging.cdssandbox.xyz"
                        },
                      + {
                          + name  = "RECAPTCHA_V3_SITE_KEY"
                          + value = "6LfJDN4eAAAAAGvdRF7ZnQ7ciqdo1RQnQDFmh0VY"
                        },
                      + {
                          + name  = "REDIS_URL"
                          + value = "gcforms-redis-rep-group.uwpetx.ng.0001.cac1.cache.amazonaws.com"
                        },
                      + {
                          + name  = "RELIABILITY_FILE_STORAGE"
                          + value = "forms-staging-reliability-file-storage"
                        },
                      + {
                          + name  = "REPROCESS_SUBMISSION_QUEUE_URL"
                          + value = "https://sqs.ca-central-1.amazonaws.com/687401027353/reprocess_submission_queue.fifo"
                        },
                      + {
                          + name  = "TEMPLATE_ID"
                          + value = "8d597a1b-a1d6-4e3c-8421-042a2b4158b7"
                        },
                      + {
                          + name  = "TEMPORARY_TOKEN_TEMPLATE_ID"
                          + value = "b6885d06-d10a-422a-973f-05e274d9aa86"
                        },
                      + {
                          + name  = "TRACER_PROVIDER"
                          + value = "stdout"
                        },
                      + {
                          + name  = "VAULT_FILE_STORAGE"
                          + value = "forms-staging-vault-file-storage"
                        },
                    ]
                  + image            = "687401027353.dkr.ecr.ca-central-1.amazonaws.com/form_viewer_staging"
                  + linuxParameters  = {
                      + capabilities = {
                          + drop = [
                              + "ALL",
                            ]
                        }
                    }
                  + logConfiguration = {
                      + logDriver = "awslogs"
                      + options   = {
                          + awslogs-group         = "Forms"
                          + awslogs-region        = "ca-central-1"
                          + awslogs-stream-prefix = "ecs-form-viewer"
                        }
                    }
                  + name             = "form_viewer"
                  + portMappings     = [
                      + {
                          + containerPort = 3000
                        },
                    ]
                  + secrets          = [
                      + {
                          + name      = "NOTIFY_API_KEY"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:notify_api_key-eR3nNp"
                        },
                      + {
                          + name      = "RECAPTCHA_V3_SECRET_KEY"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:recaptcha_secret-tTjsBo"
                        },
                      + {
                          + name      = "DATABASE_URL"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:server-database-url-0PSpE3"
                        },
                      + {
                          + name      = "TOKEN_SECRET"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:token_secret-n5Doyu"
                        },
                      + {
                          + name      = "GC_NOTIFY_CALLBACK_BEARER_TOKEN"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:notify_callback_bearer_token-aXJPLs"
                        },
                      + {
                          + name      = "FRESHDESK_API_KEY"
                          + valueFrom = "arn:aws:secretsmanager:ca-central-1:687401027353:secret:freshdesk_api_key-JVyxop"
                        },
                    ]
                },
            ]
        )
      + cpu                      = "2048"
      + execution_role_arn       = "arn:aws:iam::687401027353:role/form-viewer"
      + family                   = "form-viewer"
      + id                       = (known after apply)
      + memory                   = "4096"
      + network_mode             = "awsvpc"
      + requires_compatibilities = [
          + "FARGATE",
        ]
      + revision                 = (known after apply)
      + skip_destroy             = false
      + tags_all                 = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + task_role_arn            = "arn:aws:iam::687401027353:role/form-viewer"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_appautoscaling_target.forms[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.forms"]
WARN - plan.json - main - Missing Common Tags: ["aws_codedeploy_app.app"]
WARN - plan.json - main - Missing Common Tags: ["aws_codedeploy_deployment_group.app"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_cluster.forms"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_service.form_viewer"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_task_definition.form_viewer"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.cognito"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.forms_dynamodb"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.forms_kms"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.forms_s3"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.forms_secrets_manager"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.forms_sqs"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.codedeploy"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.forms"]

34 tests, 19 passed, 15 warnings, 0 failures, 0 exceptions

Copy link

github-actions bot commented Feb 7, 2024

Staging: lambdas

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

⚠️   Warning: resources will be destroyed by this change!

Plan: 12 to add, 3 to change, 12 to destroy
Show summary
CHANGE NAME
add aws_cloudwatch_event_rule.form_archiver_lambda_trigger
aws_cloudwatch_event_rule.nagware_lambda_trigger
aws_cloudwatch_event_rule.reliability_dlq_lambda_trigger
aws_cloudwatch_event_rule.response_archiver_lambda_trigger
aws_cloudwatch_event_target.form_archiver_lambda_trigger
aws_cloudwatch_event_target.nagware_lambda_trigger
aws_cloudwatch_event_target.reliability_dlq_lambda_trigger
aws_cloudwatch_event_target.response_archiver_lambda_trigger
delete aws_cloudwatch_event_rule.cron_2am_every_day
aws_cloudwatch_event_rule.cron_3am_every_day
aws_cloudwatch_event_rule.cron_4am_every_day
aws_cloudwatch_event_rule.cron_5am_every_business_day
aws_cloudwatch_event_target.run_archive_form_responses_lambda_every_day
aws_cloudwatch_event_target.run_archive_form_templates_lambda_every_day
aws_cloudwatch_event_target.run_dead_letter_queue_consumer_lambda_every_day
aws_cloudwatch_event_target.run_nagware_lambda_every_day
update aws_lambda_function.nagware
aws_lambda_function.vault_integrity
aws_s3_object.nagware_code
recreate aws_lambda_permission.allow_cloudwatch_to_run_archive_form_responses_lambda
aws_lambda_permission.allow_cloudwatch_to_run_dead_letter_queue_consumer_lambda
aws_lambda_permission.allow_cloudwatch_to_run_form_archiver_lambda
aws_lambda_permission.allow_cloudwatch_to_run_nagware_lambda
Show plan
Resource actions are indicated with the following symbols:
  + create
  ~ update in-place
  - destroy
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # aws_cloudwatch_event_rule.cron_2am_every_day will be destroyed
  # (because aws_cloudwatch_event_rule.cron_2am_every_day is not in configuration)
  - resource "aws_cloudwatch_event_rule" "cron_2am_every_day" {
      - arn                 = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-2am" -> null
      - description         = "Fires every day at 2am EST" -> null
      - event_bus_name      = "default" -> null
      - id                  = "every-day-at-2am" -> null
      - is_enabled          = true -> null
      - name                = "every-day-at-2am" -> null
      - schedule_expression = "cron(0 7 * * ? *)" -> null
      - state               = "ENABLED" -> null
      - tags                = {} -> null
      - tags_all            = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
    }

  # aws_cloudwatch_event_rule.cron_3am_every_day will be destroyed
  # (because aws_cloudwatch_event_rule.cron_3am_every_day is not in configuration)
  - resource "aws_cloudwatch_event_rule" "cron_3am_every_day" {
      - arn                 = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-3am" -> null
      - description         = "Fires every day at 3am EST" -> null
      - event_bus_name      = "default" -> null
      - id                  = "every-day-at-3am" -> null
      - is_enabled          = true -> null
      - name                = "every-day-at-3am" -> null
      - schedule_expression = "cron(0 8 * * ? *)" -> null
      - state               = "ENABLED" -> null
      - tags                = {} -> null
      - tags_all            = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
    }

  # aws_cloudwatch_event_rule.cron_4am_every_day will be destroyed
  # (because aws_cloudwatch_event_rule.cron_4am_every_day is not in configuration)
  - resource "aws_cloudwatch_event_rule" "cron_4am_every_day" {
      - arn                 = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-4am" -> null
      - description         = "Fires every day at 4am EST" -> null
      - event_bus_name      = "default" -> null
      - id                  = "every-day-at-4am" -> null
      - is_enabled          = true -> null
      - name                = "every-day-at-4am" -> null
      - schedule_expression = "cron(0 9 * * ? *)" -> null
      - state               = "ENABLED" -> null
      - tags                = {} -> null
      - tags_all            = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
    }

  # aws_cloudwatch_event_rule.cron_5am_every_business_day will be destroyed
  # (because aws_cloudwatch_event_rule.cron_5am_every_business_day is not in configuration)
  - resource "aws_cloudwatch_event_rule" "cron_5am_every_business_day" {
      - arn                 = "arn:aws:events:ca-central-1:687401027353:rule/every-business-day-at-5am" -> null
      - description         = "Fires every business day at 5am EST" -> null
      - event_bus_name      = "default" -> null
      - id                  = "every-business-day-at-5am" -> null
      - is_enabled          = true -> null
      - name                = "every-business-day-at-5am" -> null
      - schedule_expression = "cron(0 10 ? * MON-FRI *)" -> null
      - state               = "ENABLED" -> null
      - tags                = {} -> null
      - tags_all            = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
    }

  # aws_cloudwatch_event_rule.form_archiver_lambda_trigger will be created
  + resource "aws_cloudwatch_event_rule" "form_archiver_lambda_trigger" {
      + arn                 = (known after apply)
      + description         = "Fires every day at 4am EST"
      + event_bus_name      = "default"
      + id                  = (known after apply)
      + name                = "form-archiver-lambda-trigger"
      + name_prefix         = (known after apply)
      + schedule_expression = "cron(0 9 * * ? *)"
      + tags_all            = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
    }

  # aws_cloudwatch_event_rule.nagware_lambda_trigger will be created
  + resource "aws_cloudwatch_event_rule" "nagware_lambda_trigger" {
      + arn                 = (known after apply)
      + description         = "Fires every Tuesday, Thursday and Sunday at 5am EST"
      + event_bus_name      = "default"
      + id                  = (known after apply)
      + name                = "nagware-lambda-trigger"
      + name_prefix         = (known after apply)
      + schedule_expression = "cron(0 10 * * TUE,THU,SUN *)"
      + tags_all            = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
    }

  # aws_cloudwatch_event_rule.reliability_dlq_lambda_trigger will be created
  + resource "aws_cloudwatch_event_rule" "reliability_dlq_lambda_trigger" {
      + arn                 = (known after apply)
      + description         = "Fires every day at 2am EST"
      + event_bus_name      = "default"
      + id                  = (known after apply)
      + name                = "reliability-dlq-lambda-trigger"
      + name_prefix         = (known after apply)
      + schedule_expression = "cron(0 7 * * ? *)"
      + tags_all            = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
    }

  # aws_cloudwatch_event_rule.response_archiver_lambda_trigger will be created
  + resource "aws_cloudwatch_event_rule" "response_archiver_lambda_trigger" {
      + arn                 = (known after apply)
      + description         = "Fires every day at 3am EST"
      + event_bus_name      = "default"
      + id                  = (known after apply)
      + name                = "response-archiver-lambda-trigger"
      + name_prefix         = (known after apply)
      + schedule_expression = "cron(0 8 * * ? *)"
      + tags_all            = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
    }

  # aws_cloudwatch_event_target.form_archiver_lambda_trigger will be created
  + resource "aws_cloudwatch_event_target" "form_archiver_lambda_trigger" {
      + arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Archive_Form_Templates"
      + event_bus_name = "default"
      + id             = (known after apply)
      + rule           = "form-archiver-lambda-trigger"
      + target_id      = (known after apply)
    }

  # aws_cloudwatch_event_target.nagware_lambda_trigger will be created
  + resource "aws_cloudwatch_event_target" "nagware_lambda_trigger" {
      + arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Nagware"
      + event_bus_name = "default"
      + id             = (known after apply)
      + rule           = "nagware-lambda-trigger"
      + target_id      = (known after apply)
    }

  # aws_cloudwatch_event_target.reliability_dlq_lambda_trigger will be created
  + resource "aws_cloudwatch_event_target" "reliability_dlq_lambda_trigger" {
      + arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Reliability_DLQ_Consumer"
      + event_bus_name = "default"
      + id             = (known after apply)
      + rule           = "reliability-dlq-lambda-trigger"
      + target_id      = (known after apply)
    }

  # aws_cloudwatch_event_target.response_archiver_lambda_trigger will be created
  + resource "aws_cloudwatch_event_target" "response_archiver_lambda_trigger" {
      + arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Response_Archiver"
      + event_bus_name = "default"
      + id             = (known after apply)
      + rule           = "response-archiver-lambda-trigger"
      + target_id      = (known after apply)
    }

  # aws_cloudwatch_event_target.run_archive_form_responses_lambda_every_day will be destroyed
  # (because aws_cloudwatch_event_target.run_archive_form_responses_lambda_every_day is not in configuration)
  - resource "aws_cloudwatch_event_target" "run_archive_form_responses_lambda_every_day" {
      - arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Response_Archiver" -> null
      - event_bus_name = "default" -> null
      - id             = "every-day-at-3am-terraform-2023120721571581470000000e" -> null
      - rule           = "every-day-at-3am" -> null
      - target_id      = "terraform-2023120721571581470000000e" -> null
    }

  # aws_cloudwatch_event_target.run_archive_form_templates_lambda_every_day will be destroyed
  # (because aws_cloudwatch_event_target.run_archive_form_templates_lambda_every_day is not in configuration)
  - resource "aws_cloudwatch_event_target" "run_archive_form_templates_lambda_every_day" {
      - arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Archive_Form_Templates" -> null
      - event_bus_name = "default" -> null
      - id             = "every-day-at-4am-terraform-2023120721571539640000000b" -> null
      - rule           = "every-day-at-4am" -> null
      - target_id      = "terraform-2023120721571539640000000b" -> null
    }

  # aws_cloudwatch_event_target.run_dead_letter_queue_consumer_lambda_every_day will be destroyed
  # (because aws_cloudwatch_event_target.run_dead_letter_queue_consumer_lambda_every_day is not in configuration)
  - resource "aws_cloudwatch_event_target" "run_dead_letter_queue_consumer_lambda_every_day" {
      - arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Reliability_DLQ_Consumer" -> null
      - event_bus_name = "default" -> null
      - id             = "every-day-at-2am-terraform-2023120721571560770000000d" -> null
      - rule           = "every-day-at-2am" -> null
      - target_id      = "terraform-2023120721571560770000000d" -> null
    }

  # aws_cloudwatch_event_target.run_nagware_lambda_every_day will be destroyed
  # (because aws_cloudwatch_event_target.run_nagware_lambda_every_day is not in configuration)
  - resource "aws_cloudwatch_event_target" "run_nagware_lambda_every_day" {
      - arn            = "arn:aws:lambda:ca-central-1:687401027353:function:Nagware" -> null
      - event_bus_name = "default" -> null
      - id             = "every-business-day-at-5am-terraform-2023120721571552610000000c" -> null
      - rule           = "every-business-day-at-5am" -> null
      - target_id      = "terraform-2023120721571552610000000c" -> null
    }

  # aws_lambda_function.nagware will be updated in-place
  ~ resource "aws_lambda_function" "nagware" {
        id                             = "Nagware"
      ~ last_modified                  = "2024-01-12T15:13:35.000+0000" -> (known after apply)
      ~ s3_object_version              = "n2CchU5tzvaGrJ6t8zKWUGLAvN.9tWij" -> (known after apply)
      ~ source_code_hash               = "MiiK5e/6TJjDywdEaAWyRxtz746ExWQdSBcWjBxYyPk=" -> "2ZP5o8tCbep27P53xhm8tjX9DytomL5qhN8DZAlAVhQ="
        tags                           = {}
        # (21 unchanged attributes hidden)

      ~ environment {
          ~ variables = {
              - "SNS_ERROR_TOPIC_ARN"       = "arn:aws:sns:ca-central-1:687401027353:alert-critical" -> null
                # (10 unchanged elements hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

  # aws_lambda_function.vault_integrity will be updated in-place
  ~ resource "aws_lambda_function" "vault_integrity" {
        id                             = "Vault_Data_Integrity_Check"
      ~ last_modified                  = "2024-01-25T17:03:56.000+0000" -> (known after apply)
      ~ source_code_hash               = "PD5RmSEVjAYMZc1lvfSSn6O3RadR+J09hCPKVbQS/+g=" -> "TowbMcppnki+0a5fq50Oral3CqleiwGw7U1igvFz0Ws="
        tags                           = {}
        # (24 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # aws_lambda_permission.allow_cloudwatch_to_run_archive_form_responses_lambda must be replaced
-/+ resource "aws_lambda_permission" "allow_cloudwatch_to_run_archive_form_responses_lambda" {
      ~ id                  = "AllowExecutionFromCloudWatch" -> (known after apply)
      ~ source_arn          = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-3am" # forces replacement -> (known after apply) # forces replacement
      + statement_id_prefix = (known after apply)
        # (4 unchanged attributes hidden)
    }

  # aws_lambda_permission.allow_cloudwatch_to_run_dead_letter_queue_consumer_lambda must be replaced
-/+ resource "aws_lambda_permission" "allow_cloudwatch_to_run_dead_letter_queue_consumer_lambda" {
      ~ id                  = "AllowExecutionFromCloudWatch" -> (known after apply)
      ~ source_arn          = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-2am" # forces replacement -> (known after apply) # forces replacement
      + statement_id_prefix = (known after apply)
        # (4 unchanged attributes hidden)
    }

  # aws_lambda_permission.allow_cloudwatch_to_run_form_archiver_lambda must be replaced
-/+ resource "aws_lambda_permission" "allow_cloudwatch_to_run_form_archiver_lambda" {
      ~ id                  = "AllowExecutionFromCloudWatch" -> (known after apply)
      ~ source_arn          = "arn:aws:events:ca-central-1:687401027353:rule/every-day-at-4am" # forces replacement -> (known after apply) # forces replacement
      + statement_id_prefix = (known after apply)
        # (4 unchanged attributes hidden)
    }

  # aws_lambda_permission.allow_cloudwatch_to_run_nagware_lambda must be replaced
-/+ resource "aws_lambda_permission" "allow_cloudwatch_to_run_nagware_lambda" {
      ~ id                  = "AllowExecutionFromCloudWatch" -> (known after apply)
      ~ source_arn          = "arn:aws:events:ca-central-1:687401027353:rule/every-business-day-at-5am" # forces replacement -> (known after apply) # forces replacement
      + statement_id_prefix = (known after apply)
        # (4 unchanged attributes hidden)
    }

  # aws_s3_object.nagware_code will be updated in-place
  ~ resource "aws_s3_object" "nagware_code" {
        id                     = "nagware_code"
      ~ source_hash            = "MiiK5e/6TJjDywdEaAWyRxtz746ExWQdSBcWjBxYyPk=" -> "2ZP5o8tCbep27P53xhm8tjX9DytomL5qhN8DZAlAVhQ="
        tags                   = {}
      ~ version_id             = "n2CchU5tzvaGrJ6t8zKWUGLAvN.9tWij" -> (known after apply)
        # (11 unchanged attributes hidden)
    }

Plan: 12 to add, 3 to change, 12 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.form_archiver_lambda_trigger"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.nagware_lambda_trigger"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.reliability_dlq_lambda_trigger"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.response_archiver_lambda_trigger"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.archive_form_templates"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.audit_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.dead_letter_queue_consumer"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.nagware"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.reliability"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.response_archiver"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.submission"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.vault_integrity"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_dynamodb"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_kms"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_logging"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_rds"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_s3"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_secrets"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_sns"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.lambda_sqs"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.lambda"]
WARN - plan.json - main - Missing Common Tags: ["aws_lambda_function.audit_logs"]
WARN - plan.json - main - Missing Common Tags:...

@craigzour craigzour marked this pull request as ready for review February 7, 2024 20:32
Copy link
Contributor

@bryan-robitaille bryan-robitaille left a comment

Choose a reason for hiding this comment

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

LGMT 👍

@craigzour craigzour merged commit 655061a into develop Feb 8, 2024
4 checks passed
@craigzour craigzour deleted the chore/reduce-nagware-emails-and-slack-notifications branch February 8, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants