Skip to content

Commit

Permalink
Merge pull request #2 from Mario-Valente/TESTE-002
Browse files Browse the repository at this point in the history
ci: 💚 Add workflow of PR validation
  • Loading branch information
Mario-Valente authored Feb 14, 2023
2 parents 9929555 + 583bd30 commit 3218c4a
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pr_validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: pr validation terraform

on:
pull_request:
branches: [main]
workflow_dispatch:

env:
AWS_ACCESS_KEY_ID: "${{secrets.AWS_ACCESS_KEY_ID}}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
AWS_REGION: "${{ secrets.AWS_REGION }}"

concurrency:
group: ${{github.workflow}}
cancel-in-progress: true

jobs:

terraform-plan:
runs-on: ${{matrix.os}}

strategy:
matrix:
os: [ubuntu-latest]
terraform: [0.14.8]

steps:
- name: checkout 🛎
uses: actions/checkout@master


- name: Aws credentions
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Setup Terrafom
uses: hashicorp/[email protected]
with:
terraform_version: ${{ matrix.terraform }}

- name: Terraform Init
id: tf_init
run: terraform init

- name: Terraform Validade
id: tf_validate
run: terraform validate -no-color

- name: terraform plan
id: tf-plan
run: terraform plan -out=plan.out -input=false -lock=false
continue-on-error: true

- name: terraform show plan
id: tf_show
run: terraform show -no-color plan.out
continue-on-error: true


- name: Terraform Plan Status
if: steps.tf_plan.outcome == 'failure'
run: exit 1
1 change: 0 additions & 1 deletion .terraform.tfstate.lock.info

This file was deleted.

1 change: 0 additions & 1 deletion providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ terraform {

}


provider "aws" {
region = "us-east-1"
}
5 changes: 4 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
variable "aws_iam_user"{}
variable "aws_iam_user"{
type = string
default = "teste_iam"
}

0 comments on commit 3218c4a

Please sign in to comment.