Skip to content

Commit abedf41

Browse files
authored
Merge pull request #2 from clouddrove/devops
fix github action
2 parents 43a5ca5 + eec7cc6 commit abedf41

File tree

6 files changed

+116
-77
lines changed

6 files changed

+116
-77
lines changed

.github/workflows/readme.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'Create README.md file'
22
on:
33
push:
44
branches:
5-
- master
5+
- devops
66

77
jobs:
88
readme-create:
@@ -41,13 +41,13 @@ jobs:
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
4343

44-
- name: 'Slack Notification'
45-
uses: clouddrove/action-slack@v2
46-
with:
47-
status: ${{ job.status }}
48-
fields: repo,author
49-
author_name: 'CloudDrove'
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
52-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
53-
if: always()
44+
# - name: 'Slack Notification'
45+
# uses: clouddrove/action-slack@v2
46+
# with:
47+
# status: ${{ job.status }}
48+
# fields: repo,author
49+
# author_name: 'CloudDrove'
50+
# env:
51+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
52+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
53+
# if: always()

.github/workflows/terraform.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: static-checks
22

33
on:
4-
pull_request:
4+
push:
5+
branches:
6+
- devops
7+
58

69
jobs:
710
versionExtract:
@@ -34,20 +37,16 @@ jobs:
3437
- _example/
3538

3639
steps:
37-
- name: Checkout
38-
uses: actions/checkout@v2
40+
- name: Checkout Repo
41+
uses: actions/checkout@master
3942

40-
- name: Install Terraform v${{ matrix.version }}
41-
uses: hashicorp/setup-terraform@v1
43+
- name: Auth Gcp
44+
uses: google-github-actions/auth@v1
4245
with:
43-
terraform_version: ${{ matrix.version }}
46+
credentials_json: ${{ secrets.GKE_KEY }}
4447

45-
- name: Configure AWS Credentials
46-
uses: clouddrove/configure-aws-credentials@v1
47-
with:
48-
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
49-
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
50-
aws-region: us-east-2
48+
- name: Set up Cloud SDK
49+
uses: google-github-actions/setup-gcloud@v1
5150

5251
- name: Init & validate v${{ matrix.version }}
5352
run: |

.github/workflows/terratest.yml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
name: 'Terratest GitHub Actions'
22
on:
3-
pull_request:
3+
push:
44
branches:
5-
- master
6-
types: [labeled]
5+
- devops
6+
77

88
jobs:
99
DNS:
1010
name: 'Terratest for DNS'
1111
runs-on: ubuntu-latest
1212
steps:
1313

14-
- name: 'Checkout'
14+
- name: Checkout Repo
1515
uses: actions/checkout@master
16+
# Setup gcloud CLI
1617

17-
- name: Configure AWS Credentials
18-
uses: clouddrove/configure-aws-credentials@v1
18+
- name: Auth Gcp
19+
uses: google-github-actions/auth@v1
1920
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
21+
credentials_json: ${{ secrets.GKE_KEY }}
22+
23+
- name: Set up Cloud SDK
24+
uses: google-github-actions/setup-gcloud@v1
2325

2426
- name: 'Terratest Generate Certificate DNS'
2527
if: ${{ github.event.label.name == 'terratest' }}
@@ -30,48 +32,50 @@ jobs:
3032
env:
3133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3234

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()
35+
# - name: 'Slack Notification'
36+
# uses: clouddrove/action-slack@v2
37+
# with:
38+
# status: ${{ job.status }}
39+
# fields: repo,author
40+
# author_name: 'CloudDrove'
41+
# env:
42+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
43+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
44+
# if: always()
4345

4446
Email:
4547
name: 'Terratest for Email'
4648
runs-on: ubuntu-latest
4749
steps:
4850

49-
- name: 'Checkout'
51+
- name: Checkout Repo
5052
uses: actions/checkout@master
53+
# Setup gcloud CLI
5154

