-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stacks: validate unknown component for_each type
- Loading branch information
1 parent
c2663f8
commit 4c31b00
Showing
5 changed files
with
153 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
...t-of-invalid-type/deferred-component-for-each-from-component-of-invalid-type.tfstack.hcl
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,37 @@ | ||
required_providers { | ||
testing = { | ||
source = "hashicorp/testing" | ||
version = "0.1.0" | ||
} | ||
} | ||
|
||
|
||
provider "testing" "default" {} | ||
|
||
|
||
component "parent" { | ||
source = "./parent" | ||
|
||
providers = { | ||
testing = provider.testing.default | ||
} | ||
|
||
inputs = { | ||
input = "parent" | ||
} | ||
} | ||
|
||
|
||
component "self" { | ||
source = "./self" | ||
|
||
providers = { | ||
testing = provider.testing.default | ||
} | ||
|
||
inputs = { | ||
input = each.value | ||
} | ||
|
||
for_each = component.parent.letters_in_id // This is a list and no set or map | ||
} |
27 changes: 27 additions & 0 deletions
27
...inbundle/test/deferred-component-for-each-from-component-of-invalid-type/parent/parent.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,27 @@ | ||
terraform { | ||
required_providers { | ||
testing = { | ||
source = "hashicorp/testing" | ||
version = "0.1.0" | ||
} | ||
} | ||
} | ||
|
||
variable "id" { | ||
type = string | ||
default = null | ||
nullable = true # We'll generate an ID if none provided. | ||
} | ||
|
||
variable "input" { | ||
type = string | ||
} | ||
|
||
resource "testing_resource" "data" { | ||
id = var.id | ||
value = var.input | ||
} | ||
|
||
output "letters_in_id" { | ||
value = split("", testing_resource.data.id) | ||
} |
23 changes: 23 additions & 0 deletions
23
...a/mainbundle/test/deferred-component-for-each-from-component-of-invalid-type/self/self.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,23 @@ | ||
terraform { | ||
required_providers { | ||
testing = { | ||
source = "hashicorp/testing" | ||
version = "0.1.0" | ||
} | ||
} | ||
} | ||
|
||
variable "id" { | ||
type = string | ||
default = null | ||
nullable = true # We'll generate an ID if none provided. | ||
} | ||
|
||
variable "input" { | ||
type = string | ||
} | ||
|
||
resource "testing_resource" "data" { | ||
id = var.id | ||
value = var.input | ||
} |