Add Terracrust support for empty map variable type
alicvsroxas opened this issue · 0 comments
When setting up the following variable structure in the module:
variable "tags" {
type = map(string)
default = {}
description = "(Optional) A map of tags to add to all resources."
}
The fmt function fails when running Terracrust:
2022-06-26T08:47:30.11UTC ERROR terraform-generate-tool.generate-tool.generate-all-files failed running Show {"environment": "dev", "facility": "dev", "hostName": "runner-hcxhuvcf-project-6280-concurrent-0", "namespace": "dev", "revision": "dev", "error": "exit status 2\n\nError: Invalid expression\n\n on module_locals.tf line 17, in locals:\n 17: "" = contains(keys(var.alb_controller.tags),"") != false ? var.alb_controller.tags[""] : }\n\nExpected the start of an expression, but found an invalid expression token.\n\n"}
Please add a feature in which if the variable default is an empty map,
Change this structure in module_locals.tf:
tags = var.alb_controller.tags != null ? merge(var.alb_controller.tags,
tomap({
"" = contains(keys(var.alb_controller.tags),"") != false ? var.alb_controller.tags[""] : }
)):{
"" =
}
To this structure in module_locals.tf:
tags = var.alb_controller.tags != null ? merge(var.alb_controller.tags,
tomap({})):{}