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

fix: handle duplicate log events #511

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Conversation

bryan-robitaille
Copy link
Contributor

Summary | Résumé

Adds the ability to handle audit log events that have the same hash and sort key.

Duplicate events are recorded in the logs and a warning is raised in Slack.

Logic can be tested here: https://codesandbox.io/p/sandbox/serene-tereshkova-3i9onl

@github-actions
Copy link

⚠ Terrform update available

Terraform: 1.6.1 (using 1.4.2)
Terragrunt: 0.52.1 (using 0.46.3)

@github-actions
Copy link

Staging: app

✅   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_lambda_function.audit_logs
Show plan
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_lambda_function.audit_logs will be updated in-place
  ~ resource "aws_lambda_function" "audit_logs" {
        id                             = "AuditLogs"
      ~ last_modified                  = "2023-10-11T16:13:48.000+0000" -> (known after apply)
      ~ source_code_hash               = "syjjAQLD01eCL0P9DX8802i6FjQZGPQHfIxf2rIFrTw=" -> "D+znb19Vjp8Q9nqFkVJze635ACkzsT7CtKnPs4GHyS4="
        tags                           = {
            "CostCentre" = "forms-platform-staging"
            "Terraform"  = "true"
        }
        # (18 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

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

Warning: Argument is deprecated

  with aws_s3_bucket.reliability_file_storage,
  on s3.tf line 4, in resource "aws_s3_bucket" "reliability_file_storage":
   4: resource "aws_s3_bucket" "reliability_file_storage" {

Use the aws_s3_bucket_lifecycle_configuration resource instead

(and 17 more similar warnings elsewhere)

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

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_2am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_3am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_4am_every_day"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cron_5am_every_business_day"]
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.archiver"]
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.submission"]

28 tests, 17 passed, 11 warnings, 0 failures, 0 exceptions

Copy link
Contributor

@craigzour craigzour left a comment

Choose a reason for hiding this comment

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

LGTM :)

@bryan-robitaille bryan-robitaille merged commit e8de8d6 into develop Oct 12, 2023
4 checks passed
@bryan-robitaille bryan-robitaille deleted the fix/duplicate_log_events branch October 12, 2023 14:40
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