Skip to content

Commit

Permalink
updated githubaction workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulsharan0 committed Sep 1, 2023
1 parent 3152685 commit 10a49b0
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 81 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/packer_provision.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/packer_terraform_provision.yml
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
40 changes: 0 additions & 40 deletions .github/workflows/terraform_provision.yml

This file was deleted.

0 comments on commit 10a49b0

Please sign in to comment.