-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config/module: disallow root modules named "root"
Fixes #11038 This is a **short term fix**. Terraform core doesn't currently handle root modules named "root" well because the prefix `[]string{"root"}` has special meaning and Terraform core [currently] can't disambiguate between the root module and a module named "root" in the root module. This PR introduces a short term fix by simply disallowing root modules named "root". This shouldn't break any BC because since 0.8.0 this didn't work at all in many broken ways (including crashes). Longer term, this should be fixed by removing the special prefix at all and having empty paths be root. I started down this path but the core changes necessary are far too scary for a patch release. We can aim for 0.9.
- Loading branch information
Showing
7 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
config/module/test-fixtures/validate-module-root-grandchild/child/child/main.tf
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 @@ | ||
# Empty |
1 change: 1 addition & 0 deletions
1
config/module/test-fixtures/validate-module-root-grandchild/child/main.tf
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 @@ | ||
module "root" { source = "./child" } |
3 changes: 3 additions & 0 deletions
3
config/module/test-fixtures/validate-module-root-grandchild/main.tf
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 @@ | ||
module "child" { | ||
source = "./child" | ||
} |
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 @@ | ||
# Empty |
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 @@ | ||
module "root" { | ||
source = "./child" | ||
} |
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