-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_tf
More file actions
executable file
·52 lines (41 loc) · 947 Bytes
/
Copy path_tf
File metadata and controls
executable file
·52 lines (41 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
print_help() {
cat <<'EOF'
Terraform / OpenTofu Command Guide
==================================
Before running commands:
source .env
Core workflow:
tofu init
tofu plan
tofu apply
After apply (inspect outputs):
tofu output
tofu output -raw api_gateway_url # Endpoint URL
Managing infrastructure:
tofu state list # Show current resources
tofu destroy # Delete infrastructure
Other useful commands:
tofu plan -destroy
tofu fmt
tofu providers schema
EOF
}
if [[ ! -f ".env" ]]; then
echo "Missing .env file. Copy .env-template and configure required values." >&2
exit 1
fi
# shellcheck disable=SC1091
source .env
if [[ $# -eq 0 ]]; then
print_help
exit 0
fi
if ! command -v tofu >/dev/null 2>&1; then
echo "OpenTofu (tofu) is not installed or not in PATH." >&2
exit 1
fi
echo "Running: tofu $*"
exec tofu "$@"