GitHub workflow for validating terraform deploy
+ upgrading charms
#1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform deploy to a fresh microk8s model | |
on: | |
# pull_request_review: | |
# on: | |
# pull_request_review: | |
# types: | |
# - submitted | |
pull_request: | |
branches: | |
- '**' | |
# paths: | |
# - 'frontend/charm/**' | |
# - 'backend/charm/**' | |
# - 'terraform/**' | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: [self-hosted, jammy, xlarge] | |
defaults: | |
run: | |
working-directory: ./terraform | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up microk8s | |
uses: canonical/certification-github-workflows/.github/actions/microk8s-setup@main | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Init | |
run: terraform init | |
- name: Create juju model to deploy to | |
run: juju add-model test-observer-development | |
- name: Terraform Apply | |
run: | | |
TF_VAR_environment=development \ | |
TF_VAR_nginx_ingress_integrator_charm_whitelist_source_range="" \ | |
terraform apply -auto-approve | |
- name: Wait for deployment to complete | |
run: | | |
juju wait-for model test-observer-development \ | |
--timeout=1min \ | |
--query='life=="alive" && status=="available" && forEach(applications, app => app.status == "active")' | |