mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-03 20:50:59 -05:00
only unmark deep once for ValidateDeep
This commit is contained in:
parent
76747e174c
commit
c7bc22ed79
2 changed files with 4 additions and 5 deletions
|
|
@ -50,8 +50,7 @@ func (d *Deprecations) Validate(value cty.Value, module addrs.Module, rng *hcl.R
|
|||
|
||||
// ValidateDeep does the same as Validate but checks deeply nested deprecation marks as well.
|
||||
func (d *Deprecations) ValidateDeep(value cty.Value, module addrs.Module, rng *hcl.Range) (cty.Value, tfdiags.Diagnostics) {
|
||||
deprecationMarks := marks.GetDeprecationMarksDeep(value)
|
||||
notDeprecatedValue := marks.RemoveDeprecationMarksDeep(value)
|
||||
notDeprecatedValue, deprecationMarks := marks.GetDeprecationMarksDeep(value)
|
||||
return notDeprecatedValue, d.deprecationMarksToDiagnostics(deprecationMarks, module, rng)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ func GetDeprecationMarks(val cty.Value) []DeprecationMark {
|
|||
|
||||
// GetDeprecationMarksDeep returns all deprecation marks present on the given
|
||||
// cty.Value or any nested values.
|
||||
func GetDeprecationMarksDeep(val cty.Value) []DeprecationMark {
|
||||
_, marks := val.UnmarkDeep()
|
||||
return FilterDeprecationMarks(marks)
|
||||
func GetDeprecationMarksDeep(val cty.Value) (cty.Value, []DeprecationMark) {
|
||||
unmarked, marks := val.UnmarkDeep()
|
||||
return unmarked, FilterDeprecationMarks(marks)
|
||||
}
|
||||
|
||||
// RemoveDeprecationMarks returns a copy of the given cty.Value with all
|
||||
|
|
|
|||
Loading…
Reference in a new issue