diff --git a/.github/workflows/terraform-deploy-infra.yml b/.github/workflows/terraform-deploy-infra.yml index c1c3790a..4459446a 100644 --- a/.github/workflows/terraform-deploy-infra.yml +++ b/.github/workflows/terraform-deploy-infra.yml @@ -12,8 +12,7 @@ jobs: uses: actions/checkout@v4 - name: Set env.BRANCH run: | - BRANCH=develop - #BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3) + BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3) case ${BRANCH} in develop) CF_SPACE="dev" @@ -21,6 +20,9 @@ jobs: main) CF_SPACE="prod" ;; + stage) + CF_SPACE="staging" + ;; esac echo "BRANCH=${BRANCH}" >> $GITHUB_ENV echo "CF_SPACE=${CF_SPACE}" >> $GITHUB_ENV @@ -51,8 +53,7 @@ jobs: env: TF_BASTION: "${{ secrets.TF_BASTION }}" run: | - #declare -a commands=("rm -rf ${REPO_NAME}" "git clone https://github.com/${GITHUB_REPOSITORY_OWNER}/${REPO_NAME}.git" "cd ${REPO_NAME}" "git checkout ${BRANCH}") - declare -a commands=("rm -rf ${REPO_NAME}" "git clone -b "feature/dg-98-build-and-configure-pipeline" https://github.com/${GITHUB_REPOSITORY_OWNER}/${REPO_NAME}.git") + declare -a commands=("rm -rf ${REPO_NAME}" "git clone https://github.com/${GITHUB_REPOSITORY_OWNER}/${REPO_NAME}.git" "cd ${REPO_NAME}" "git checkout ${BRANCH}") for command in "${commands[@]}"; do ./scripts/pipeline/cloud-gov-remote-command.sh "${TF_BASTION}" "${command}" 1 done diff --git a/terraform/infra/locals.tf b/terraform/infra/locals.tf index 9c7549ef..16eb47ea 100755 --- a/terraform/infra/locals.tf +++ b/terraform/infra/locals.tf @@ -316,18 +316,11 @@ locals { external_applications = { drupal = { - environement = "dev" + environement = terraform.workspace ## Port is the application listening on. port = var.mtls_port - }, - drupal = { - - environement = "main" - - ## Port is the application listening on. - port = var.mtls_port - } + } } ## The various environment settings to be deployed. @@ -459,7 +452,7 @@ locals { ################################# - main = merge( + prod = merge( { ## Applications to deploy. apps = local.globals.apps @@ -479,16 +472,53 @@ locals { } } ) + + ################################# + ## + ## __ _ + ## / _\ |_ __ _ __ _ ___ + ## \ \| __/ _` |/ _` |/ _ \ + ## _\ \ || (_| | (_| | __/ + ## \__/\__\__,_|\__, |\___| + ## |___/ + ## + ################################# + + staging = merge( + { + ## Applications to deploy. + apps = local.globals.apps + services = local.globals.services + }, + { + ## Passwords that need to be generated for this environment. + ## These will actually use the sha256 result from the random module. + passwords = { + hash_salt = { + length = 32 + } + cron_key = { + length = 32 + } + } + } + ) } ## Map of the 'all' environement and the current workspace settings. - env = merge(try(local.envs.all, {}), try(local.envs[terraform.workspace], {})) + env = merge( + try( + local.envs.all, {} + ), + try( + local.envs[terraform.workspace], {} + ) + ) - service_bindings = merge( + service_bindings = merge( flatten( [ for key, value in try(local.env.services, {}) : { - #svc_value.name => svc_value "${key}" = value } ]