Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
11 changes: 9 additions & 2 deletions paramhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ func parameterContextsEvalHook(input Input) func(ctx *tfcontext.Context, blocks

nameAttr := block.GetAttribute("name")
nameVal := nameAttr.Value()
if !nameVal.Type().Equals(cty.String) {
continue // Ignore the errors at this point
if !nameVal.IsKnown() {
// Wait for it to be known
continue
}

if nameVal.IsNull() ||
!nameVal.Type().Equals(cty.String) {
// Ignore the errors at this point
continue
}

//nolint:gocritic // string type asserted
Expand Down
2 changes: 2 additions & 0 deletions preview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func Test_Extract(t *testing.T) {
"Region": ap().
value("eu").
optVals("us", "eu", "au"),
"indexed_0": ap(),
"indexed_1": ap(),
},
},
{
Expand Down
18 changes: 18 additions & 0 deletions testdata/dynamicblock/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ variable "regions" {
default = ["us", "eu", "au"]
}

data "coder_parameter" "indexed" {
count = 2
name = "indexed_${count.index}"
display_name = "Indexed Param ${count.index}"
type = "string"
form_type = "dropdown"
default = "Hello_0"

dynamic "option" {
for_each = range(2)

content {
name = "Hello_${option.value}"
value = "Hello_${option.value}"
}
}
}

data "coder_parameter" "region" {
name = "Region"
description = "Which region would you like to deploy to?"
Expand Down
Loading