Skip to content

Commit

Permalink
Merge pull request #2 from clouddrove/CD-90
Browse files Browse the repository at this point in the history
Cd 90
  • Loading branch information
Nikita Dugar authored Dec 28, 2019
2 parents 214e3d1 + bf1a2e3 commit 054092e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 16 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()
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ This module has a few dependencies:
Here is an example of how you can use this module in your inventory structure:
```hcl
module "ec2" {
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3"
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.4"
name = "ec2-instance"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"] instance_count = 2
label_order = ["environment", "application", "name"]
instance_count = 2
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
key_name = module.keypair.name
Expand Down
5 changes: 3 additions & 2 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ usage : |-
Here is an example of how you can use this module in your inventory structure:
```hcl
module "ec2" {
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3"
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.4"
name = "ec2-instance"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"] instance_count = 2
label_order = ["environment", "application", "name"]
instance_count = 2
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
key_name = module.keypair.name
Expand Down
17 changes: 5 additions & 12 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?ref=tags/0.12.2"

key_path = "~/.ssh/id_rsa.pub"
key_name = "main-key"
enable_key_pair = true
}

module "vpc" {
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.4"
Expand All @@ -22,7 +16,7 @@ module "vpc" {
}

module "public_subnets" {
source = "git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.3"
source = "git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.4"

name = "public-subnet"
application = "clouddrove"
Expand All @@ -37,7 +31,7 @@ module "public_subnets" {
}

module "http-https" {
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.2"
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.3"

name = "http-https"
application = "clouddrove"
Expand All @@ -50,7 +44,7 @@ module "http-https" {
}

module "ssh" {
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.2"
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.3"

name = "ssh"
application = "clouddrove"
Expand All @@ -63,7 +57,7 @@ module "ssh" {
}

module "iam-role" {
source = "git::https://github.com/clouddrove/terraform-aws-iam-role.git?ref=tags/0.12.0"
source = "git::https://github.com/clouddrove/terraform-aws-iam-role.git?ref=tags/0.12.1"

name = "iam-role"
application = "clouddrove"
Expand Down Expand Up @@ -100,7 +94,7 @@ data "aws_iam_policy_document" "iam-policy" {
}

module "ec2" {
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3"
source = "./../"

name = "ec2-instance"
application = "clouddrove"
Expand All @@ -110,7 +104,6 @@ module "ec2" {
instance_count = 2
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
key_name = module.keypair.name
monitoring = false
tenancy = "default"

Expand Down

0 comments on commit 054092e

Please sign in to comment.