tfvars --output-file terraform.tfvars
inserts comments which make output file invalid
#710
Labels
tfvars --output-file terraform.tfvars
inserts comments which make output file invalid
#710
Describe the bug
When running
terraform-docs tfvars --output-file terraform.tfvars
to generate a variables file,terraform-docs
inserts a<!-- BEGIN_TF_DOCS -->
comment at the start of the output file (regardless of whether the output is requested in JSON or HCL), and a<!-- END_TF_DOCS -->
line at the end, which make the variables file invalid.I'd expect
terraform-docs tfvars --output-file terraform.tfvars
to generate the expected content without inserting comments before and after it.How can we reproduce it?
terraform-docs tfvars --output-file terraform.tfvars hcl .
, orterraform-docs tfvars --output-file terraform.tfvars.json json .
. The output saysterraform.tfvars[.json] updated successfully
.terraform.tfvars[.json]
file and observe that it contains HTML comments making it syntactically invalid.Suggested workaround
Adding
--output-mode replace --output-template '{{ .Content }}'
to the command line correctly generates a well-formed variables file.Environment information
terraform-docs version v0.16.0 1f686b1 darwin/arm64
The text was updated successfully, but these errors were encountered: