Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint
on:
push:
branches: [ tflint-poc ]
pull_request:

jobs:
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout source code

- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ubuntu-latest-tflint-${{ hashFiles('.tflint.hcl') }}

- uses: terraform-linters/setup-tflint@v3
name: Setup TFLint
with:
tflint_version: v0.47.0

- name: Show version
run: tflint --version

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- name: Run TFLint
run: tflint --recursive -f compact --config "$(pwd)/.tflint.hcl"

23 changes: 23 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
config {
format = "compact"
plugin_dir = "~/.tflint.d/plugins"

module = true
force = false
disabled_by_default = false

ignore_module = {
"terraform-aws-modules/vpc/aws" = true
"terraform-aws-modules/security-group/aws" = true
}
}

plugin "aws" {
enabled = true
version = "0.24.1"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

rule "aws_instance_invalid_type" {
enabled = false
}
4 changes: 2 additions & 2 deletions tutorial/serverless-basic-application/api-gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ resource "aws_api_gateway_rest_api" "lambda" {
}

# Resource
resource "aws_api_gateway_resource" "resource" {
resource1 "aws_api_gateway_resource" "resource" {
path_part = "resource"
parent_id = aws_api_gateway_rest_api.lambda.root_resource_id
rest_api_id = aws_api_gateway_rest_api.lambda.id
}

# Method
resource "aws_api_gateway_method" "method" {
resource "aws_api_gateway_method1" "method" {
rest_api_id = aws_api_gateway_rest_api.lambda.id
resource_id = aws_api_gateway_resource.resource.id
http_method = "POST"
Expand Down