52-
# - name: Configure AWS Credentials
53-
# uses: clouddrove/configure-aws-credentials@v1
54-
# with:
55-
# aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
56-
# aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
57-
# aws-region: us-east-2
55+
- name: Auth Gcp
56+
uses: google-github-actions/auth@v1
57+
with:
58+
credentials_json: ${{ secrets.GKE_KEY }}
59+
60+
- name: Set up Cloud SDK
61+
uses: google-github-actions/setup-gcloud@v1
5862

5963
- name: 'Terratest Generate Certificate Email'
6064
if: ${{ github.event.label.name == 'terratest' }}
61-
uses: 'clouddrove/[email protected].2'
65+
uses: 'clouddrove/[email protected].1'
6266
with:
6367
actions_subcommand: 'terratest'
6468
tf_actions_working_dir: _test/generate-certificate-email
6569
env:
6670
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6771

68-
- name: 'Slack Notification'
69-
uses: clouddrove/action-slack@v2
70-
with:
71-
status: ${{ job.status }}
72-
fields: repo,author
73-
author_name: 'CloudDrove'
74-
env:
75-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
76-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
77-
if: always()
72+
# - name: 'Slack Notification'
73+
# uses: clouddrove/action-slack@v2
74+
# with:
75+
# status: ${{ job.status }}
76+
# fields: repo,author
77+
# author_name: 'CloudDrove'
78+
# env:
79+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
80+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
81+
# if: always()

README.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#
66

77
# Name of this project
8-
name : Terraform google labels
8+
name : Terraform gcp storage
99

1010
# License of this project
1111
license: "APACHE"
1212

1313
# Canonical GitHub repo
14-
github_repo: clouddrove/terraform-google-labels
14+
github_repo: clouddrove/terraform-gcp-storage
1515

1616
# Badges to display
1717
badges:
@@ -36,20 +36,24 @@ description: |-
3636
include:
3737
- "terraform.md"
3838

39+
# How to use this project
3940
# How to use this project
4041
usage : |-
41-
Here are some examples of how you can use this module in your inventory structure:
42-
### labels module
42+
### Simple Example
43+
Here is an example of how you can use this module in your inventory structure:
4344
```hcl
44-
module "labels" {
45-
source = "./../"
46-
47-
name = "labels"
48-
environment = "test"
49-
label_order = ["name", "environment"]
50-
attributes = ["private"]
51-
extra_tags = {
52-
Application = "CloudDrove"
53-
}
54-
}
55-
```
45+
module "label" {
46+
source = "git::https://github.com/clouddrove/terraform-labels.git?ref=tags/0.15.0"
47+
name = "labels"
48+
environment = "prod"
49+
managedby = "[email protected]"
50+
repository = "https://github.com/clouddrove/terraform-labels"
51+
label_order = ["name","attributes","environment"]
52+
delimiter = "-"
53+
tags = {
54+
"Terraform Version" = ""
55+
"created_date" = "23-nov-22"
56+
}
57+
}
58+
```
59+

_test/labels_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Managed By : CloudDrove
2+
// Description : This Terratest is used to test the Terraform Labels module.
3+
// Copyright @ CloudDrove. All Right Reserved.
4+
package test
5+
6+
import (
7+
"github.com/gruntwork-io/terratest/modules/terraform"
8+
"github.com/stretchr/testify/assert"
9+
"testing"
10+
)
11+
12+
func Test(t *testing.T) {
13+
t.Parallel()
14+
15+
terraformOptions := &terraform.Options{
16+
// Source path of Terraform directory.
17+
TerraformDir: "../_example",
18+
Upgrade: true,
19+
}
20+
21+
// This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur
22+
terraform.InitAndApply(t, terraformOptions)
23+
24+
// To clean up any resources that have been created, run 'terraform destroy' towards the end of the test
25+
defer terraform.Destroy(t, terraformOptions)
26+
27+
// To get the value of an output variable, run 'terraform output'
28+
Tags := terraform.OutputMap(t, terraformOptions, "tags")
29+
30+
// Check that we get back the outputs that we expect
31+
assert.Equal(t, "labels-test-private", Tags["Name"])
32+
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ output "tags" {
3535
output "label_order" {
3636
value = local.label_order
3737
description = "Normalized Tag map."
38-
}
38+
}

0 commit comments

Comments
 (0)