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
#!/usr/bin/env -S awk -f | |
# https://gist.github.com/yermulnik/7e0cf991962680d406692e1db1b551e6 | |
# Tested with GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0) | |
# Usage: /path/to/tf_vars_sort.awk < variables.tf | tee sorted_variables.tf | |
# Note: "chmod +x /path/to/tf_vars_sort.awk" before use | |
# No licensing; [email protected], 2021-2023 | |
{ | |
# skip blank lines at the beginning of file | |
if (!resource_type && length($0) == 0) next |