Skip to content

Commit 054092e

Browse files
author
Nikita Dugar
authored
Merge pull request #2 from clouddrove/CD-90
Cd 90
2 parents 214e3d1 + bf1a2e3 commit 054092e

File tree

4 files changed

+68
-16
lines changed

4 files changed

+68
-16
lines changed

.github/workflows/terraform.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: 'Terraform GitHub Actions'
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
terraform:
7+
name: 'Terraform'
8+
runs-on: ubuntu-latest
9+
steps:
10+
11+
- name: 'Checkout'
12+
uses: actions/checkout@master
13+
14+
- name: 'Terraform Format'
15+
uses: clouddrove/github-actions@v2.0
16+
with:
17+
actions_subcommand: 'fmt'
18+
19+
- name: 'Terraform Init'
20+
uses: clouddrove/github-actions@v2.0
21+
with:
22+
actions_subcommand: 'init'
23+
tf_actions_working_dir: ./_example
24+
25+
- name: Configure AWS Credentials
26+
uses: clouddrove/configure-aws-credentials@v1
27+
with:
28+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
29+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30+
aws-region: us-east-2
31+
32+
- name: 'Terraform Plan'
33+
uses: clouddrove/github-actions@v2.0
34+
with:
35+
actions_subcommand: 'plan'
36+
tf_actions_working_dir: ./_example
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: 'Terratest'
41+
uses: clouddrove/github-actions@v2.0
42+
with:
43+
actions_subcommand: 'terratest'
44+
tf_actions_working_dir: ./_test
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: 'Slack Notification'
49+
uses: clouddrove/action-slack@v2
50+
with:
51+
status: ${{ job.status }}
52+
fields: repo,author
53+
author_name: 'Clouddrove'
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
56+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
57+
if: always()

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ This module has a few dependencies:
7272
Here is an example of how you can use this module in your inventory structure:
7373
```hcl
7474
module "ec2" {
75-
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3"
75+
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.4"
7676
name = "ec2-instance"
7777
application = "clouddrove"
7878
environment = "test"
79-
label_order = ["environment", "application", "name"] instance_count = 2
79+
label_order = ["environment", "application", "name"]
80+
instance_count = 2
8081
ami = "ami-08d658f84a6d84a80"
8182
instance_type = "t2.nano"
8283
key_name = module.keypair.name

README.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ usage : |-
3636
Here is an example of how you can use this module in your inventory structure:
3737
```hcl
3838
module "ec2" {
39-
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.3"
39+
source = "git::https://github.com/clouddrove/terraform-aws-ec2.git?ref=tags/0.12.4"
4040
name = "ec2-instance"
4141
application = "clouddrove"
4242
environment = "test"
43-
label_order = ["environment", "application", "name"] instance_count = 2
43+
label_order = ["environment", "application", "name"]
44+
instance_count = 2
4445
ami = "ami-08d658f84a6d84a80"
4546
instance_type = "t2.nano"
4647
key_name = module.keypair.name

_example/example.tf

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ provider "aws" {
22
region = "eu-west-1"
33
}
44

5-
module "keypair" {
6-
source = "git::https://github.com/clouddrove/terraform-aws-keypair.git?ref=tags/0.12.2"
75

8-
key_path = "~/.ssh/id_rsa.pub"
9-
key_name = "main-key"
10-
enable_key_pair = true
11-
}
126

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

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

2721
name = "public-subnet"
2822
application = "clouddrove"
@@ -37,7 +31,7 @@ module "public_subnets" {
3731
}
3832

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

4236
name = "http-https"
4337
application = "clouddrove"
@@ -50,7 +44,7 @@ module "http-https" {
5044
}
5145

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

5549
name = "ssh"
5650
application = "clouddrove"
@@ -63,7 +57,7 @@ module "ssh" {
6357
}
6458

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

6862
name = "iam-role"
6963
application = "clouddrove"
@@ -100,7 +94,7 @@ data "aws_iam_policy_document" "iam-policy" {
10094
}
10195

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

10599
name = "ec2-instance"
106100
application = "clouddrove"
@@ -110,7 +104,6 @@ module "ec2" {
110104
instance_count = 2
111105
ami = "ami-08d658f84a6d84a80"
112106
instance_type = "t2.nano"
113-
key_name = module.keypair.name
114107
monitoring = false
115108
tenancy = "default"
116109

0 commit comments

Comments
 (0)