From c38aeadc6bed956e932f452d3261adfe086b4ca7 Mon Sep 17 00:00:00 2001 From: Eduard Date: Sat, 25 Jul 2020 21:59:38 +0300 Subject: [PATCH 1/6] added sqs filter --- CHANGELOG.md | 5 +++++ iam.tf | 4 ++++ sqs.tf | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 740374f..7340ab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2020-07-25 +### Added +- SQS queue message filter. +- Tags support for IAM roles. + ## [1.3.0] - 2020-03-31 ### Added - Log4j XML for internal Circus Train instance. diff --git a/iam.tf b/iam.tf index ac4630a..1ab1f60 100644 --- a/iam.tf +++ b/iam.tf @@ -22,6 +22,8 @@ resource "aws_iam_role" "shuntingyard_task_exec" { ] } EOF + + tags = "${var.shuntingyard_tags}" } resource "aws_iam_role_policy_attachment" "task_exec_managed" { @@ -47,4 +49,6 @@ resource "aws_iam_role" "shuntingyard_task" { ] } EOF + + tags = "${var.shuntingyard_tags}" } diff --git a/sqs.tf b/sqs.tf index 15a5bcb..a366a88 100644 --- a/sqs.tf +++ b/sqs.tf @@ -34,7 +34,20 @@ POLICY } resource "aws_sns_topic_subscription" "sqs_hive_metastore_sns_subscription" { - topic_arn = "${var.metastore_events_sns_topic}" - protocol = "sqs" - endpoint = "${aws_sqs_queue.shuntingyard_sqs_queue.arn}" + topic_arn = "${var.metastore_events_sns_topic}" + protocol = "sqs" + endpoint = "${aws_sqs_queue.shuntingyard_sqs_queue.arn}" + filter_policy = "${data.template_file.sqs_hive_metastore_sns_subscription_filter.rendered}" +} + +data "template_file" "sqs_hive_metastore_sns_subscription_filter" { + template = < Date: Wed, 29 Jul 2020 15:50:58 +0300 Subject: [PATCH 2/6] added tags for sqs --- sqs.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqs.tf b/sqs.tf index a366a88..dbb3092 100644 --- a/sqs.tf +++ b/sqs.tf @@ -6,6 +6,8 @@ resource "aws_sqs_queue" "shuntingyard_sqs_queue" { name = "${local.instance_alias}-sqs-queue" + + tags = "${var.shuntingyard_tags}" } resource "aws_sqs_queue_policy" "shuntingyard_sqs_queue_policy" { From 1b75adfcc2750529ccc9abdb7bfd613e210cce85 Mon Sep 17 00:00:00 2001 From: Abhimanyu Gupta Date: Wed, 29 Jul 2020 14:04:42 +0100 Subject: [PATCH 3/6] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7340ab3..11ba495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.3.1] - 2020-07-25 ### Added - SQS queue message filter. -- Tags support for IAM roles. +- Added tags to SY IAM role and SQS queue. ## [1.3.0] - 2020-03-31 ### Added From 20c2efecba817928e5a3bd77bf36a4ee42688659 Mon Sep 17 00:00:00 2001 From: Eduard Date: Wed, 29 Jul 2020 16:07:33 +0300 Subject: [PATCH 4/6] fixes according comments --- CHANGELOG.md | 2 +- sns.tf | 12 ++++++++++++ sqs.tf | 14 +------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7340ab3..e8cec55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [1.3.1] - 2020-07-25 +## [1.3.1] - 2020-07-29 ### Added - SQS queue message filter. - Tags support for IAM roles. diff --git a/sns.tf b/sns.tf index 98af4f7..8e8a4db 100644 --- a/sns.tf +++ b/sns.tf @@ -7,3 +7,15 @@ resource "aws_sns_topic" "shuntingyard_ops_sns" { name = "${local.instance_alias}-operational-events" } + +data "template_file" "sqs_hive_metastore_sns_subscription_filter" { + template = < Date: Wed, 29 Jul 2020 16:12:35 +0300 Subject: [PATCH 5/6] movede aws_sns_topic_subscription --- sns.tf | 7 +++++++ sqs.tf | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sns.tf b/sns.tf index 8e8a4db..239431d 100644 --- a/sns.tf +++ b/sns.tf @@ -19,3 +19,10 @@ EOF tables_list = "${join(",", formatlist("\"%s\"", var.selected_tables))}" } } + +resource "aws_sns_topic_subscription" "sqs_hive_metastore_sns_subscription" { + topic_arn = "${var.metastore_events_sns_topic}" + protocol = "sqs" + endpoint = "${aws_sqs_queue.shuntingyard_sqs_queue.arn}" + filter_policy = "${data.template_file.sqs_hive_metastore_sns_subscription_filter.rendered}" +} diff --git a/sqs.tf b/sqs.tf index 698f2ee..552e588 100644 --- a/sqs.tf +++ b/sqs.tf @@ -34,10 +34,3 @@ resource "aws_sqs_queue_policy" "shuntingyard_sqs_queue_policy" { } POLICY } - -resource "aws_sns_topic_subscription" "sqs_hive_metastore_sns_subscription" { - topic_arn = "${var.metastore_events_sns_topic}" - protocol = "sqs" - endpoint = "${aws_sqs_queue.shuntingyard_sqs_queue.arn}" - filter_policy = "${data.template_file.sqs_hive_metastore_sns_subscription_filter.rendered}" -} From 086c6b186a43c4b18133f7fea65442fe7bbc957d Mon Sep 17 00:00:00 2001 From: Eduard Date: Wed, 29 Jul 2020 16:17:39 +0300 Subject: [PATCH 6/6] moved blocks --- sns.tf | 19 ------------------- sqs.tf | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sns.tf b/sns.tf index 239431d..98af4f7 100644 --- a/sns.tf +++ b/sns.tf @@ -7,22 +7,3 @@ resource "aws_sns_topic" "shuntingyard_ops_sns" { name = "${local.instance_alias}-operational-events" } - -data "template_file" "sqs_hive_metastore_sns_subscription_filter" { - template = <