* untested * pllan testing * fix stage 2s * move providers to their own file * single-environment stage 3 * fixes and moved blocks * stage3 factory * doc * review comments * review comments * tfdoc * fasts tage 1 tests * netsec as stage 2 * fix backported roles * fix backported roles * tfdoc * fixes * fix tag value roles in stage 1 * remove checklist, fix stage 1 tests * inventory * Small bugfix * refactor context tag values * fix previous merge * fix previous merge * fix previous merge * support short names for top level automation resources, change top level context variable * fix new top level context * roll back merge changes to stage 0 outputs * roll back more merge changes * linting errors * tfdoc * fix tests, roll back merge in tenants stage * tfdoc * fix inventory * optional stage 2 env folders and tag bindings * tflint * damn tflint * damn tflint * tfdoc * fix networking tests * tflint * fix test inventories * tfdoc * use coalesce for project parents * fix billing role conditions * fix billing role conditions * security stage tested (ngw resources need fixing/porting) * boilerplate * fix inventory * stage envs and stage linking script * initial work on resman docs, update diagram, improve teams folder * resman README * fix stage 2 IAM delegation * remove checklist from bootstrap * stage 1 tests * stage 0 1 and 2 tests * tflint * tflint * tfdoc * GCVE stage refactor (untested) * GCVE stage refactor (untested) * GCVE stage 3 * gcve tests * tflint * tfdoc * fix links * module tests * stages README * move network security to stage 2 * network security tests * replace stage links in README files * minimal netsec stage refactor * use factory for iac org policies, add configurable drs org policy for iac * test mt stage * tfdoc * fix cicd workflows * fix cicd workflows * gke-dev stage * tflint * remove data platform stage * exclude provider files via tfdoc opts * remove data platform tests and links * fix merge * fix resman inventory * boilerplate * inventory --------- Co-authored-by: Simone Ruffilli <sruffilli@google.com>
83 lines
2.2 KiB
Bash
Executable File
83 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2024 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Error: no folder or GCS bucket specified. Use -h or --help for usage."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
|
cat <<END
|
|
Create commands to initialize stage provider and tfvars files. Use this script
|
|
from inside a stage folder.
|
|
|
|
Usage with GCS output files bucket:
|
|
fast-links.sh GCS_BUCKET_URI
|
|
|
|
Usage with local output files folder:
|
|
fast-links.sh FOLDER_PATH
|
|
|
|
Point path/GCS URI to the tenant folder in tenant mode:
|
|
fast-links.sh FOLDER_PATH/TENANT_SHORTNAME
|
|
END
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "$1" == "gs://"* ]]; then
|
|
CMD="gcloud storage cp $1"
|
|
CP_CMD=$CMD
|
|
elif [ ! -d "$1" ]; then
|
|
echo "folder $1 not found"
|
|
exit 1
|
|
else
|
|
CMD="ln -s $1"
|
|
CP_CMD="cp $1"
|
|
fi
|
|
|
|
if [ ! -f .fast-stage.env ]; then
|
|
echo "this folder does not look like a FAST stage"
|
|
exit 1
|
|
fi
|
|
|
|
set -a && source .fast-stage.env && set +a
|
|
|
|
echo -e "# File linking commands for $FAST_STAGE_DESCRIPTION stage\n"
|
|
|
|
echo "# provider file"
|
|
if [[ ! -z ${FAST_STAGE_PROVIDERS+x} ]]; then
|
|
echo "$CMD/providers/${FAST_STAGE_LEVEL}-${FAST_STAGE_PROVIDERS}-providers.tf ./"
|
|
else
|
|
echo "$CMD/providers/${FAST_STAGE_LEVEL}-${FAST_STAGE_NAME}-providers.tf ./"
|
|
fi
|
|
|
|
if [[ ! -z ${FAST_STAGE_DEPS+x} ]]; then
|
|
echo -e "\n# input files from other stages"
|
|
for f in $FAST_STAGE_DEPS; do
|
|
echo "$CMD/tfvars/$f.auto.tfvars.json ./"
|
|
done
|
|
fi
|
|
|
|
echo -e "\n# conventional place for stage tfvars (manually created)"
|
|
echo "$CMD/${FAST_STAGE_LEVEL}-${FAST_STAGE_NAME}.auto.tfvars ./"
|
|
|
|
if [[ ! -z ${FAST_STAGE_OPTIONAL+x} ]]; then
|
|
echo -e "\n# optional files"
|
|
for f in $FAST_STAGE_OPTIONAL; do
|
|
echo "$CMD/tfvars/$f.auto.tfvars.json ./"
|
|
done
|
|
fi
|
|
|
|
echo
|