Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from KVInventoR/master
Browse files Browse the repository at this point in the history
SNS filter and tags
  • Loading branch information
abhimanyugupta07 authored Jul 30, 2020
2 parents b326c02 + 086c6b1 commit 3d84c4e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-29
### Added
- SQS queue message filter.
- Added tags to SY IAM role and SQS queue.

## [1.3.0] - 2020-03-31
### Added
- Log4j XML for internal Circus Train instance.
Expand Down
4 changes: 4 additions & 0 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -47,4 +49,6 @@ resource "aws_iam_role" "shuntingyard_task" {
]
}
EOF

tags = "${var.shuntingyard_tags}"
}
21 changes: 18 additions & 3 deletions sqs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -33,8 +35,21 @@ resource "aws_sqs_queue_policy" "shuntingyard_sqs_queue_policy" {
POLICY
}

data "template_file" "sqs_hive_metastore_sns_subscription_filter" {
template = <<EOF
{
"qualifiedTableName": [ $${tables_list} ]
}
EOF

vars {
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}"
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}"
}

0 comments on commit 3d84c4e

Please sign in to comment.