terraform_deploy #357
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 | |
on: | |
schedule: | |
- cron: '0 */18 * * *' | |
push: | |
branches: [ "master" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hashicorp/setup-terraform@v2 | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install kubectl | |
run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && cp kubectl /usr/local/bin | |
- name: Install okteto cli | |
env: | |
OKTETO_TOKEN: ${{ secrets.OKTETO_TOKEN }} | |
run: curl https://get.okteto.com -sSfL | sh && okteto login --token "$OKTETO_TOKEN" && okteto kubeconfig | |
- name: Fetch secrets from Hashicorp vault | |
env: | |
HCP_ORG_ID: ${{ secrets.HCP_ORG_ID }} | |
HCP_PROJ_ID: ${{ secrets.HCP_PROJ_ID }} | |
APP_NAME: ${{ secrets.APP_NAME }} | |
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }} | |
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }} | |
run: ./generate-env.sh && terraform fmt | |
- name: Terraform plan and apply | |
env: | |
TF_HTTP_PASSWORD: ${{ secrets.GIT_ACCESS_TOKEN }} | |
run: terraform init && terraform apply -auto-approve -no-color |