Deployment Infrastructure #3
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: Deployment Infrastructure | |
on: | |
workflow_dispatch: | |
inputs: | |
aws_access_key_id: | |
description: 'Input key id' | |
required: true | |
type: string | |
default: 'NULL' | |
aws_secret_access_key: | |
description: 'Input secret key' | |
required: true | |
type: string | |
default: 'NULL' | |
jobs: | |
create-ec2-instance: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ github.event.inputs.aws_access_key_id }} | |
aws-secret-access-key: ${{ github.event.inputs.aws_secret_access_key }} | |
aws-region: us-east-1 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_wrapper: false | |
- name: create ec2 instance | |
working-directory: .github/IaC | |
run: | | |
terraform init | |
terraform validate | |
terraform plan | |
terraform apply -auto-approve |