Skip to content

Instantly share code, notes, and snippets.

@antonbabenko
Created September 10, 2021 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonbabenko/9f2bd2f026d8184131ca1f89bded2cfc to your computer and use it in GitHub Desktop.
Save antonbabenko/9f2bd2f026d8184131ca1f89bded2cfc to your computer and use it in GitHub Desktop.
Very valid but very ugly HCL2 file which break the parsers and IAC Security tools (terrascan, checkov, etc)
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