Skip to content

Commit

Permalink
Terraform v0.15 (#1099)
Browse files Browse the repository at this point in the history
* Bump Terraform to v0.15

* Fix module fixtures for v0.15

* Checkout submodules in GitHub Actions

* Update docs
  • Loading branch information
wata727 authored Apr 18, 2021
1 parent 5add1cf commit d0181e8
Show file tree
Hide file tree
Showing 79 changed files with 86 additions and 5,040 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ $ tflint -v
TFLint version 0.26.0
+ ruleset.aws (0.3.1-bundled)
$ terraform -v
Terraform v0.14.9
Terraform v0.15.0
```
-->
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: docker build
run: docker build -t terraform-linters/tflint .
- name: docker run
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generated_code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/install_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install latest version
run: |
bash install_linux.sh
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tflint/test-fixtures/v0.15.0_module/.terraform/modules/consul"]
path = tflint/test-fixtures/v0.15.0_module/.terraform/modules/consul
url = https://github.com/hashicorp/terraform-aws-consul
2 changes: 1 addition & 1 deletion docs/user-guide/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compatibility with Terraform

Since TFLint embeds a specific version of Terraform as a library, some features implicitly assume the behavior of Terraform v0.14.9.
Since TFLint embeds a specific version of Terraform as a library, some features implicitly assume the behavior of Terraform v0.15.0

Of course, TFLint may work correctly if you run it on other versions. But, false positives/negatives can occur based on this assumption.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/hcl/v2 v2.9.1
github.com/hashicorp/logutils v1.0.0
github.com/hashicorp/terraform v0.14.10
github.com/hashicorp/terraform v0.15.0
github.com/jessevdk/go-flags v1.5.0
github.com/jstemmer/go-junit-report v0.9.1
github.com/mattn/go-colorable v0.1.8
Expand Down
66 changes: 48 additions & 18 deletions go.sum

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions tflint/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/zclconf/go-cty/cty"
)

func Test_LoadConfig_v0_12_0(t *testing.T) {
withinFixtureDir(t, "v0.12.0_module", func() {
func Test_LoadConfig_v0_15_0(t *testing.T) {
withinFixtureDir(t, "v0.15.0_module", func() {
loader, err := NewLoader(afero.Afero{Fs: afero.NewOsFs()}, moduleConfig())
if err != nil {
t.Fatalf("Unexpected error occurred: %s", err)
Expand All @@ -25,18 +25,14 @@ func Test_LoadConfig_v0_12_0(t *testing.T) {
t.Fatalf("Unexpected error occurred: %s", err)
}

if _, exists := config.Children["ecs_on_spotfleet"]; !exists {
t.Fatalf("`ecs_on_spotfleet` module is not loaded: %#v", config.Children)
}

if _, exists := config.Children["ecs_on_spotfleet"].Module.ManagedResources["aws_ecs_cluster.main"]; !exists {
t.Fatalf("`ecs_on_spotfleet` module resource `aws_ecs_cluster.main` is not loaded: %#v", config.Children["ecs_on_spotfleet"].Module.ManagedResources)
}

if _, exists := config.Children["instance"]; !exists {
t.Fatalf("`instance` module is not loaded: %#v", config.Children)
}

if _, exists := config.Children["instance"].Module.ManagedResources["aws_instance.main"]; !exists {
t.Fatalf("`instance` module resource `aws_instance.main` is not loaded: %#v", config.Children["instance"].Module.ManagedResources)
}

if _, exists := config.Children["consul"]; !exists {
t.Fatalf("`consul` module is not loaded: %#v", config.Children)
}
Expand Down Expand Up @@ -137,7 +133,7 @@ func Test_LoadConfig_invalidConfiguration(t *testing.T) {
}

func Test_Files(t *testing.T) {
withinFixtureDir(t, "v0.12.0_module", func() {
withinFixtureDir(t, "v0.15.0_module", func() {
loader, err := NewLoader(afero.Afero{Fs: afero.NewOsFs()}, EmptyConfig())
if err != nil {
t.Fatalf("Unexpected error occurred: %s", err)
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d0181e8

Please sign in to comment.