Skip to content

Set up Postgres 16 DP02 butler SQL on data-int #127

Set up Postgres 16 DP02 butler SQL on data-int

Set up Postgres 16 DP02 butler SQL on data-int #127

# Deploys Science Platform Dev GCP Project with Terraform
name: 'RSP DEV CLOUD SQL'
on:
pull_request:
paths:
- 'environment/deployments/science-platform/env/dev-cloudsql.tfvars'
push:
branches:
- main
paths:
- 'environment/deployments/science-platform/env/dev-cloudsql.tfvars'
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/deployments/science-platform/cloudsql
# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3
# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true
# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5
# Checks for proper formatting for terraform
- name: Terraform Fmt
run: terraform fmt
# Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=science-platform/dev/cloudsql
# Checks that all terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate
# Generates an execution plan for terraform
- name: Terraform Plan
id: plan
run: terraform plan -var-file=../env/dev-cloudsql.tfvars -no-color
# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=../env/dev-cloudsql.tfvars -auto-approve