-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3152685
commit 10a49b0
Showing
3 changed files
with
74 additions
and
81 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Packer and Terraform Provision | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
provision-packer: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Packer | ||
id: setup | ||
uses: hashicorp/setup-packer@main | ||
|
||
- name: Initialize Packer | ||
id: initpacker | ||
run: packer init ./image-builder/ | ||
|
||
- name: Format Packer | ||
id: fmtpacker | ||
run: packer fmt ./image-builder/ | ||
|
||
- name: Validate Packer | ||
id: validate | ||
run: packer validate ./image-builder/ | ||
|
||
- name: Build Image | ||
id: build | ||
run: packer build ./image-builder/ | ||
|
||
provision-terraform: | ||
runs-on: ubuntu-latest | ||
needs: provision-packer | ||
env: | ||
TF_VAR_awskey01: ${{ secrets.ssh_private_key }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
id: setupterraform | ||
|
||
- name: Terraform Init | ||
id: initailizeterraform | ||
run: terraform init -migrate-state | ||
|
||
- name: Format Terraform | ||
id: formatterraform | ||
run: terraform fmt | ||
|
||
- name: Validate Terraform | ||
id: validateterraform | ||
run: terraform validate | ||
|
||
- name: Terraform Plan | ||
id: plan | ||
run: terraform plan -input=false | ||
|
||
- name: Terraform Apply | ||
id: apply | ||
run: terraform apply --auto-approve |
This file was deleted.
Oops, something went wrong.