This PR copies the templates in coder/coder/examples/templates over to the registry, so that template contribution can be done through the registry. For now, the starter templates in the coder/coder binary and the templates available in coder/registry will simply be different constructs, until we find a solution we like around a single source of truth for templates that doesn't raise hairy semver concerns for coder/coder: https://codercom.slack.com/archives/C05T7165ET1/p1749493368773469
38 lines
1.0 KiB
Bash
Executable File
38 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
validate_terraform_directory() {
|
|
local dir="$1"
|
|
echo "Running \`terraform validate\` in $dir"
|
|
pushd "$dir"
|
|
terraform init -upgrade
|
|
terraform validate
|
|
popd
|
|
}
|
|
|
|
main() {
|
|
# Get the directory of the script
|
|
local script_dir=$(dirname "$(readlink -f "$0")")
|
|
|
|
# Code assumes that registry directory will always be in same position
|
|
# relative to the main script directory
|
|
local registry_dir="$script_dir/../registry"
|
|
|
|
# Get all module subdirectories in the registry directory. Code assumes that
|
|
# Terraform module directories won't begin to appear until three levels deep into
|
|
# the registry (e.g., registry/coder/modules/coder-login, which will then
|
|
# have a main.tf file inside it)
|
|
local subdirs=$(find "$registry_dir" -mindepth 3 -path "*/modules/*" -type d | sort)
|
|
|
|
for dir in $subdirs; do
|
|
# Skip over any directories that obviously don't have the necessary
|
|
# files
|
|
if test -f "$dir/main.tf"; then
|
|
validate_terraform_directory "$dir"
|
|
fi
|
|
done
|
|
}
|
|
|
|
main
|