Skip to content

Commit 9a39f66

Browse files
committed
feat: addindg the ability to pass into the monitor specification
1 parent 67ec518 commit 9a39f66

6 files changed

+99
-42
lines changed

.terraform.lock.hcl

-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.tflint.hcl

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
plugin "aws" {
2+
enabled = true
3+
version = "0.32.0"
4+
source = "github.com/terraform-linters/tflint-ruleset-aws"
5+
}
6+
7+
plugin "terraform" {
8+
enabled = true
9+
version = "0.7.0"
10+
source = "github.com/terraform-linters/tflint-ruleset-terraform"
11+
}
12+
13+
config {
14+
call_module_type = "local"
15+
force = false
16+
}
17+
18+
rule "terraform_required_providers" {
19+
enabled = true
20+
}
21+
22+
rule "terraform_required_version" {
23+
enabled = true
24+
}
25+
26+
rule "terraform_naming_convention" {
27+
enabled = true
28+
format = "snake_case"
29+
}
30+
31+
rule "terraform_typed_variables" {
32+
enabled = true
33+
}
34+
35+
rule "terraform_unused_declarations" {
36+
enabled = true
37+
}
38+
39+
rule "terraform_comment_syntax" {
40+
enabled = true
41+
}
42+
43+
rule "terraform_deprecated_index" {
44+
enabled = true
45+
}
46+
47+
rule "terraform_deprecated_interpolation" {
48+
enabled = true
49+
}
50+
51+
rule "terraform_documented_outputs" {
52+
enabled = true
53+
}
54+
55+
rule "terraform_documented_variables" {
56+
enabled = true
57+
}
58+
59+
rule "terraform_module_pinned_source" {
60+
enabled = true
61+
}
62+
63+
rule "terraform_standard_module_structure" {
64+
enabled = true
65+
}
66+
67+
rule "terraform_workspace_remote" {
68+
enabled = true
69+
}

.trivyignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
AVD-DS-0002 # (Dockerfile) Least Privilege User (HIGH) - https://avd.aquasec.com/misconfig/dockerfile/general/avd-ds-0002/
2+
AVD-DS-0013 # (Dockerfile) Use Workdir Over Cd (MEDIUM) - https://avd.aquasec.com/misconfig/dockerfile/general/avd-ds-0013/
3+
AVD-DS-0015 # (Dockerfile) Use COPY instead of ADD (MEDIUM) - https://avd.aquasec.com/misconfig/dockerfile/general/avd-ds-0015/
4+
AVD-DS-0026 # (Dockerfile) Add HEALTHCHECK instruction in your Dockerfile (LOW) - https://avd.aquasec.com/misconfig/dockerfile/general/avd-ds-0013/

Makefile

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#
2-
# Copyright (C) 2024 Appvia Ltd <[email protected]>
3-
#
42
# This program is free software; you can redistribute it and/or
53
# modify it under the terms of the GNU General Public License
64
# as published by the Free Software Foundation; either version 2
@@ -14,15 +12,23 @@
1412
# You should have received a copy of the GNU General Public License
1513
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1614
#
17-
AUTHOR_EMAIL[email protected]
18-
19-
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init
15+
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples tests
2016

2117
default: all
2218

2319
all:
2420
$(MAKE) init
2521
$(MAKE) validate
22+
$(MAKE) tests
23+
$(MAKE) lint
24+
$(MAKE) security
25+
$(MAKE) format
26+
$(MAKE) documentation
27+
28+
examples:
29+
$(MAKE) validate-examples
30+
$(MAKE) tests
31+
$(MAKE) lint-examples
2632
$(MAKE) lint
2733
$(MAKE) security
2834
$(MAKE) format
@@ -52,7 +58,7 @@ init:
5258

5359
security:
5460
@echo "--> Running Security checks"
55-
@tfsec .
61+
@trivy config .
5662
$(MAKE) security-modules
5763
$(MAKE) security-examples
5864

@@ -61,7 +67,7 @@ security-modules:
6167
@if [ -d modules ]; then \
6268
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
6369
echo "--> Validating $$dir"; \
64-
tfsec $$dir; \
70+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
6571
done; \
6672
fi
6773

@@ -70,10 +76,14 @@ security-examples:
7076
@if [ -d examples ]; then \
7177
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
7278
echo "--> Validating $$dir"; \
73-
tfsec $$dir; \
79+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
7480
done; \
7581
fi
7682

83+
tests:
84+
@echo "--> Running Terraform Tests"
85+
@terraform test
86+
7787
validate:
7888
@echo "--> Running terraform validate"
7989
@terraform init -backend=false
@@ -138,7 +148,3 @@ clean:
138148
echo "--> Removing $$dir"; \
139149
rm -rf $$dir; \
140150
done
141-
@find . -type d -name "builds" | while read -r dir; do \
142-
echo "--> Removing $$dir"; \
143-
rm -rf $$dir; \
144-
done

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ The `terraform-docs` utility is used to generate this README. Follow the below s
4949

5050
| Name | Version |
5151
|------|---------|
52-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.49.0 |
52+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.52.0 |
5353

5454
## Modules
5555

5656
| Name | Source | Version |
5757
|------|--------|---------|
58-
| <a name="module_notifications"></a> [notifications](#module\_notifications) | appvia/notifications/aws | 0.1.4 |
58+
| <a name="module_notifications"></a> [notifications](#module\_notifications) | appvia/notifications/aws | 0.1.7 |
5959

6060
## Resources
6161

main.tf

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module "notifications" {
44
count = var.enable_notification_creation ? 1 : 0
55
source = "appvia/notifications/aws"
6-
version = "0.1.4"
6+
version = "0.1.7"
77

88
allowed_aws_services = ["budgets.amazonaws.com", "lambda.amazonaws.com"]
99
create_sns_topic = local.enable_sns_topic_creation
@@ -17,10 +17,11 @@ module "notifications" {
1717
resource "aws_ce_anomaly_monitor" "this" {
1818
for_each = { for x in var.monitors : x.name => x }
1919

20-
name = each.value.name
21-
monitor_type = each.value.monitor_type
22-
monitor_dimension = each.value.monitor_dimension
23-
tags = var.tags
20+
name = each.value.name
21+
monitor_type = each.value.monitor_type
22+
monitor_dimension = each.value.monitor_dimension
23+
monitor_specification = try(each.value.monitor_specification, null)
24+
tags = var.tags
2425
}
2526

2627
## Provision the subscriptions to the anomaly detection monitors

0 commit comments

Comments
 (0)