Skip to content

Commit 2860070

Browse files
authored
Testing with Go 1.17 and Terratest 0.39.0 (#22)
1 parent b787bed commit 2860070

14 files changed

+424
-741
lines changed

.github/mergify.yml

+58-51
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
11
# https://docs.mergify.io/conditions.html
22
# https://docs.mergify.io/actions.html
33
pull_request_rules:
4-
- name: "approve automated PRs that have passed checks"
5-
conditions:
6-
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
7-
- "base=main"
8-
- "-closed"
9-
- "head~=^(auto-update|renovate)/.*"
10-
- "check-success=test/bats"
11-
- "check-success=test/readme"
12-
- "check-success=test/terratest"
13-
- "check-success=validate-codeowners"
14-
actions:
15-
review:
16-
type: "APPROVE"
17-
bot_account: "cloudposse-mergebot"
18-
message: "We've automatically approved this PR because the checks from the automated Pull Request have passed."
4+
- name: "approve automated PRs that have passed checks"
5+
conditions:
6+
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
7+
- "base=master"
8+
- "-closed"
9+
- "head~=^(auto-update|renovate)/.*"
10+
- "check-success=test/bats"
11+
- "check-success=test/readme"
12+
- "check-success=test/terratest"
13+
- "check-success=validate-codeowners"
14+
actions:
15+
review:
16+
type: "APPROVE"
17+
bot_account: "cloudposse-mergebot"
18+
message: "We've automatically approved this PR because the checks from the automated Pull Request have passed."
1919

20-
- name: "merge automated PRs when approved and tests pass"
21-
conditions:
22-
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
23-
- "base=main"
24-
- "-closed"
25-
- "head~=^(auto-update|renovate)/.*"
26-
- "check-success=test/bats"
27-
- "check-success=test/readme"
28-
- "check-success=test/terratest"
29-
- "check-success=validate-codeowners"
30-
- "#approved-reviews-by>=1"
31-
- "#changes-requested-reviews-by=0"
32-
- "#commented-reviews-by=0"
33-
actions:
34-
merge:
35-
method: "squash"
20+
- name: "merge automated PRs when approved and tests pass"
21+
conditions:
22+
- "author~=^(cloudpossebot|renovate\\[bot\\])$"
23+
- "base=master"
24+
- "-closed"
25+
- "head~=^(auto-update|renovate)/.*"
26+
- "check-success=test/bats"
27+
- "check-success=test/readme"
28+
- "check-success=test/terratest"
29+
- "check-success=validate-codeowners"
30+
- "#approved-reviews-by>=1"
31+
- "#changes-requested-reviews-by=0"
32+
- "#commented-reviews-by=0"
33+
actions:
34+
merge:
35+
method: "squash"
3636

37-
- name: "delete the head branch after merge"
38-
conditions:
39-
- "merged"
40-
actions:
41-
delete_head_branch: {}
37+
- name: "delete the head branch after merge"
38+
conditions:
39+
- "merged"
40+
actions:
41+
delete_head_branch: {}
4242

43-
- name: "ask to resolve conflict"
44-
conditions:
45-
- "conflict"
46-
- "-closed"
47-
actions:
48-
comment:
49-
message: "This pull request is now in conflict. Could you fix it @{{author}}? 🙏"
43+
- name: "ask to resolve conflict"
44+
conditions:
45+
- "conflict"
46+
- "-closed"
47+
actions:
48+
comment:
49+
message: "This pull request is now in conflict. Could you fix it @{{author}}? 🙏"
5050

51-
- name: "remove outdated reviews"
52-
conditions:
53-
- "base=main"
54-
actions:
55-
dismiss_reviews:
56-
changes_requested: true
57-
approved: true
58-
message: "This Pull Request has been updated, so we're dismissing all reviews."
51+
- name: "remove outdated reviews"
52+
conditions:
53+
- "base=master"
54+
actions:
55+
dismiss_reviews:
56+
changes_requested: true
57+
approved: true
58+
message: "This Pull Request has been updated, so we're dismissing all reviews."
59+
60+
- name: "close Pull Requests without files changed"
61+
conditions:
62+
- "#files=0"
63+
actions:
64+
close:
65+
message: "This pull request has been automatically closed by Mergify because there are no longer any changes."

.github/workflows/auto-context.yml

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
name: "auto-context"
22
on:
33
schedule:
4-
# Update context.tf nightly
5-
- cron: "0 3 * * *"
4+
# Update context.tf nightly
5+
- cron: '0 3 * * *'
66

77
jobs:
88
update:
99
if: github.event_name == 'schedule'
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v2
1313

14-
- name: Update context.tf
15-
shell: bash
16-
id: update
17-
env:
18-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
19-
run: |
20-
if [[ -f context.tf ]]; then
21-
echo "Discovered existing context.tf! Fetching most recent version to see if there is an update."
22-
curl -o context.tf -fsSL https://raw.githubusercontent.com/cloudposse/terraform-null-label/main/exports/context.tf
23-
if git diff --no-patch --exit-code context.tf; then
24-
echo "No changes detected! Exiting the job..."
25-
else
26-
echo "context.tf file has changed. Update examples and rebuild README.md."
27-
make init
28-
make github/init/context.tf
29-
make readme/build
30-
echo "::set-output name=create_pull_request::true"
31-
fi
14+
- name: Update context.tf
15+
shell: bash
16+
id: update
17+
env:
18+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
19+
run: |
20+
if [[ -f context.tf ]]; then
21+
echo "Discovered existing context.tf! Fetching most recent version to see if there is an update."
22+
curl -o context.tf -fsSL https://raw.githubusercontent.com/cloudposse/terraform-null-label/master/exports/context.tf
23+
if git diff --no-patch --exit-code context.tf; then
24+
echo "No changes detected! Exiting the job..."
3225
else
33-
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates."
26+
echo "context.tf file has changed. Update examples and rebuild README.md."
27+
make init
28+
make github/init/context.tf
29+
make readme/build
30+
echo "::set-output name=create_pull_request::true"
3431
fi
32+
else
33+
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates."
34+
fi
3535
36-
- name: Create Pull Request
37-
if: steps.update.outputs.create_pull_request == 'true'
38-
uses: cloudposse/actions/github/create-pull-request@0.22.0
39-
with:
40-
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
41-
committer: "cloudpossebot <[email protected]>"
42-
author: "cloudpossebot <[email protected]>"
43-
commit-message: Update context.tf from origin source
44-
title: Update context.tf
45-
body: |-
46-
## what
47-
This is an auto-generated PR that updates the `context.tf` file to the latest version from `cloudposse/terraform-null-label`
36+
- name: Create Pull Request
37+
if: steps.update.outputs.create_pull_request == 'true'
38+
uses: cloudposse/actions/github/create-pull-request@0.30.0
39+
with:
40+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
41+
committer: 'cloudpossebot <[email protected]>'
42+
author: 'cloudpossebot <[email protected]>'
43+
commit-message: Update context.tf from origin source
44+
title: Update context.tf
45+
body: |-
46+
## what
47+
This is an auto-generated PR that updates the `context.tf` file to the latest version from `cloudposse/terraform-null-label`
4848
49-
## why
50-
To support all the features of the `context` interface.
49+
## why
50+
To support all the features of the `context` interface.
5151
52-
branch: auto-update/context.tf
53-
base: main
54-
delete-branch: true
55-
labels: |
56-
auto-update
57-
context
52+
branch: auto-update/context.tf
53+
base: master
54+
delete-branch: true
55+
labels: |
56+
auto-update
57+
context

.github/workflows/auto-format.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
auto-format:
88
runs-on: ubuntu-latest
9-
container: cloudposse/build-harness:slim-latest
9+
container: cloudposse/build-harness:latest
1010
steps:
1111
# Checkout the pull request branch
1212
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
@@ -29,6 +29,8 @@ jobs:
2929
- name: Auto Format
3030
if: github.event.pull_request.state == 'open'
3131
shell: bash
32+
env:
33+
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
3234
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host
3335

3436
# Commit changes (if any) to the PR branch
@@ -60,7 +62,7 @@ jobs:
6062
fi
6163
6264
- name: Auto Test
63-
uses: cloudposse/actions/github/repository-dispatch@0.22.0
65+
uses: cloudposse/actions/github/repository-dispatch@0.30.0
6466
# match users by ID because logins (user names) are inconsistent,
6567
# for example in the REST API Renovate Bot is `renovate[bot]` but
6668
# in GraphQL it is just `renovate`, plus there is a non-bot

.github/workflows/auto-readme.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "auto-readme"
2+
on:
3+
schedule:
4+
# Example of job definition:
5+
# .---------------- minute (0 - 59)
6+
# | .------------- hour (0 - 23)
7+
# | | .---------- day of month (1 - 31)
8+
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
9+
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
10+
# | | | | |
11+
# * * * * * user-name command to be executed
12+
13+
# Update README.md nightly at 4am UTC
14+
- cron: '0 4 * * *'
15+
16+
jobs:
17+
update:
18+
if: github.event_name == 'schedule'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Update readme
24+
shell: bash
25+
id: update
26+
env:
27+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28+
run: |
29+
make init
30+
make readme/build
31+
# Ignore changes if they are only whitespace
32+
git diff --ignore-all-space --ignore-blank-lines --quiet README.md && { git restore README.md; echo Ignoring whitespace-only changes in README; }
33+
34+
- name: Create Pull Request
35+
# This action will not create or change a pull request if there are no changes to make.
36+
# If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
37+
uses: cloudposse/actions/github/[email protected]
38+
with:
39+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
40+
commit-message: Update README.md and docs
41+
title: Update README.md and docs
42+
body: |-
43+
## what
44+
This is an auto-generated PR that updates the README.md and docs
45+
46+
## why
47+
To have most recent changes of README.md and doc from origin templates
48+
49+
branch: auto-update/readme
50+
base: main
51+
delete-branch: true
52+
labels: |
53+
auto-update
54+
no-release
55+
readme

.github/workflows/auto-release.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@ on:
44
push:
55
branches:
66
- main
7+
- master
8+
- production
79

810
jobs:
911
publish:
1012
runs-on: ubuntu-latest
1113
steps:
14+
# Get PR from merged commit to master
15+
- uses: actions-ecosystem/action-get-merged-pull-request@v1
16+
id: get-merged-pull-request
17+
with:
18+
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
1219
# Drafts your next Release notes as Pull Requests are merged into "main"
1320
- uses: release-drafter/release-drafter@v5
1421
with:
15-
publish: true
22+
publish: ${{ !contains(steps.get-merged-pull-request.outputs.labels, 'no-release') }}
1623
prerelease: false
1724
config-name: auto-release.yml
1825
env:

.github/workflows/chatops.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: "Handle common commands"
12-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
12+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
1313
with:
1414
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
1515
reaction-token: ${{ secrets.GITHUB_TOKEN }}
@@ -24,7 +24,7 @@ jobs:
2424
- name: "Checkout commit"
2525
uses: actions/checkout@v2
2626
- name: "Run tests"
27-
uses: cloudposse/actions/github/slash-command-dispatch@0.22.0
27+
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
2828
with:
2929
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
3030
reaction-token: ${{ secrets.GITHUB_TOKEN }}
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Validate Codeowners
22
on:
3+
workflow_dispatch:
4+
35
pull_request:
46

57
jobs:
@@ -8,18 +10,20 @@ jobs:
810
steps:
911
- name: "Checkout source code at current commit"
1012
uses: actions/checkout@v2
11-
- uses: mszostok/codeowners-validator@v0.5.0
13+
- uses: mszostok/codeowners-validator@v0.7.1
1214
if: github.event.pull_request.head.repo.full_name == github.repository
1315
name: "Full check of CODEOWNERS"
1416
with:
1517
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
1618
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
1719
# checks: "files,syntax,owners,duppatterns"
1820
checks: "syntax,owners,duppatterns"
21+
owner_checker_allow_unowned_patterns: "false"
1922
# GitHub access token is required only if the `owners` check is enabled
2023
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
21-
- uses: mszostok/codeowners-validator@v0.5.0
24+
- uses: mszostok/codeowners-validator@v0.7.1
2225
if: github.event.pull_request.head.repo.full_name != github.repository
2326
name: "Syntax check of CODEOWNERS"
2427
with:
2528
checks: "syntax,duppatterns"
29+
owner_checker_allow_unowned_patterns: "false"

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Local .terraform directories
2-
**/.terraform/*
2+
**/.terraform
3+
**/.terraform.d
34

45
# .tfstate files
56
*.tfstate
@@ -18,3 +19,9 @@
1819
# Crash log files
1920
crash.log
2021
test.log
22+
23+
# Editor backups
24+
*.orig
25+
*.draft
26+
*~
27+

examples/complete/fixtures.us-east-2.tfvars

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ stage = "test"
88

99
name = "example"
1010

11+
example_input = "Hello, world!"
12+

0 commit comments

Comments
 (0)