mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
fix(provisioner/terraform): ensure ordering rich parameters produces no nil values (#7824)
This commit is contained in:
@ -694,5 +694,21 @@ func orderedRichParametersResources(tfResourcesRichParameters []*tfjson.StateRes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// There's an edge case possible for us to have a parameter name that isn't
|
||||
// present in the state, since the ordered names come statically from
|
||||
// parsing the Terraform file. We need to filter out the nil values if there
|
||||
// are any present.
|
||||
if len(tfResourcesRichParameters) != len(orderedNames) {
|
||||
nonNil := make([]*tfjson.StateResource, 0, len(ordered))
|
||||
for _, resource := range ordered {
|
||||
if resource != nil {
|
||||
nonNil = append(nonNil, resource)
|
||||
}
|
||||
}
|
||||
|
||||
ordered = nonNil
|
||||
}
|
||||
|
||||
return ordered
|
||||
}
|
||||
|
Reference in New Issue
Block a user