Skip to content

Commit

Permalink
Merge pull request #2 from clouddrove/PR-1
Browse files Browse the repository at this point in the history
terratest
  • Loading branch information
Sohan Yadav authored May 24, 2020
2 parents a90401d + 94ff14e commit d29b4e4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Terraform GitHub Actions'
on:
- pull_request

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:

- name: 'Checkout'
uses: actions/checkout@master

- name: 'Terraform Format'
uses: clouddrove/[email protected]
with:
actions_subcommand: 'fmt'

- name: 'Terraform Init'
uses: clouddrove/[email protected]
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example

- name: Configure AWS Credentials
uses: clouddrove/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: 'Terraform Plan'
uses: clouddrove/[email protected]
with:
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Terratest'
uses: clouddrove/[email protected]
with:
actions_subcommand: 'terratest'
tf_actions_working_dir: ./_test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'Clouddrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
9 changes: 1 addition & 8 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ provider "aws" {
region = "eu-west-1"
}

module "keypair" {
source = "git::https://github.com/clouddrove/terraform-aws-keypair.git"

key_path = "~/.ssh/id_rsa.pub"
key_name = "devops"
enable_key_pair = true
}

module "vpc" {
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git"
Expand Down Expand Up @@ -74,7 +68,6 @@ module "ec2" {
ami = "ami-08d658f84a6d84a80"
ebs_optimized = "false"
instance_type = "t2.nano"
key_name = module.keypair.name
monitoring = false
associate_public_ip_address = true
tenancy = "default"
Expand Down Expand Up @@ -113,4 +106,4 @@ module "alarm" {
insufficient_data_actions = []
ok_actions = []
instance_id = module.ec2.instance_id[0]
}
}

0 comments on commit d29b4e4

Please sign in to comment.