Created
September 10, 2021 18:02
Very valid but very ugly HCL2 file which break the parsers and IAC Security tools (terrascan, checkov, etc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_db_instance" "valid_but_ugly" { | |
allocated_storage = 20 | |
storage_type = "gp2" | |
engine = "mysql" | |
engine_version = "5.7" | |
instance_class = "db.t2.micro" | |
# flip value to true/false will return multiple violations. | |
iam_database_authentication_enabled = local.test2.some[0] == "dd" #tobool("true") | |
#(true == true) | |
#local.test2.some[0] | |
} | |
output test2 { value = local.test2 } | |
output test3 { value = local.test2.some[0] != true } | |
locals { | |
test2 = { | |
some = [ | |
"asd${~ | |
" aa ${ | |
123 | |
+ | |
345 | |
+ | |
{a:{b:tonumber("1")}}.a.b + | |
({a:{b:tonumber("1")}}).a.b + // Comment 1 | |
(({a:{b:tonumber("1")}}).a).b + | |
({a:{b:tonumber( | |
"1${join("", ["1","2","0${"3"}1"])}1" | |
)}}).a.b + | |
tonumber("000%{~ for x in [1,"0${2}0",3] ~}1${x}%{~endfor~}") + | |
tonumber("-00%{ if false}999%{ else }333%{ endif }00") | |
} zz " | |
~}zxc" | |
, | |
"one line string", | |
"multi\nline\nstring" | |
, | |
<<END | |
000%{~ for x in [1,"0${2}0",3] ~}1${x}%{~endfor~} | |
-00%{ if false}999%{ else }333%{ endif }00 | |
END | |
, <<-END | |
foobar | |
END | |
, | |
<<-EOT1 | |
${<<EOT2 | |
${<<-EOT3 | |
level 3 | |
EOT3 | |
} level 2 | |
EOT2 | |
} level 1 | |
EOT1 | |
, | |
<<-EOT | |
${<<EOT | |
${<<-EOT | |
level 3 | |
EOT | |
} level 2 | |
EOT | |
} level 1 | |
EOT | |
, | |
]} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment