Merge pull request #33378 from hashicorp/jbardin/objchange-refinements

validate planned set sizes using refinements
pull/33386/head
James Bardin 3 years ago committed by GitHub
commit 1e6b2d0f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save