When generating JSON document types using Terraform (e.g. for policy documents) it will default to providing nice indentation, like:
{
"Version":"2021-01-27",
"ArrayOfThings": [
"Thing",
"OtherThing",
]
}
However, some document types in AWS have limited sizes. Is there a way of controlling what the output formatting for the documents generated by Terraform is (i.e. not the terraform --json
output, a step in the document itself)?
Ideally I'd like to use the Terraform provider (which has a json output) and then connect that through a minifier, so it would end up being published to AWS as:
{"Version":"2021-01-27","ArrayOfThings":["Thing","OtherThing"]}
The Hashicorp terraform rule that I'd explicitly like to use this on is the aws_iam_policy_document
one, which has a .json
output. Is there an equivalent .jsonCompressed
or another Terraform rule that I can use the output of aws_iam_policy_document
to minify the JSON output?
question from:
https://stackoverflow.com/questions/65921768/is-there-a-way-to-compress-a-json-file-with-terraform 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…