Skip to content

Commit f41c42b

Browse files
authored
Merge pull request #2 from clouddrove/CD-90
github action
2 parents 80ff601 + f357b04 commit f41c42b

File tree

6 files changed

+74
-17
lines changed

6 files changed

+74
-17
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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ This module has a few dependencies:
7171
### Simple Example
7272
Here is an example of how you can use this module in your inventory structure:
7373
```hcl
74-
module "ecr" {
75-
source = "git::https://github.com/clouddrove/terraform-aws-ecr.git?ref=tags/0.12.0"
76-
name = "ecr"
77-
application = "clouddrove"
78-
environment = "test"
79-
label_order = ["environment", "name", "application"]
80-
}
74+
module "ecr" {
75+
source = "git::https://github.com/clouddrove/terraform-aws-ecr.git?ref=tags/0.12.1"
76+
name = "ecr"
77+
application = "clouddrove"
78+
environment = "test"
79+
label_order = ["environment", "application", "name"]
80+
}
8181
```
8282

8383

README.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ 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.0"
39+
source = "git::https://github.com/clouddrove/terraform-aws-ecr.git?ref=tags/0.12.1"
4040
name = "ecr"
4141
application = "clouddrove"
4242
environment = "test"
43-
label_order = ["environment", "name", "application"]
43+
label_order = ["environment", "application", "name"]
4444
}
4545
```

_example/example.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ provider "aws" {
33
}
44

55
module "ecr" {
6-
source = "git::https://github.com/clouddrove/terraform-aws-ecr.git?ref=tags/0.12.0"
6+
source = "./../"
77
name = "ecr"
88
application = "clouddrove"
99
environment = "test"
10-
label_order = ["environment", "name", "application"]
10+
label_order = ["environment", "application", "name"]
1111
}

_test/ecr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ func Test(t *testing.T) {
2929
Tags := terraform.OutputMap(t, terraformOptions, "tags")
3030

3131
// Check that we get back the outputs that we expect
32-
assert.Equal(t, "test-ecr-clouddrove", Tags["Name"])
32+
assert.Equal(t, "test-clouddrove-ecr", Tags["Name"])
3333
assert.Contains(t, Arn, "arn:aws:ecr")
3434
}

main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ data "aws_iam_policy_document" "empty" {
7070

7171
data "aws_iam_policy_document" "resource_readonly_access" {
7272
statement {
73-
sid = "ReadonlyAccess"
73+
sid = "ReadonlyAccess"
7474
effect = "Allow"
7575

7676
principals {
@@ -94,7 +94,7 @@ data "aws_iam_policy_document" "resource_readonly_access" {
9494

9595
data "aws_iam_policy_document" "resource_full_access" {
9696
statement {
97-
sid = "FullAccess"
97+
sid = "FullAccess"
9898
effect = "Allow"
9999

100100
principals {
@@ -122,15 +122,15 @@ data "aws_iam_policy_document" "resource_full_access" {
122122

123123

124124
data "aws_iam_policy_document" "resource" {
125-
source_json = local.principals_readonly_access_non_empty ? join("", data.aws_iam_policy_document.resource_readonly_access.*.json) : join("", data.aws_iam_policy_document.empty.*.json)
125+
source_json = local.principals_readonly_access_non_empty ? join("", data.aws_iam_policy_document.resource_readonly_access.*.json) : join("", data.aws_iam_policy_document.empty.*.json)
126126
override_json = local.principals_full_access_non_empty ? join("", data.aws_iam_policy_document.resource_full_access.*.json) : join("", data.aws_iam_policy_document.empty.*.json)
127127
}
128128

129129
# Module : ECR REPOSITORY
130130
# Description : Provides an Elastic Container Registry Repository Policy.
131131
resource "aws_ecr_repository_policy" "default" {
132-
count = local.ecr_need_policy && var.enabled_ecr ? 1 : 0
132+
count = local.ecr_need_policy && var.enabled_ecr ? 1 : 0
133133
repository = join("", aws_ecr_repository.default.*.name)
134-
policy = join("", data.aws_iam_policy_document.resource.*.json)
134+
policy = join("", data.aws_iam_policy_document.resource.*.json)
135135
}
136136

0 commit comments

Comments
 (0)