mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
validate planned set sizes using refinements
This commit is contained in:
parent
3c8a163583
commit
f6c536e436
@ -447,14 +447,10 @@ func assertPlannedObjectValid(schema *configschema.Object, prior, config, planne
|
||||
}
|
||||
|
||||
case configschema.NestingSet:
|
||||
if !planned.IsKnown() || !config.IsKnown() {
|
||||
// if either is unknown we cannot check the lengths
|
||||
return errs
|
||||
}
|
||||
plannedL := planned.Length()
|
||||
configL := config.Length()
|
||||
|
||||
plannedL := planned.LengthInt()
|
||||
configL := config.LengthInt()
|
||||
if plannedL != configL {
|
||||
if ok := plannedL.Range().Includes(configL); ok.IsKnown() && ok.False() {
|
||||
errs = append(errs, path.NewErrorf("count in plan (%#v) disagrees with count in config (%#v)", plannedL, configL))
|
||||
return errs
|
||||
}
|
||||
|
@ -1700,7 +1700,7 @@ func TestAssertPlanValid(t *testing.T) {
|
||||
&configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"set": {
|
||||
//Computed: true,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
NestedType: &configschema.Object{
|
||||
Nesting: configschema.NestingSet,
|
||||
|
Loading…
Reference in New Issue
Block a user