Skip to content

Commit 29655d5

Browse files
committed
Handle no infra/account/*.tfbackend files better for initial setup
Rather than erroring on a project with no `infra/account/*.tfbackend` files, have `bin/accounts-ids-by-name` return a valid but empty JSON object. This is more predictable behavior and allows Terraform to error on the specific lookup locations rather than when the script is triggered (which also avoids having to conditionally execute the script, etc.).
1 parent 42ff0f3 commit 29655d5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bin/account-ids-by-name

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -euo pipefail
88
script_dir=$(dirname "$0")
99

1010
key_value_pairs=()
11-
backend_config_file_paths=$(ls -1 "${script_dir}"/../infra/accounts/*.*.tfbackend)
11+
backend_config_file_paths=$(ls -1 "${script_dir}"/../infra/accounts/*.*.tfbackend 2> /dev/null || true)
1212

1313
for backend_config_file_path in $backend_config_file_paths; do
1414
backend_config_file=$(basename "$backend_config_file_path")

0 commit comments

Comments
 (0)