Create AWS Lightsail Instance #1
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: Create AWS Lightsail Instance | |
on: | |
workflow_dispatch: | |
inputs: | |
s3: | |
description: 'Create s3 bucket' | |
default: 'no' | |
type: choice | |
options: | |
- no | |
- yes | |
action: | |
description: 'Action to perform' | |
required: true | |
default: 'apply' | |
type: choice | |
options: | |
- apply | |
- destroy | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Init | |
if: github.event.inputs.s3 == 'true' | |
run: terraform init | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
working-directory: ./apps | |
- name: Terraform Apply | |
if: github.event.inputs.s3 == 'true' | |
run: terraform apply -auto-approve | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
working-directory: ./src | |
- name: Terraform Init | |
run: terraform init | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
working-directory: ./terraform | |
- name: Terraform Apply | |
if: github.event.inputs.action == 'apply' | |
run: terraform apply -auto-approve | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
working-directory: ./terraform | |
- name: Terraform Destroy | |
if: github.event.inputs.action == 'destroy' | |
run: terraform destroy -auto-approve | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
working-directory: ./terraform |