mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-14 01:13:59 -06:00
Merge pull request #22262 from hashicorp/mildwonkey/b-deprecation-warnings
helper/schema: don't skip deprecation check during validation
This commit is contained in:
commit
176f790323
@ -1371,6 +1371,9 @@ func (m schemaMap) validate(
|
||||
// The SDK has to allow the unknown value through initially, so that
|
||||
// Required fields set via an interpolated value are accepted.
|
||||
if !isWhollyKnown(raw) {
|
||||
if schema.Deprecated != "" {
|
||||
return []string{fmt.Sprintf("%q: [DEPRECATED] %s", k, schema.Deprecated)}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@ -4510,6 +4510,24 @@ func TestSchemaMap_Validate(t *testing.T) {
|
||||
Err: false,
|
||||
},
|
||||
|
||||
"Unknown + Deprecation": {
|
||||
Schema: map[string]*Schema{
|
||||
"old_news": &Schema{
|
||||
Type: TypeString,
|
||||
Optional: true,
|
||||
Deprecated: "please use 'new_news' instead",
|
||||
},
|
||||
},
|
||||
|
||||
Config: map[string]interface{}{
|
||||
"old_news": hcl2shim.UnknownVariableValue,
|
||||
},
|
||||
|
||||
Warnings: []string{
|
||||
"\"old_news\": [DEPRECATED] please use 'new_news' instead",
|
||||
},
|
||||
},
|
||||
|
||||
"Required sub-resource field": {
|
||||
Schema: map[string]*Schema{
|
||||
"ingress": &Schema{
|
||||
|
Loading…
Reference in New Issue
Block a user