nixos-anywhere/terraform/update-docs.sh

13 lines
449 B
Bash
Raw Normal View History

2023-09-17 11:27:43 +03:00
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
files=()
find "${SCRIPT_DIR}"/* -type d | while read -r i; do
module_name=$(basename "$i")
markdown_file="${SCRIPT_DIR}/${module_name}.md"
2023-09-17 13:45:46 +03:00
terraform-docs --config "${SCRIPT_DIR}/.terraform-docs.yml" markdown table --output-file "${markdown_file}" --output-mode inject "${module_name}"
2023-09-17 11:27:43 +03:00
files+=("${markdown_file}")
done
nix fmt -- "${files[@]}"