Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ER-790: Azure Refinements #811

Merged
merged 8 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .github/workflows/tf-azure-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,25 @@ jobs:
- name: Terraform Format
run: terraform fmt -check

# Generates Terraform variable files
- name: Terraform Variables
# Generates Terraform input variables
- name: Generate Terraform Variables
shell: bash
env:
WEB_SECRETS: ${{ toJSON(secrets) }}
WEB_VARS: ${{ toJSON(vars) }
WEB_VARS: ${{ toJSON(vars) }}
run: |
printf '%s\n' "${WEB_SECRETS,,}" > web-secrets.auto.tfvars.json
printf '%s\n' "${WEB_VARS,,}" > web-vars.auto.tfvars.json
printf '%s\n' "$WEB_SECRETS" > tmp-secrets.json
printf '%s\n' "$WEB_VARS" > tmp-vars.json
jq 'with_entries(.key |= ascii_downcase)' tmp-secrets.json > web-secrets.auto.tfvars.json
jq 'with_entries(.key |= ascii_downcase)' tmp-vars.json > web-vars.auto.tfvars.json

# Generates an execution plan for Terraform
# An exit code of 0 indicated no changes, 1 a terraform failure, 2 there are pending changes.
- name: Terraform Plan
id: tf-plan
run: |
export exitcode=0
terraform plan -detailed-exitcode -no-color -out tfplan || export exitcode=$?
terraform plan -detailed-exitcode -no-color -compact-warnings -out tfplan || export exitcode=$?

echo "exitcode=$exitcode" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -149,15 +151,17 @@ jobs:
-backend-config="container_name=${{ secrets.TERRAFORM_STATE_STORAGE_CONTAINER_NAME }}"
-backend-config="key=${{ secrets.TERRAFORM_STATE_KEY }}"

# Generates Terraform variable files
- name: Terraform Variables
# Generates Terraform input variables
- name: Generate Terraform Variables
shell: bash
env:
WEB_SECRETS: ${{ toJSON(secrets) }}
WEB_VARS: ${{ toJSON(vars) }
WEB_VARS: ${{ toJSON(vars) }}
run: |
printf '%s\n' "${WEB_SECRETS,,}" > web-secrets.auto.tfvars.json
printf '%s\n' "${WEB_VARS,,}" > web-vars.auto.tfvars.json
printf '%s\n' "$WEB_SECRETS" > tmp-secrets.json
printf '%s\n' "$WEB_VARS" > tmp-vars.json
jq 'with_entries(.key |= ascii_downcase)' tmp-secrets.json > web-secrets.auto.tfvars.json
jq 'with_entries(.key |= ascii_downcase)' tmp-vars.json > web-vars.auto.tfvars.json

# Download saved plan from artifacts
- name: Download Terraform Plan
Expand All @@ -168,4 +172,4 @@ jobs:

# Terraform Apply
- name: Terraform Apply
run: terraform apply -auto-approve tfplan/tfplan
run: terraform apply -compact-warnings -auto-approve tfplan/tfplan
2 changes: 1 addition & 1 deletion terraform-azure/local.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
# Common tags to be assigned resources
# Common tags to be assigned to resources
common_tags = {
"Environment" = var.environment
"Parent Business" = "Children’s Care"
Expand Down
Loading