Skip to content

Commit 107c557

Browse files
committed
Test Modules with Terraform Plan
1 parent cbfa7a8 commit 107c557

File tree

16 files changed

+47
-4
lines changed

16 files changed

+47
-4
lines changed

.github/workflows/terraform.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
env:
3636
BASE_SHA: ${{ github.event.pull_request.base.sha }}
3737
run: |
38-
JQ_OUTPUT_CHANGED=$(git diff --name-only $BASE_SHA $GITHUB_SHA modules/*/*/*.tf |
38+
JQ_OUTPUT_CHANGED=$(git diff --name-only $BASE_SHA $GITHUB_SHA modules/**/*.tf |
3939
cut -d/ -f1-3 | sort -u | jq -MRsc 'split("\n")[:-1]')
4040
echo "changed_modules=$JQ_OUTPUT_CHANGED" >> $GITHUB_OUTPUT
4141
@@ -69,6 +69,17 @@ jobs:
6969
id: validate
7070
run: terraform validate
7171

72+
- name: Terraform Plan
73+
id: plan
74+
env:
75+
"AWS_DEFAULT_REGION": "eu-west-2"
76+
"AWS_ACCESS_KEY_ID": ${{ secrets.AWS_ACCESS_KEY_ID }}
77+
"AWS_SECRET_ACCESS_KEY": ${{ secrets.AWS_SECRET_ACCESS_KEY }}
78+
run: |
79+
cd test
80+
terraform init
81+
terraform plan
82+
7283
- name: Terraform Security
7384
uses: aquasecurity/[email protected]
7485
with:
@@ -135,4 +146,3 @@ jobs:
135146
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
136147
file_pattern: .github/dependabot.yml
137148
skip_checkout: true
138-
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module "example_com" {
2+
source = "../."
3+
4+
domain = "example.com"
5+
aliases = [
6+
"example.org"
7+
]
8+
9+
alias_records = {
10+
"example.org" = {
11+
foo = {
12+
name = "foo"
13+
type = "CNAME"
14+
records = ["www.example.com"]
15+
}
16+
}
17+
}
18+
records = {
19+
google_site_verification = {
20+
name = "google-site-verification"
21+
type = "TXT"
22+
records = ["google-site-verification-key"]
23+
}
24+
www = {
25+
name = "www"
26+
type = "A"
27+
records = ["1.2.3.4"]
28+
}
29+
}
30+
<<<<<<< HEAD
31+
32+
}
33+
=======
34+
}
35+
>>>>>>> 510216e (Pipeline detection of changed example)
File renamed without changes.

modules/aws/route53/example/example.tf renamed to modules/aws/route53/test/test.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module "example_com" {
55
aliases = [
66
"example.org"
77
]
8-
98
alias_records = {
109
"example.org" = {
1110
foo = {
@@ -27,5 +26,4 @@ module "example_com" {
2726
records = ["1.2.3.4"]
2827
}
2928
}
30-
3129
}

0 commit comments

Comments
 (0)