Skip to content

Commit fcfc197

Browse files
author
Sohan Yadav
authored
Merge pull request #6 from clouddrove/CD-249
Updated with pipelines
2 parents a662235 + 54b56e2 commit fcfc197

File tree

11 files changed

+155
-192
lines changed

11 files changed

+155
-192
lines changed

.github/workflows/readme.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Create README.md file'
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
readme-create:
8+
name: 'readme-create'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout'
12+
uses: actions/checkout@master
13+
- name: Set up Python 3.7.
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.x'
17+
- name: 'create readme'
18+
uses: 'clouddrove/github-actions@v4.0'
19+
with:
20+
actions_subcommand: 'readme'
21+
github_token: '${{ secrets.GITHUB}}'
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
24+
- name: pre-commit check errors
25+
uses: pre-commit/action@v2.0.0
26+
continue-on-error: true
27+
- name: pre-commit fix erros
28+
uses: pre-commit/action@v2.0.0
29+
continue-on-error: true
30+
- name: 'push readme'
31+
uses: 'clouddrove/github-actions@v4.0'
32+
continue-on-error: true
33+
with:
34+
actions_subcommand: 'push'
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
37+
- name: 'Slack Notification'
38+
uses: clouddrove/action-slack@v2
39+
with:
40+
status: ${{ job.status }}
41+
fields: repo,author
42+
author_name: 'CloudDrove'
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
45+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
46+
if: always()

.github/workflows/terraform.yml

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,47 @@
11
name: 'Terraform GitHub Actions'
22
on:
3-
- pull_request
4-
3+
pull_request:
4+
branches:
5+
- master
56
jobs:
67
terraform:
78
name: 'Terraform'
89
runs-on: ubuntu-latest
910
steps:
10-
1111
- name: 'Checkout'
1212
uses: actions/checkout@master
13-
13+
- name: Configure AWS Credentials
14+
uses: clouddrove/configure-aws-credentials@v1
15+
with:
16+
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
17+
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
18+
aws-region: us-east-2
1419
- name: 'Terraform Format'
15-
uses: clouddrove/github-actions@v2.0
20+
uses: 'clouddrove/github-actions@v4.0'
1621
with:
1722
actions_subcommand: 'fmt'
18-
19-
- name: 'Terraform Init'
20-
uses: clouddrove/github-actions@v2.0
23+
- name: 'Terraform init'
24+
uses: 'clouddrove/github-actions@v4.0'
2125
with:
2226
actions_subcommand: 'init'
2327
tf_actions_working_dir: ./_example
24-
25-
- name: Configure AWS Credentials
26-
uses: clouddrove/configure-aws-credentials@v1
28+
- name: 'Terraform validate'
29+
uses: 'clouddrove/github-actions@v4.0'
2730
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
31+
actions_subcommand: 'validate'
32+
tf_actions_working_dir: ./_example
33+
- name: 'Terraform plan'
34+
uses: 'clouddrove/github-actions@v4.0'
3435
with:
3536
actions_subcommand: 'plan'
3637
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-
4838
- name: 'Slack Notification'
4939
uses: clouddrove/action-slack@v2
5040
with:
5141
status: ${{ job.status }}
5242
fields: repo,author
53-
author_name: 'Clouddrove'
43+
author_name: 'CloudDrove'
5444
env:
5545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
56-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
46+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
5747
if: always()

.github/workflows/terratest.yml

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

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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
11-
- id: trailing-whitespace
1211
- id: check-yaml
1312
- id: check-added-large-files
13+
- id: trailing-whitespace

README.md

Lines changed: 0 additions & 147 deletions
This file was deleted.

README.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-aws-ecr
1616
# Badges to display
1717
badges:
1818
- name: "Terraform"
19-
image: "https://img.shields.io/badge/Terraform-v0.12-green"
19+
image: "https://img.shields.io/badge/Terraform-v0.13-green"
2020
url: "https://www.terraform.io"
2121
- name: "Licence"
2222
image: "https://img.shields.io/badge/License-MIT-blue.svg"
@@ -36,10 +36,13 @@ usage : |-
3636
Here is an example of how you can use this module in your inventory structure:
3737
```hcl
3838
module "ecr" {
39-
source = "git::https://github.com/clouddrove/terraform-aws-ecr.git?ref=tags/0.12.2"
39+
source = "clouddrove/ecr/aws"
40+
version = "0.13.0"
4041
name = "ecr"
4142
application = "clouddrove"
4243
environment = "test"
4344
label_order = ["environment", "application", "name"]
45+
scan_on_push = true
46+
image_tag_mutability = "MUTABLE"
4447
}
4548
```

_example/example.tf

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

5+
56
module "ecr" {
6-
source = "./../"
7-
name = "ecr"
8-
application = "clouddrove"
9-
environment = "test"
10-
label_order = ["environment", "application", "name"]
7+
source = "./../"
8+
name = "ecr"
9+
application = "clouddrove"
10+
environment = "test"
11+
label_order = ["environment", "application", "name"]
12+
scan_on_push = true
13+
image_tag_mutability = "MUTABLE"
14+
1115
}

_test/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/clouddrove/terraform-aws-ecr/_example
2+
3+
go 1.13
4+
5+
require (
6+
github.com/gruntwork-io/terratest v0.30.6
7+
github.com/stretchr/testify v1.6.1
8+
)

0 commit comments

Comments
 (0)