Skip to content

Deploy Infra

Deploy Infra #2

name: Deploy Infra
on:
workflow_dispatch:
workflow_call:
jobs:
deploy-infra:
name: Deploy infra
runs-on: ubuntu-latest
defaults:
run:
working-directory: infra/
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create tfvars
run: echo '${{secrets.TFVARS}}' >> secrets.auto.tfvars
- name: Use Node Key
run: |
echo "$(echo ${{secrets.NODE_KEY_64}} | base64 -d)" > modules/cluster/node_key && \
chmod 600 modules/cluster/node_key
- name: Sign in to AWS CLI
run: |
mkdir $HOME/.aws && \
echo [default] >> $HOME/.aws/credentials && \
echo aws_access_key_id = ${{secrets.AWS_ACCESS_KEY}} >> $HOME/.aws/credentials && \
echo aws_secret_access_key = ${{secrets.AWS_SECRET_KEY}} >> $HOME/.aws/credentials
- run: cat $HOME/.aws/credentials
- name: Terraform Init
run: terraform init
- name: Terraform Apply
run: terraform apply --auto-approve
- name: save inventory as artefact
uses: actions/upload-artifact@v4
with:
name: inventory
path: infra/playbooks/inventory.yml