Skip to content

Feat/release and promote cou #26

Feat/release and promote cou

Feat/release and promote cou #26

name: Apply new changes to SolEng repositories
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- terraform-plans/**
push:
branches:
- main
paths:
- terraform-plans/**
jobs:
terraform:
name: Run Terraform
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
repository:
- charmed-openstack-upgrader_main
# The snapcraft channel for 3.x is not ready
# - charmed-openstack-upgrader_3.x
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Terraform
run: sudo snap install terraform --classic
- name: Terraform init
working-directory: ./terraform-plans
run: terraform init
- name: Terraform validate
working-directory: ./terraform-plans
env:
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }}
run: terraform validate -no-color
- name: Terraform plan
working-directory: ./terraform-plans
env:
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }}
run: |
terraform plan -no-color \
-var-file=configs/github.tfvars \
-var-file=configs/${{ matrix.repository }}.tfvars \
-out ./tf.plan
- name: Terraform Apply only on merge to main
if: ${{ github.event_name == 'push' }}
working-directory: ./terraform-plans
env:
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }}
run: |
terraform apply ./tf.plan -no-color