diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..486a232 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index b79d8b4..6a17b32 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -7,7 +7,6 @@ on: jobs: terraform: name: 'Terraform' - id: terraform runs-on: ubuntu-latest steps: - name: 'Checkout' diff --git a/CHANGELOG.md b/CHANGELOG.md index 518111b..b12fa41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# [1.3.0-alpha.1](https://github.com/scribd/terraform-elasticache-slowlog-to-datadog/compare/v1.2.1...v1.3.0-alpha.1) (2020-04-30) + + +### Bug Fixes + +* give up on using null_resource to save on shipping a binary ([8144204](https://github.com/scribd/terraform-elasticache-slowlog-to-datadog/commit/814420446e1bad24edc00867659550b0e3a98370)) + + +### Features + +* enable multiple invocations of the module in a single account ([9a7a764](https://github.com/scribd/terraform-elasticache-slowlog-to-datadog/commit/9a7a7648c3929e3e3a9f0c06a6f0b03cd644eca8)) + ## [1.2.1](https://github.com/scribd/terraform-elasticache-slowlog-to-datadog/compare/v1.2.0...v1.2.1) (2020-04-29) diff --git a/files/slowlog_check.1.0.1.zip b/files/slowlog_check.1.0.1.zip new file mode 100644 index 0000000..0985c26 --- /dev/null +++ b/files/slowlog_check.1.0.1.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e7e5b31bad2995a9d1cc8dc844024febd93253e9c1dd41f217448699a3bbdd4 +size 345268 diff --git a/locals.tf b/locals.tf new file mode 100644 index 0000000..b51a6b7 --- /dev/null +++ b/locals.tf @@ -0,0 +1,10 @@ +locals { + slowlog_check_archive_basename = "slowlog_check.1.0.1.zip" + slowlog_check_archive_hash = "Xn5bMbrSmVqdHMjchEAk/r2TJT6cHdQfIXRIaZo7vdQ=" # generated with filebase64sha256() + slowlog_check_archive_path = "${path.module}/files/${local.slowlog_check_archive_basename}" + + search_replication_group = "(?P[0-9A-Za-z_-]+)\\.(?P[0-9A-Za-z_-]+)\\.{0,1}(?P[0-9A-Za-z_]*)\\.(?P[0-9A-Za-z_-]+)\\.cache\\.amazonaws\\.com:{0,1}(?P[0-9]*)" + parsed_elasticache_endpoint = regex(local.search_replication_group, var.elasticache_endpoint) + # https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Endpoints.html + replication_group = contains(["clustercfg", "master"], local.parsed_elasticache_endpoint["first"]) ? local.parsed_elasticache_endpoint["second"] : local.parsed_elasticache_endpoint["first"] +} diff --git a/main.tf b/main.tf index bd1776a..df72bae 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,6 @@ resource aws_cloudwatch_event_rule slowlog_check { name_prefix = "slowlog_check_every_minute" - description = "Check for slowlogs every five minutes" + description = "Check for slowlogs every minute" schedule_expression = "rate(1 minute)" tags = var.tags } @@ -20,7 +20,7 @@ resource aws_lambda_permission slowlog_check { resource aws_iam_role slowlog_check { - name = "slowlog_check" + name_prefix = "slowlog_check" assume_role_policy = <