-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8b7600
Showing
10 changed files
with
318 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu | ||
{ | ||
"name": "Ubuntu", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/base:jammy", | ||
"features": { | ||
"ghcr.io/devcontainers/features/terraform:1": {}, | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"github.vscode-github-actions" | ||
] | ||
} | ||
} | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "uname -a", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,61 @@ | ||
name: "Test & Release" | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ["v0.44.1", "latest"] | ||
fail: ["false", "true"] | ||
fail-fast: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Lint Successfull | ||
if: ${{ matrix.fail == 'false' }} | ||
uses: "./" | ||
with: | ||
version: ${{ matrix.version }} | ||
directory: "./test/success" | ||
continue-on-error: false | ||
- name: Lint Failure | ||
if: ${{ matrix.fail == 'true' }} | ||
id: fail | ||
uses: "./" | ||
with: | ||
version: ${{ matrix.version }} | ||
directory: "./test/success" | ||
continue-on-error: true | ||
- name: Validate Failure | ||
if: ${{ matrix.fail == 'true' && steps.fail.outcome == 'success' }} | ||
run: exit 1 | ||
|
||
release: | ||
name: Release | ||
needs: | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Semantic Release Plugins | ||
run: | | ||
npm install semantic-release-replace-plugin -D | ||
npm install --save-dev semantic-release-major-tag | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v4 | ||
with: | ||
dry_run: ${{ github.event_name == 'pull_request' }} | ||
ci: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,51 @@ | ||
{ | ||
"branches": [ | ||
"main" | ||
], | ||
"tagFormat": "v${version}", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"semantic-release-major-tag", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"semantic-release-replace-plugin", | ||
{ | ||
"replacements": [ | ||
{ | ||
"files": [ | ||
"README.md" | ||
], | ||
"from": "\"m4s-b3n/tflint-all-in-one@v.*\"", | ||
"to": "\"m4s-b3n/tflint-all-in-one@v${nextRelease.version}\"", | ||
"results": [ | ||
{ | ||
"file": "README.md", | ||
"hasChanged": true, | ||
"numMatches": 1, | ||
"numReplacements": 1 | ||
} | ||
], | ||
"countMatches": true | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", | ||
"assets": [ | ||
"CHANGELOG.md", | ||
"README.md" | ||
] | ||
} | ||
], | ||
"@semantic-release/github" | ||
] | ||
} |
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,10 @@ | ||
config { | ||
module = true | ||
force = false | ||
disabled_by_default = false | ||
} | ||
|
||
plugin "terraform" { | ||
enabled = true | ||
preset = "recommended" | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Marius Boden | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,39 @@ | ||
# tflint-all-in-one | ||
|
||
![Semantic Release](https://github.com/m4s-b3n/tflint-all-in-one/actions/workflows/test-and-release.yml/badge.svg) | ||
|
||
Run common TFLint commands in a single GitHub action | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: "Lint" | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Lint Terraform Code | ||
uses: "m4s-b3n/[email protected]" | ||
with: | ||
directory: "./terraform" | ||
``` | ||
## Inputs | ||
| Input Name | Description | Required | Default | | ||
| --- | --- | --- | --- | | ||
| version | The version of TFLint to use | false | latest | | ||
| directory | The directory where the Terraform configuration files are located | 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,33 @@ | ||
name: "TFLint All-In-One" | ||
|
||
description: "Scan Terraform Configuration Files" | ||
|
||
inputs: | ||
version: | ||
description: "The version of TFLint to use" | ||
required: false | ||
default: "latest" | ||
directory: | ||
description: "The directory where the Terraform configuration files are located" | ||
required: false | ||
default: "." | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup TFLint | ||
uses: terraform-linters/setup-tflint@v3 | ||
with: | ||
tflint_version: ${{ inputs.version }} | ||
- name: Show version | ||
run: tflint --version | ||
shell: bash | ||
- name: Init TFLint | ||
run: tflint --init | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
shell: bash | ||
- name: Run TFLint | ||
run: tflint -f compact | ||
working-directory: ${{ inputs.directory }} | ||
shell: bash |
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,38 @@ | ||
# dev | ||
*.dev.* | ||
**/.terraform.lock.hcl | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
crash.*.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sensitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
*.tfvars | ||
*.tfvars.json | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc |
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,14 @@ | ||
# Define the provider | ||
provider "local" {} | ||
|
||
variable "filename" { | ||
type = string | ||
description = "Name of the file to create" | ||
default = "example.dev.txt" | ||
} | ||
|
||
# Define the resource | ||
resource "local_file" "example" { | ||
content = "Hello, World!" | ||
filename = "${path.module}/${var.filename}" | ||
} |
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,24 @@ | ||
# Define the provider | ||
terraform { | ||
required_version = "~>1.0" | ||
required_providers { | ||
local = { | ||
source = "hashicorp/local" | ||
version = "2.4.0" | ||
} | ||
} | ||
} | ||
|
||
provider "local" {} | ||
|
||
variable "filename" { | ||
type = string | ||
description = "Name of the file to create" | ||
default = "example.dev.txt" | ||
} | ||
|
||
# Define the resource | ||
resource "local_file" "example" { | ||
content = "Hello, World!" | ||
filename = "${path.module}/${var.filename}" | ||
} |