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 15bc326
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
6 changes: 4 additions & 2 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
62 changes: 46 additions & 16 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,23 +472,60 @@ 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
}
]
)
...)
}

# output "name" {
# value = local.env
# }
output "name" {
value = local.env
}

0 comments on commit 15bc326

Please sign in to comment.