Skip to content

Commit 2a0bd02

Browse files
committed
Upgrade terraform version to 0.13.0 and update pipelines
1 parent 395569a commit 2a0bd02

File tree

9 files changed

+642
-103
lines changed

9 files changed

+642
-103
lines changed

.github/workflows/readme.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,37 @@ jobs:
1717
with:
1818
python-version: '3.x'
1919

20-
- name: 'Install test dependencies.'
21-
run: pip install yamllint
22-
23-
- name: Run yamllint.
24-
run: yamllint ./README.yaml
25-
26-
- name: clone Genie repo
27-
run: |
28-
export GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB }}
29-
cd .. && cd .. && cd ..
30-
git clone https://${{ secrets.GITHUB }}@github.com/clouddrove/genie.git
31-
cd /home/runner/work/terraform-aws-security-group/terraform-aws-security-group
32-
make packages/install/gomplate
33-
make readme
34-
35-
- name: push to repo back
36-
run: |
37-
git config --global user.email "anmol@clouddrove.com"
38-
git config --global user.name "Anmol nagpal"
39-
git add . && git commit -m "upload"
40-
git push origin master
20+
- name: 'create readme'
21+
uses: 'clouddrove/github-actions@v4.0'
22+
with:
23+
actions_subcommand: 'readme'
24+
github_token: '${{ secrets.GITHUB}}'
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
27+
28+
29+
- name: pre-commit check errors
30+
uses: pre-commit/action@v2.0.0
31+
continue-on-error: true
32+
33+
- name: pre-commit fix erros
34+
uses: pre-commit/action@v2.0.0
35+
continue-on-error: true
36+
37+
- name: 'push readme'
38+
uses: 'clouddrove/github-actions@v4.0'
39+
continue-on-error: true
40+
with:
41+
actions_subcommand: 'push'
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
4144

4245
- name: 'Slack Notification'
4346
uses: clouddrove/action-slack@v2
4447
with:
4548
status: ${{ job.status }}
4649
fields: repo,author
47-
author_name: 'Clouddrove'
50+
author_name: 'CloudDrove'
4851
env:
4952
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
5053
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required

.github/workflows/terraform.yml

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: 'Terraform GitHub Actions'
22
on:
3-
- push
3+
pull_request:
4+
branches:
5+
- master
46

57
jobs:
68
terraform:
@@ -10,57 +12,42 @@ jobs:
1012
- name: 'Checkout'
1113
uses: actions/checkout@master
1214

13-
- name: 'Terraform Format fmt'
14-
uses: hashicorp/terraform-github-actions@master
15-
with:
16-
tf_actions_version: 0.13.4
17-
tf_actions_subcommand: 'fmt'
18-
tf_actions_working_dir: "./_example"
19-
tf_actions_comment: true
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22-
2315
- name: Configure AWS Credentials
2416
uses: clouddrove/configure-aws-credentials@v1
2517
with:
2618
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
2719
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
2820
aws-region: us-east-2
2921

30-
- name: Set up Go 1.13
31-
uses: actions/setup-go@v1
22+
- name: 'Terraform Format'
23+
uses: 'clouddrove/github-actions@v4.0'
3224
with:
33-
go-version: 1.13
34-
id: go
25+
actions_subcommand: 'fmt'
3526

36-
- name: Get dependencies
37-
run: |
38-
if [ -f Gopkg.toml ]; then
39-
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
40-
dep ensure
41-
else
42-
go get -v -t -d ./...
43-
fi
44-
- name: Test
45-
working-directory: ./_test
46-
run: go test
27+
- name: 'Terraform init'
28+
uses: 'clouddrove/github-actions@v4.0'
29+
with:
30+
actions_subcommand: 'init'
31+
tf_actions_working_dir: ./_example
4732

48-
- name: 'Terraform Init'
49-
uses: hashicorp/terraform-github-actions@master
33+
- name: 'Terraform validate'
34+
uses: 'clouddrove/github-actions@v4.0'
5035
with:
51-
tf_actions_version: 0.13.4
52-
tf_actions_subcommand: 'init'
53-
tf_actions_working_dir: "./_example"
54-
tf_actions_comment: true
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
actions_subcommand: 'validate'
37+
tf_actions_working_dir: ./_example
38+
39+
- name: 'Terraform plan'
40+
uses: 'clouddrove/github-actions@v4.0'
41+
with:
42+
actions_subcommand: 'plan'
43+
tf_actions_working_dir: ./_example
5744

5845
- name: 'Slack Notification'
5946
uses: clouddrove/action-slack@v2
6047
with:
6148
status: ${{ job.status }}
6249
fields: repo,author
63-
author_name: 'Clouddrove'
50+
author_name: 'CloudDrove'
6451
env:
6552
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
6653
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required

.github/workflows/terratest.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Terratest GitHub Actions'
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
types: [labeled]
7+
8+
jobs:
9+
terraform:
10+
name: 'Terraform'
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: 'Checkout'
15+
uses: actions/checkout@master
16+
17+
- name: Configure AWS Credentials
18+
uses: clouddrove/configure-aws-credentials@v1
19+
with:
20+
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
21+
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
22+
aws-region: us-east-2
23+
24+
- name: 'Terratest'
25+
if: ${{ github.event.label.name == 'terratest' }}
26+
uses: 'clouddrove/github-actions@v4.0'
27+
with:
28+
actions_subcommand: 'terratest'
29+
tf_actions_working_dir: '_test'
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: 'Slack Notification'
34+
uses: clouddrove/action-slack@v2
35+
with:
36+
status: ${{ job.status }}
37+
fields: repo,author
38+
author_name: 'CloudDrove'
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
41+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
42+
if: always()

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.12.0
3+
rev: v1.43.0
44
hooks:
55
- id: terraform_fmt
66

77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v2.0.0
8+
rev: v3.2.0
99
hooks:
1010
- id: check-merge-conflict
1111
- id: check-yaml

README.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ usage: |-
3939
```hcl
4040
# use this
4141
module "security_group" {
42-
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.13.0"
42+
source = "clouddrove/security-group/aws"
43+
version = "0.13.0"
4344
name = "security-group"
4445
application = "clouddrove"
4546
environment = "test"

_example/example.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
provider "aws" {
2-
region = "eu-west-1"
2+
region = "us-east-2"
33
}
44

55
module "vpc" {
6-
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.13.0"
7-
6+
source = "clouddrove/vpc/aws"
7+
version = "0.13.0"
88
name = "vpc"
99
application = "clouddrove"
1010
environment = "test"
1111
label_order = ["environment", "application", "name"]
12-
1312
cidr_block = "10.0.0.0/16"
1413
}
1514

@@ -20,11 +19,9 @@ module "security_group" {
2019
application = "clouddrove"
2120
environment = "test"
2221
label_order = ["environment", "application", "name"]
23-
2422
vpc_id = module.vpc.vpc_id
2523
protocol = "tcp"
2624
description = "Instance default security group (only egress access is allowed)."
2725
allowed_ip = ["172.16.0.0/16", "10.0.0.0/16"]
28-
allowed_ipv6 = ["2405:201:5e00:3684:cd17:9397:5734:a167/128"]
2926
allowed_ports = [22, 27017]
3027
}

0 commit comments

Comments
 (0)