From 3f6a75e9ac5f81aed5bc6205238cc3f5b43f0060 Mon Sep 17 00:00:00 2001 From: Cesar Rodriguez Date: Wed, 22 Jul 2020 22:36:59 -0400 Subject: [PATCH] adds terrascan tests --- .automation/test/terraform_terrascan/README.md | 0 .../test/terraform_terrascan/bad/terraform_bad_1.tf | 9 +++++++++ .../test/terraform_terrascan/good/terraform_good_1.tf | 9 +++++++++ .../terraform_terrascan/reports/expected-TERRAFORM.tap | 7 +++++++ 4 files changed, 25 insertions(+) create mode 100644 .automation/test/terraform_terrascan/README.md create mode 100644 .automation/test/terraform_terrascan/bad/terraform_bad_1.tf create mode 100644 .automation/test/terraform_terrascan/good/terraform_good_1.tf create mode 100644 .automation/test/terraform_terrascan/reports/expected-TERRAFORM.tap diff --git a/.automation/test/terraform_terrascan/README.md b/.automation/test/terraform_terrascan/README.md new file mode 100644 index 00000000..e69de29b diff --git a/.automation/test/terraform_terrascan/bad/terraform_bad_1.tf b/.automation/test/terraform_terrascan/bad/terraform_bad_1.tf new file mode 100644 index 00000000..f2f87778 --- /dev/null +++ b/.automation/test/terraform_terrascan/bad/terraform_bad_1.tf @@ -0,0 +1,9 @@ +resource "aws_instance" "bad" { + ami = "ami-0ff8a91507f77f867" + instance_type = "t2.small" + associate_public_ip_address = true + + ebs_block_device { + encrypted = false + } +} diff --git a/.automation/test/terraform_terrascan/good/terraform_good_1.tf b/.automation/test/terraform_terrascan/good/terraform_good_1.tf new file mode 100644 index 00000000..59d24f7e --- /dev/null +++ b/.automation/test/terraform_terrascan/good/terraform_good_1.tf @@ -0,0 +1,9 @@ +resource "aws_instance" "good" { + ami = "ami-0ff8a91507f77f867" + instance_type = "t2.small" + associate_public_ip_address = false + + ebs_block_device { + encrypted = true + } +} diff --git a/.automation/test/terraform_terrascan/reports/expected-TERRAFORM.tap b/.automation/test/terraform_terrascan/reports/expected-TERRAFORM.tap new file mode 100644 index 00000000..3434675d --- /dev/null +++ b/.automation/test/terraform_terrascan/reports/expected-TERRAFORM.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - terraform_bad_1.tf + --- + message: Failed to load configurations. 1 error(s) occurred \n\nError Invalid expression\n\n on /tmp/lint/.automation/test/terraform/bad/terraform_bad_1.tf line 3, in resource "aws_instance" "bad" \n 3 instance_type = # invalid type!\n 4 }\n\nExpected the start of an expression, but found an invalid expression token.\n + ... +ok 2 - terraform_good_1.tf