generated from aws-ia/terraform-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update tests to use local paths and add CI workflows (#4)
- Loading branch information
1 parent
78582ac
commit 7b995d8
Showing
14 changed files
with
210 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'PR title' | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
requireScope: false | ||
subjectPattern: ^[A-Z].+$ | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
starts with an uppercase character. | ||
wip: true | ||
validateSingleCommit: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
TERRAFORM_DOCS_VERSION: v0.16.0 | ||
TFSEC_VERSION: v1.28.1 | ||
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache | ||
TFLINT_VERSION: v0.45.0 | ||
|
||
jobs: | ||
collectInputs: | ||
name: Collect workflow inputs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
directories: ${{ steps.dirs.outputs.directories }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get root directories | ||
id: dirs | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
|
||
preCommitMinVersions: | ||
name: Min TF pre-commit | ||
needs: collectInputs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | ||
steps: | ||
- name: Remove default Terraform | ||
run: rm -rf $(which terraform) | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
# We only need to check Terraform files for the current directory | ||
# because the `preCommitMaxVersion` job will run the full, | ||
# exhaustive checks (always) | ||
filters: | | ||
src: | ||
- '${{ matrix.directory }}/*.tf' | ||
- name: Config Terraform plugin cache | ||
if: steps.changes.outputs.src == 'true' | ||
run: mkdir --parents ${{ env.TERRAFORM_DOCS_VERSION }} | ||
|
||
- name: Cache Terraform | ||
uses: actions/cache@v3 | ||
if: steps.changes.outputs.src == 'true' | ||
with: | ||
path: ${{ env.TERRAFORM_DOCS_VERSION }} | ||
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }} | ||
restore-keys: ${{ runner.os }}-terraform- | ||
|
||
- name: Terraform min/max versions | ||
uses: clowdhaus/[email protected] | ||
if: steps.changes.outputs.src == 'true' | ||
id: minMax | ||
with: | ||
directory: ${{ matrix.directory }} | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory != '.' && steps.changes.outputs.src == 'true' }} | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.minVersion }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*' | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory == '.' && steps.changes.outputs.src == 'true' }} | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.minVersion }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)' | ||
|
||
preCommitMaxVersion: | ||
name: Max TF pre-commit | ||
runs-on: ubuntu-latest | ||
needs: collectInputs | ||
steps: | ||
- name: Remove default Terraform | ||
run: rm -rf $(which terraform) | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: | | ||
src: | ||
- '**/*.tf' | ||
- name: Config Terraform plugin cache | ||
if: steps.changes.outputs.src == 'true' | ||
run: mkdir --parents ${{ env.TERRAFORM_DOCS_VERSION }} | ||
|
||
- name: Cache Terraform | ||
uses: actions/cache@v3 | ||
if: steps.changes.outputs.src == 'true' | ||
with: | ||
path: ${{ env.TF_PLUGIN_CACHE_DIR }} | ||
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }} | ||
restore-keys: ${{ runner.os }}-terraform- | ||
|
||
- name: Install tfsec | ||
if: steps.changes.outputs.src == 'true' | ||
run: curl -sSLo ./tfsec https://github.com/aquasecurity/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-$(uname)-amd64 && chmod +x tfsec && sudo mv tfsec /usr/bin/ | ||
|
||
- name: Terraform min/max versions | ||
id: minMax | ||
uses: clowdhaus/[email protected] | ||
if: steps.changes.outputs.src == 'true' | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
if: steps.changes.outputs.src == 'true' | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.maxVersion }} | ||
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Stale Issue/PR' | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/stale@v6 | ||
id: stale | ||
with: | ||
ascending: true | ||
close-issue-message: 'Issue closed due to inactivity.' | ||
close-pr-message: 'Pull request closed due to inactivity.' | ||
days-before-close: 10 | ||
days-before-stale: 30 | ||
stale-issue-label: stale | ||
stale-pr-label: stale | ||
# Not stale if have this labels | ||
exempt-issue-labels: 'bug,enhancement' | ||
exempt-pr-labels: 'bug,enhancement' | ||
operations-per-run: 100 | ||
stale-issue-message: | | ||
This issue has been automatically marked as stale because it has been open 30 days | ||
with no activity. Remove stale label or comment or this issue will be closed in 10 days | ||
stale-pr-message: | | ||
This PR has been automatically marked as stale because it has been open 30 days | ||
with no activity. Remove stale label or comment or this PR will be closed in 10 days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Terraform AWS EKS Multi-Tenancy Tests | ||
|
||
- [Complete](https://github.com/aws-ia/terraform-aws-eks-blueprints-teams/tree/main/tests/complete) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.