Skip to content

Commit

Permalink
fix stage deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-rapnicki-bixal committed Nov 18, 2024
1 parent 0104095 commit 6ede420
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/terraform-deploy-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ 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"
;;
main)
CF_SPACE="prod"
;;
stage)
CF_SPACE="staging"
;;
esac
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
echo "CF_SPACE=${CF_SPACE}" >> $GITHUB_ENV
Expand Down Expand Up @@ -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
Expand Down
56 changes: 43 additions & 13 deletions terraform/infra/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -459,7 +452,7 @@ locals {
#################################


main = merge(
prod = merge(
{
## Applications to deploy.
apps = local.globals.apps
Expand All @@ -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
}
]
Expand Down

0 comments on commit 6ede420

Please sign in to comment.