Skip to content

Commit

Permalink
Update to tf12 syntax due to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gilmer committed Jan 14, 2020
1 parent e7ddc48 commit 92d524a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v2.4.0
hooks:
- id: check-json
- id: check-merge-conflict
Expand All @@ -12,12 +12,12 @@ repos:
- id: trailing-whitespace

- repo: git://github.com/igorshubovych/markdownlint-cli
rev: v0.19.0
rev: v0.21.0
hooks:
- id: markdownlint

- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.19.0
rev: v1.22.0
hooks:
- id: terraform_docs
- id: terraform_fmt
1 change: 0 additions & 1 deletion .terraform-version

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
@@ -1,4 +1,3 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Enables AWS Config and configures any compliance changes or AWS Config service
changes to be sent to an SNS topic.

Expand All @@ -20,6 +19,8 @@ module "config-notifications" {
}
```


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
Expand Down
23 changes: 12 additions & 11 deletions main.tf
Expand Up @@ -26,7 +26,7 @@
#

data "aws_sns_topic" "main" {
name = "${var.sns_topic_name}"
name = var.sns_topic_name
}

#
Expand All @@ -36,16 +36,16 @@ data "aws_sns_topic" "main" {
resource "aws_cloudwatch_event_rule" "compliance_event" {
name = "awsconfig-compliance-events"
description = "AWS Config compliance events"
event_pattern = "${file("${path.module}/compliance-event-pattern.json")}"
event_pattern = file("${path.module}/compliance-event-pattern.json")
}

resource "aws_cloudwatch_event_target" "compliance_event" {
rule = "${aws_cloudwatch_event_rule.compliance_event.name}"
rule = aws_cloudwatch_event_rule.compliance_event.name
target_id = "send-to-sns"
arn = "${data.aws_sns_topic.main.arn}"
arn = data.aws_sns_topic.main.arn

input_transformer = {
input_paths {
input_transformer {
input_paths = {
rule = "$.detail.configRuleName"
resource = "$.detail.resourceId"
status = "$.detail.newEvaluationResult.complianceType"
Expand All @@ -58,20 +58,21 @@ resource "aws_cloudwatch_event_target" "compliance_event" {
resource "aws_cloudwatch_event_rule" "config_event" {
name = "awsconfig-events"
description = "AWS Config events"
event_pattern = "${file("${path.module}/config-event-pattern.json")}"
event_pattern = file("${path.module}/config-event-pattern.json")
}

resource "aws_cloudwatch_event_target" "config_event" {
rule = "${aws_cloudwatch_event_rule.config_event.name}"
rule = aws_cloudwatch_event_rule.config_event.name
target_id = "send-to-sns"
arn = "${data.aws_sns_topic.main.arn}"
arn = data.aws_sns_topic.main.arn

input_transformer = {
input_paths {
input_transformer {
input_paths = {
event = "$.detail.eventName"
parameters = "$.detail.requestParameters"
}

input_template = "\"AWS Config Change: Event <event> with request parameters: <parameters>.\""
}
}

3 changes: 2 additions & 1 deletion variables.tf
@@ -1,4 +1,5 @@
variable "sns_topic_name" {
type = "string"
type = string
description = "The name of the SNS topic to send AWS Config notifications."
}

0 comments on commit 92d524a

Please sign in to comment.