Update terraform.yml #3
Workflow file for this run
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 Deployment | |
# on: | |
# repository_dispatch: | |
# types: [deploy-command] | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- uses: pnpm/action-setup@v2 | |
- name: Installing Dependencies | |
run: pnpm install | |
- name: Configure AWS credentials | |
run: | | |
aws configure --profile digitalocean set aws_access_key_id ${{ secrets.DO_ACCESS_KEY }} | |
aws configure --profile digitalocean set aws_secret_access_key ${{ secrets.DO_SECRET_ACCESS_KEY }} | |
- name: Export DigitalOcean profile | |
run: export AWS_PROFILE=digitalocean | |
- name: Create .tfvars file | |
run: | | |
echo "do_token=${{ secrets.DO_TOKEN }}" >> ./terraform/.tfvars | |
echo "project_id=${{ secrets.DO_PROJECT_ID }}" >> ./terraform/.tfvars | |
- name: Terraform Plan | |
run: pnpm terraform plan | |
- name: Terraform Apply | |
run: pnpm terraform apply | |
# - name: Run Terraform | |
# run: | | |
# cd terraform_directory | |
# terraform init \ | |
# -backend-config="profile=do" \ | |
# -backend-config="bucket=<YOUR_S3_BUCKET>" \ | |
# -backend-config="key=<YOUR_S3_KEY>" \ | |
# -backend-config="region=<YOUR_S3_REGION>" | |
# terraform apply -auto-approve |