Files
yucca/.mise/tasks/fabric/plan
T

19 lines
970 B
Bash
Executable File

#!/usr/bin/env bash
#MISE description="terragrunt plan for prod/htz-fsn1 fabric (builds provider, renders creds from 1Password)"
set -euo pipefail
ROOT=$(git rev-parse --show-toplevel)
mise run fabric:provider-build
# Render the NETCONF SSH key from 1Password to a 0600 temp file (op run can't
# write files). Use --account only for interactive logins; CI uses an SA token.
KEYF=$(mktemp); chmod 600 "$KEYF"; trap 'rm -f "$KEYF"' EXIT
ACCT=(); [ -z "${OP_SERVICE_ACCOUNT_TOKEN:-}" ] && ACCT=(--account "${OP_ACCOUNT:-team-futo}")
op read "${ACCT[@]}" "op://yucca_tf_prod/NET_SWITCHES_TERRAFORM_SSH_PRIVATE_KEY/password" > "$KEYF"
export TF_VAR_netconf_ssh_key_path="$KEYF"
export TF_CLI_CONFIG_FILE="$ROOT/tf/.terraformrc.fabric"
SITE="${FABRIC_SITE:-htz-fsn1}"
# -parallelism=1: the JTAF junos-qfx provider isn't concurrency-safe (see apply).
OP_ENV_FILE=tf/.env.prod "$ROOT/tf/op-run.sh" terragrunt --working-dir "tf/deployment/prod/$SITE" plan -parallelism=1 "$@"