diff --git a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/datasource_example/example_data_source_gen.go b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/datasource_example/example_data_source_gen.go index 4ea5d22f..2278d159 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/datasource_example/example_data_source_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/datasource_example/example_data_source_gen.go @@ -617,8 +617,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -639,10 +637,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -661,10 +655,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -683,10 +673,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -705,10 +691,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -727,8 +709,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -737,7 +719,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -804,8 +786,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -813,7 +793,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -824,10 +804,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -835,7 +811,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -846,10 +822,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -857,7 +829,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -868,10 +840,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -879,7 +847,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -890,10 +858,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -901,7 +865,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -912,8 +876,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -922,7 +886,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1185,8 +1149,6 @@ func (t ListNestedAttributeOneType) String() string { func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1207,13 +1169,13 @@ func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1280,8 +1242,6 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1289,7 +1249,7 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1300,13 +1260,13 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1501,8 +1461,6 @@ func (t ListNestedAttributeThreeType) String() string { func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] @@ -1523,13 +1481,13 @@ func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1596,8 +1554,6 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri return NewListNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] if !ok { @@ -1605,7 +1561,7 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `list_nested_attribute_three_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeThreeValueNull(), diags + return NewListNestedAttributeThreeValueUnknown(), diags } listNestedAttributeThreeListNestedAttributeOneVal, ok := listNestedAttributeThreeListNestedAttributeOne.(basetypes.ListValue) @@ -1616,13 +1572,13 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeValueUnknown(), diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1852,8 +1808,6 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) String() string { func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -1874,13 +1828,13 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1947,8 +1901,6 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -1956,7 +1908,7 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedAttributeThreeListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -1967,13 +1919,13 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2174,8 +2126,6 @@ func (t ListNestedAttributeTwoType) String() string { func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] @@ -2196,13 +2146,13 @@ func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2269,8 +2219,6 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] if !ok { @@ -2278,7 +2226,7 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `list_nested_attribute_two_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeTwoValueNull(), diags + return NewListNestedAttributeTwoValueUnknown(), diags } listNestedAttributeTwoListNestedAttributeOneVal, ok := listNestedAttributeTwoListNestedAttributeOne.(basetypes.ListValue) @@ -2289,13 +2237,13 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoValueUnknown(), diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2525,8 +2473,6 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) String() string { func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2547,13 +2493,13 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2620,8 +2566,6 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2629,7 +2573,7 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeTwoListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2640,13 +2584,13 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2841,8 +2785,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2863,10 +2805,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2885,10 +2823,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2907,10 +2841,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2929,10 +2859,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2951,8 +2877,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -2961,7 +2887,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3028,8 +2954,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3037,7 +2961,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3048,10 +2972,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3059,7 +2979,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3070,10 +2990,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3081,7 +2997,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3092,10 +3008,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3103,7 +3015,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3114,10 +3026,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3125,7 +3033,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3136,8 +3044,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -3146,7 +3054,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3409,8 +3317,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3431,10 +3337,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3453,10 +3355,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3475,10 +3373,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3497,10 +3391,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3519,8 +3409,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3529,7 +3419,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3596,8 +3486,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3605,7 +3493,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3616,10 +3504,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3627,7 +3511,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3638,10 +3522,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3649,7 +3529,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3660,10 +3540,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3671,7 +3547,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3682,10 +3558,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3693,7 +3565,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3704,8 +3576,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3714,7 +3586,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3977,8 +3849,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3999,10 +3869,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4021,10 +3887,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4043,10 +3905,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4065,10 +3923,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4087,8 +3941,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4097,7 +3951,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4164,8 +4018,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4173,7 +4025,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4184,10 +4036,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4195,7 +4043,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -4206,10 +4054,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4217,7 +4061,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -4228,10 +4072,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4239,7 +4079,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -4250,10 +4090,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4261,7 +4097,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -4272,8 +4108,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4282,7 +4118,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4545,8 +4381,6 @@ func (t SingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -4567,13 +4401,13 @@ func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4640,8 +4474,6 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4649,7 +4481,7 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4660,13 +4492,13 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4861,8 +4693,6 @@ func (t SingleNestedAttributeThreeType) String() string { func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] @@ -4883,13 +4713,13 @@ func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4956,8 +4786,6 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att return NewSingleNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] if !ok { @@ -4965,7 +4793,7 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `single_nested_attribute_three_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeThreeValueNull(), diags + return NewSingleNestedAttributeThreeValueUnknown(), diags } singleNestedAttributeThreeSingleNestedAttributeOneVal, ok := singleNestedAttributeThreeSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -4976,13 +4804,13 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeValueUnknown(), diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5204,8 +5032,6 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) String() string func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -5226,13 +5052,13 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject( fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5299,8 +5125,6 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -5308,7 +5132,7 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -5319,13 +5143,13 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5526,8 +5350,6 @@ func (t SingleNestedAttributeTwoType) String() string { func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] @@ -5548,13 +5370,13 @@ func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5621,8 +5443,6 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] if !ok { @@ -5630,7 +5450,7 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `single_nested_attribute_two_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeTwoValueNull(), diags + return NewSingleNestedAttributeTwoValueUnknown(), diags } singleNestedAttributeTwoSingleNestedAttributeOneVal, ok := singleNestedAttributeTwoSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -5641,13 +5461,13 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoValueUnknown(), diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5869,8 +5689,6 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -5891,13 +5709,13 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ct fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5964,8 +5782,6 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -5973,7 +5789,7 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -5984,13 +5800,13 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6185,8 +6001,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6207,10 +6021,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6229,10 +6039,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6251,10 +6057,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6273,10 +6075,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6295,8 +6093,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -6305,7 +6103,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6372,8 +6170,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6381,7 +6177,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6392,10 +6188,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6403,7 +6195,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -6414,10 +6206,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6425,7 +6213,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -6436,10 +6224,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6447,7 +6231,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -6458,10 +6242,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6469,7 +6249,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -6480,8 +6260,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -6490,7 +6270,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6753,8 +6533,6 @@ func (t ListNestedBlockOneType) String() string { func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6775,13 +6553,13 @@ func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6848,8 +6626,6 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6857,7 +6633,7 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockOneValueNull(), diags + return NewListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6868,13 +6644,13 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockOneValueUnknown(), diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7069,8 +6845,6 @@ func (t ListNestedBlockThreeType) String() string { func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] @@ -7091,10 +6865,6 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7113,14 +6883,14 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7187,8 +6957,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute return NewListNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] if !ok { @@ -7196,7 +6964,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `list_nested_block_three_list_nested_block_one is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } listNestedBlockThreeListNestedBlockOneVal, ok := listNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -7207,10 +6975,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7218,7 +6982,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `object_attribute is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -7229,14 +6993,14 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeValueUnknown(), diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7495,8 +7259,6 @@ func (t ListNestedBlockThreeListNestedBlockOneType) String() string { func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -7517,13 +7279,13 @@ func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context. fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7590,8 +7352,6 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -7599,7 +7359,7 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -7610,13 +7370,13 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7817,8 +7577,6 @@ func (t ListNestedBlockTwoType) String() string { func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] @@ -7839,13 +7597,13 @@ func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7912,8 +7670,6 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] if !ok { @@ -7921,7 +7677,7 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `list_nested_block_two_list_nested_block_one is missing from object`) - return NewListNestedBlockTwoValueNull(), diags + return NewListNestedBlockTwoValueUnknown(), diags } listNestedBlockTwoListNestedBlockOneVal, ok := listNestedBlockTwoListNestedBlockOne.(basetypes.ListValue) @@ -7932,13 +7688,13 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoValueUnknown(), diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8168,8 +7924,6 @@ func (t ListNestedBlockTwoListNestedBlockOneType) String() string { func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8190,13 +7944,13 @@ func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8263,8 +8017,6 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8272,7 +8024,7 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockTwoListNestedBlockOneValueNull(), diags + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8283,13 +8035,13 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8484,8 +8236,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8506,10 +8256,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8528,10 +8274,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8550,10 +8292,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8572,10 +8310,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8594,8 +8328,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -8604,7 +8338,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8671,8 +8405,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8680,7 +8412,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8691,10 +8423,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8702,7 +8430,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -8713,10 +8441,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8724,7 +8448,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -8735,10 +8459,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8746,7 +8466,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -8757,10 +8477,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8768,7 +8484,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -8779,8 +8495,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -8789,7 +8505,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9052,8 +8768,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9074,10 +8788,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9096,10 +8806,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9118,10 +8824,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9140,10 +8842,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9162,8 +8860,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9172,7 +8870,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9239,8 +8937,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9248,7 +8944,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9259,10 +8955,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9270,7 +8962,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -9281,10 +8973,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9292,7 +8980,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -9303,10 +8991,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9314,7 +8998,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -9325,10 +9009,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9336,7 +9016,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -9347,8 +9027,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9357,7 +9037,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9620,8 +9300,6 @@ func (t SingleNestedBlockOneType) String() string { func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9642,13 +9320,13 @@ func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9715,8 +9393,6 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9724,7 +9400,7 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9735,13 +9411,13 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9936,8 +9612,6 @@ func (t SingleNestedBlockThreeType) String() string { func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() objectAttribute, ok := attributes["object_attribute"] @@ -9958,10 +9632,6 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -9980,14 +9650,14 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10054,8 +9724,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu return NewSingleNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -10063,7 +9731,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `object_attribute is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -10074,10 +9742,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -10085,7 +9749,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `single_nested_block_three_list_nested_block_one is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } singleNestedBlockThreeListNestedBlockOneVal, ok := singleNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -10096,14 +9760,14 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeValueUnknown(), diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10362,8 +10026,6 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) String() string { func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -10384,13 +10046,13 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10457,8 +10119,6 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -10466,7 +10126,7 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -10477,13 +10137,13 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10684,8 +10344,6 @@ func (t SingleNestedBlockTwoType) String() string { func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] @@ -10706,13 +10364,13 @@ func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10779,8 +10437,6 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] if !ok { @@ -10788,7 +10444,7 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `single_nested_block_two_single_nested_block_one is missing from object`) - return NewSingleNestedBlockTwoValueNull(), diags + return NewSingleNestedBlockTwoValueUnknown(), diags } singleNestedBlockTwoSingleNestedBlockOneVal, ok := singleNestedBlockTwoSingleNestedBlockOne.(basetypes.ObjectValue) @@ -10799,13 +10455,13 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoValueUnknown(), diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11027,8 +10683,6 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) String() string { func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -11049,13 +10703,13 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11122,8 +10776,6 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -11131,7 +10783,7 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockTwoSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -11142,13 +10794,13 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/provider_example/example_provider_gen.go b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/provider_example/example_provider_gen.go index 0b5cb646..5e861879 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/provider_example/example_provider_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/provider_example/example_provider_gen.go @@ -240,8 +240,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -262,10 +260,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -284,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -306,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -328,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -350,8 +332,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -360,7 +342,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -427,8 +409,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -436,7 +416,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -447,10 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -458,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -469,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -480,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -491,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -502,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -513,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -524,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -535,8 +499,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -545,7 +509,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -808,8 +772,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -830,10 +792,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -852,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -874,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -896,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -918,8 +864,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -928,7 +874,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -995,8 +941,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1004,7 +948,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1015,10 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1026,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1037,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1048,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1059,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1070,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1081,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1092,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1103,8 +1031,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1113,7 +1041,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1376,8 +1304,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1398,10 +1324,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1420,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1442,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1464,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1486,8 +1396,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1496,7 +1406,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1563,8 +1473,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1572,7 +1480,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1583,10 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1594,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1605,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1616,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1627,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1638,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1649,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1660,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1671,8 +1563,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1681,7 +1573,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1944,8 +1836,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1966,10 +1856,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1988,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2010,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2032,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2054,8 +1928,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2064,7 +1938,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2131,8 +2005,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2140,7 +2012,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2151,10 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2162,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2173,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2184,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2195,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2206,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2217,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2228,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2239,8 +2095,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2249,7 +2105,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2512,8 +2368,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2534,10 +2388,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2556,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2578,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2600,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2622,8 +2460,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2632,7 +2470,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2699,8 +2537,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2708,7 +2544,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2719,10 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2730,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2741,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2752,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2763,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2774,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2785,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2796,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2807,8 +2627,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2817,7 +2637,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3080,8 +2900,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3102,10 +2920,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3124,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3146,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3168,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3190,8 +2992,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3200,7 +3002,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3267,8 +3069,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3276,7 +3076,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3287,10 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3298,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3309,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3320,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3331,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3342,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3353,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3364,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3375,8 +3159,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3385,7 +3169,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3648,8 +3432,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3670,10 +3452,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3692,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3714,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3736,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3758,8 +3524,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3768,7 +3534,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3835,8 +3601,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3844,7 +3608,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3855,10 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3866,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3877,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3888,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3899,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3910,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3921,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3932,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3943,8 +3691,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3953,7 +3701,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/resource_example/example_resource_gen.go b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/resource_example/example_resource_gen.go index bb5044df..29d12c9c 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/resource_example/example_resource_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/default_pkg_name/resource_example/example_resource_gen.go @@ -258,8 +258,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -280,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -302,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -324,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -346,10 +332,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -368,8 +350,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -378,7 +360,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -445,8 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -454,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -465,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -476,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -487,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -498,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -509,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -520,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -531,10 +499,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -542,7 +506,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -553,8 +517,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -563,7 +527,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -826,8 +790,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -848,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -870,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -892,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -914,10 +864,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -936,8 +882,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -946,7 +892,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1013,8 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1022,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1033,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1044,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1055,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1066,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1077,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1088,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1099,10 +1031,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1110,7 +1038,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1121,8 +1049,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1131,7 +1059,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1394,8 +1322,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1416,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1438,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1460,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1482,10 +1396,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1504,8 +1414,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1514,7 +1424,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1581,8 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1590,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1601,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1612,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1623,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1634,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1645,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1656,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1667,10 +1563,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1678,7 +1570,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1689,8 +1581,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1699,7 +1591,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1962,8 +1854,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1984,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2006,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2028,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2050,10 +1928,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2072,8 +1946,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2082,7 +1956,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2149,8 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2158,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2169,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2180,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2191,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2202,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2213,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2224,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2235,10 +2095,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2246,7 +2102,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2257,8 +2113,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2267,7 +2123,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2530,8 +2386,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2552,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2574,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2596,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2618,10 +2460,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2640,8 +2478,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2650,7 +2488,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2717,8 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2726,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2737,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2748,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2759,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2770,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2781,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2792,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2803,10 +2627,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2814,7 +2634,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2825,8 +2645,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2835,7 +2655,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3098,8 +2918,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3120,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3142,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3164,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3186,10 +2992,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3208,8 +3010,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3218,7 +3020,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3285,8 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3294,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3305,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3316,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3327,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3338,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3349,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3360,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3371,10 +3159,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3382,7 +3166,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3393,8 +3177,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3403,7 +3187,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3666,8 +3450,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3688,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3710,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3732,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3754,10 +3524,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3776,8 +3542,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3786,7 +3552,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3853,8 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3862,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3873,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3884,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3895,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3906,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3917,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3928,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3939,10 +3691,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3950,7 +3698,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3961,8 +3709,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3971,7 +3719,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_data_source_gen.go b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_data_source_gen.go index 61d5b8a3..ce2fbeb6 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_data_source_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_data_source_gen.go @@ -617,8 +617,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -639,10 +637,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -661,10 +655,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -683,10 +673,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -705,10 +691,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -727,8 +709,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -737,7 +719,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -804,8 +786,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -813,7 +793,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -824,10 +804,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -835,7 +811,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -846,10 +822,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -857,7 +829,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -868,10 +840,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -879,7 +847,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -890,10 +858,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -901,7 +865,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -912,8 +876,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -922,7 +886,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1185,8 +1149,6 @@ func (t ListNestedAttributeOneType) String() string { func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1207,13 +1169,13 @@ func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1280,8 +1242,6 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1289,7 +1249,7 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1300,13 +1260,13 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1501,8 +1461,6 @@ func (t ListNestedAttributeThreeType) String() string { func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] @@ -1523,13 +1481,13 @@ func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1596,8 +1554,6 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri return NewListNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] if !ok { @@ -1605,7 +1561,7 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `list_nested_attribute_three_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeThreeValueNull(), diags + return NewListNestedAttributeThreeValueUnknown(), diags } listNestedAttributeThreeListNestedAttributeOneVal, ok := listNestedAttributeThreeListNestedAttributeOne.(basetypes.ListValue) @@ -1616,13 +1572,13 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeValueUnknown(), diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1852,8 +1808,6 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) String() string { func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -1874,13 +1828,13 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1947,8 +1901,6 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -1956,7 +1908,7 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedAttributeThreeListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -1967,13 +1919,13 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2174,8 +2126,6 @@ func (t ListNestedAttributeTwoType) String() string { func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] @@ -2196,13 +2146,13 @@ func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2269,8 +2219,6 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] if !ok { @@ -2278,7 +2226,7 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `list_nested_attribute_two_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeTwoValueNull(), diags + return NewListNestedAttributeTwoValueUnknown(), diags } listNestedAttributeTwoListNestedAttributeOneVal, ok := listNestedAttributeTwoListNestedAttributeOne.(basetypes.ListValue) @@ -2289,13 +2237,13 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoValueUnknown(), diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2525,8 +2473,6 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) String() string { func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2547,13 +2493,13 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2620,8 +2566,6 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2629,7 +2573,7 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeTwoListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2640,13 +2584,13 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2841,8 +2785,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2863,10 +2805,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2885,10 +2823,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2907,10 +2841,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2929,10 +2859,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2951,8 +2877,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -2961,7 +2887,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3028,8 +2954,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3037,7 +2961,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3048,10 +2972,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3059,7 +2979,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3070,10 +2990,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3081,7 +2997,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3092,10 +3008,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3103,7 +3015,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3114,10 +3026,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3125,7 +3033,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3136,8 +3044,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -3146,7 +3054,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3409,8 +3317,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3431,10 +3337,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3453,10 +3355,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3475,10 +3373,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3497,10 +3391,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3519,8 +3409,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3529,7 +3419,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3596,8 +3486,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3605,7 +3493,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3616,10 +3504,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3627,7 +3511,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3638,10 +3522,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3649,7 +3529,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3660,10 +3540,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3671,7 +3547,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3682,10 +3558,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3693,7 +3565,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3704,8 +3576,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3714,7 +3586,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3977,8 +3849,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3999,10 +3869,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4021,10 +3887,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4043,10 +3905,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4065,10 +3923,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4087,8 +3941,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4097,7 +3951,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4164,8 +4018,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4173,7 +4025,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4184,10 +4036,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4195,7 +4043,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -4206,10 +4054,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4217,7 +4061,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -4228,10 +4072,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4239,7 +4079,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -4250,10 +4090,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4261,7 +4097,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -4272,8 +4108,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4282,7 +4118,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4545,8 +4381,6 @@ func (t SingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -4567,13 +4401,13 @@ func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4640,8 +4474,6 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4649,7 +4481,7 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4660,13 +4492,13 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4861,8 +4693,6 @@ func (t SingleNestedAttributeThreeType) String() string { func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] @@ -4883,13 +4713,13 @@ func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4956,8 +4786,6 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att return NewSingleNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] if !ok { @@ -4965,7 +4793,7 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `single_nested_attribute_three_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeThreeValueNull(), diags + return NewSingleNestedAttributeThreeValueUnknown(), diags } singleNestedAttributeThreeSingleNestedAttributeOneVal, ok := singleNestedAttributeThreeSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -4976,13 +4804,13 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeValueUnknown(), diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5204,8 +5032,6 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) String() string func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -5226,13 +5052,13 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject( fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5299,8 +5125,6 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -5308,7 +5132,7 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -5319,13 +5143,13 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5526,8 +5350,6 @@ func (t SingleNestedAttributeTwoType) String() string { func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] @@ -5548,13 +5370,13 @@ func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5621,8 +5443,6 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] if !ok { @@ -5630,7 +5450,7 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `single_nested_attribute_two_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeTwoValueNull(), diags + return NewSingleNestedAttributeTwoValueUnknown(), diags } singleNestedAttributeTwoSingleNestedAttributeOneVal, ok := singleNestedAttributeTwoSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -5641,13 +5461,13 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoValueUnknown(), diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5869,8 +5689,6 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -5891,13 +5709,13 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ct fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5964,8 +5782,6 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -5973,7 +5789,7 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -5984,13 +5800,13 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6185,8 +6001,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6207,10 +6021,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6229,10 +6039,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6251,10 +6057,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6273,10 +6075,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6295,8 +6093,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -6305,7 +6103,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6372,8 +6170,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6381,7 +6177,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6392,10 +6188,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6403,7 +6195,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -6414,10 +6206,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6425,7 +6213,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -6436,10 +6224,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6447,7 +6231,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -6458,10 +6242,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6469,7 +6249,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -6480,8 +6260,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -6490,7 +6270,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6753,8 +6533,6 @@ func (t ListNestedBlockOneType) String() string { func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6775,13 +6553,13 @@ func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6848,8 +6626,6 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6857,7 +6633,7 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockOneValueNull(), diags + return NewListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6868,13 +6644,13 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockOneValueUnknown(), diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7069,8 +6845,6 @@ func (t ListNestedBlockThreeType) String() string { func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] @@ -7091,10 +6865,6 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7113,14 +6883,14 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7187,8 +6957,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute return NewListNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] if !ok { @@ -7196,7 +6964,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `list_nested_block_three_list_nested_block_one is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } listNestedBlockThreeListNestedBlockOneVal, ok := listNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -7207,10 +6975,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7218,7 +6982,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `object_attribute is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -7229,14 +6993,14 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeValueUnknown(), diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7495,8 +7259,6 @@ func (t ListNestedBlockThreeListNestedBlockOneType) String() string { func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -7517,13 +7279,13 @@ func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context. fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7590,8 +7352,6 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -7599,7 +7359,7 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -7610,13 +7370,13 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7817,8 +7577,6 @@ func (t ListNestedBlockTwoType) String() string { func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] @@ -7839,13 +7597,13 @@ func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7912,8 +7670,6 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] if !ok { @@ -7921,7 +7677,7 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `list_nested_block_two_list_nested_block_one is missing from object`) - return NewListNestedBlockTwoValueNull(), diags + return NewListNestedBlockTwoValueUnknown(), diags } listNestedBlockTwoListNestedBlockOneVal, ok := listNestedBlockTwoListNestedBlockOne.(basetypes.ListValue) @@ -7932,13 +7688,13 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoValueUnknown(), diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8168,8 +7924,6 @@ func (t ListNestedBlockTwoListNestedBlockOneType) String() string { func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8190,13 +7944,13 @@ func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8263,8 +8017,6 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8272,7 +8024,7 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockTwoListNestedBlockOneValueNull(), diags + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8283,13 +8035,13 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8484,8 +8236,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8506,10 +8256,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8528,10 +8274,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8550,10 +8292,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8572,10 +8310,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8594,8 +8328,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -8604,7 +8338,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8671,8 +8405,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8680,7 +8412,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8691,10 +8423,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8702,7 +8430,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -8713,10 +8441,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8724,7 +8448,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -8735,10 +8459,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8746,7 +8466,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -8757,10 +8477,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8768,7 +8484,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -8779,8 +8495,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -8789,7 +8505,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9052,8 +8768,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9074,10 +8788,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9096,10 +8806,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9118,10 +8824,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9140,10 +8842,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9162,8 +8860,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9172,7 +8870,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9239,8 +8937,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9248,7 +8944,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9259,10 +8955,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9270,7 +8962,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -9281,10 +8973,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9292,7 +8980,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -9303,10 +8991,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9314,7 +8998,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -9325,10 +9009,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9336,7 +9016,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -9347,8 +9027,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9357,7 +9037,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9620,8 +9300,6 @@ func (t SingleNestedBlockOneType) String() string { func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9642,13 +9320,13 @@ func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9715,8 +9393,6 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9724,7 +9400,7 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9735,13 +9411,13 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9936,8 +9612,6 @@ func (t SingleNestedBlockThreeType) String() string { func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() objectAttribute, ok := attributes["object_attribute"] @@ -9958,10 +9632,6 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -9980,14 +9650,14 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10054,8 +9724,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu return NewSingleNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -10063,7 +9731,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `object_attribute is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -10074,10 +9742,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -10085,7 +9749,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `single_nested_block_three_list_nested_block_one is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } singleNestedBlockThreeListNestedBlockOneVal, ok := singleNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -10096,14 +9760,14 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeValueUnknown(), diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10362,8 +10026,6 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) String() string { func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -10384,13 +10046,13 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10457,8 +10119,6 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -10466,7 +10126,7 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -10477,13 +10137,13 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10684,8 +10344,6 @@ func (t SingleNestedBlockTwoType) String() string { func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] @@ -10706,13 +10364,13 @@ func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10779,8 +10437,6 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] if !ok { @@ -10788,7 +10444,7 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `single_nested_block_two_single_nested_block_one is missing from object`) - return NewSingleNestedBlockTwoValueNull(), diags + return NewSingleNestedBlockTwoValueUnknown(), diags } singleNestedBlockTwoSingleNestedBlockOneVal, ok := singleNestedBlockTwoSingleNestedBlockOne.(basetypes.ObjectValue) @@ -10799,13 +10455,13 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoValueUnknown(), diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11027,8 +10683,6 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) String() string { func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -11049,13 +10703,13 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11122,8 +10776,6 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -11131,7 +10783,7 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockTwoSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -11142,13 +10794,13 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_provider_gen.go b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_provider_gen.go index 8c30fd0e..117518e3 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_provider_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_provider_gen.go @@ -240,8 +240,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -262,10 +260,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -284,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -306,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -328,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -350,8 +332,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -360,7 +342,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -427,8 +409,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -436,7 +416,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -447,10 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -458,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -469,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -480,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -491,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -502,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -513,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -524,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -535,8 +499,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -545,7 +509,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -808,8 +772,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -830,10 +792,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -852,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -874,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -896,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -918,8 +864,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -928,7 +874,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -995,8 +941,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1004,7 +948,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1015,10 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1026,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1037,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1048,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1059,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1070,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1081,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1092,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1103,8 +1031,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1113,7 +1041,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1376,8 +1304,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1398,10 +1324,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1420,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1442,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1464,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1486,8 +1396,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1496,7 +1406,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1563,8 +1473,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1572,7 +1480,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1583,10 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1594,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1605,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1616,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1627,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1638,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1649,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1660,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1671,8 +1563,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1681,7 +1573,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1944,8 +1836,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1966,10 +1856,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1988,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2010,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2032,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2054,8 +1928,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2064,7 +1938,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2131,8 +2005,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2140,7 +2012,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2151,10 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2162,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2173,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2184,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2195,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2206,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2217,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2228,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2239,8 +2095,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2249,7 +2105,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2512,8 +2368,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2534,10 +2388,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2556,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2578,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2600,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2622,8 +2460,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2632,7 +2470,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2699,8 +2537,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2708,7 +2544,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2719,10 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2730,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2741,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2752,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2763,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2774,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2785,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2796,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2807,8 +2627,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2817,7 +2637,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3080,8 +2900,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3102,10 +2920,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3124,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3146,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3168,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3190,8 +2992,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3200,7 +3002,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3267,8 +3069,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3276,7 +3076,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3287,10 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3298,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3309,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3320,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3331,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3342,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3353,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3364,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3375,8 +3159,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3385,7 +3169,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3648,8 +3432,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3670,10 +3452,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3692,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3714,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3736,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3758,8 +3524,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3768,7 +3534,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3835,8 +3601,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3844,7 +3608,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3855,10 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3866,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3877,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3888,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3899,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3910,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3921,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3932,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3943,8 +3691,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3953,7 +3701,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_resource_gen.go b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_resource_gen.go index 7b1178b8..d785537c 100644 --- a/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_resource_gen.go +++ b/internal/cmd/testdata/custom_and_external/all_output/specified_pkg_name/example_resource_gen.go @@ -258,8 +258,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -280,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -302,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -324,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -346,10 +332,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -368,8 +350,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -378,7 +360,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -445,8 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -454,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -465,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -476,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -487,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -498,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -509,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -520,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -531,10 +499,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -542,7 +506,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -553,8 +517,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -563,7 +527,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -826,8 +790,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -848,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -870,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -892,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -914,10 +864,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -936,8 +882,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -946,7 +892,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1013,8 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1022,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1033,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1044,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1055,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1066,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1077,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1088,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1099,10 +1031,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1110,7 +1038,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1121,8 +1049,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1131,7 +1059,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1394,8 +1322,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1416,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1438,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1460,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1482,10 +1396,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1504,8 +1414,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1514,7 +1424,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1581,8 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1590,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1601,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1612,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1623,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1634,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1645,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1656,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1667,10 +1563,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1678,7 +1570,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1689,8 +1581,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1699,7 +1591,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1962,8 +1854,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1984,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2006,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2028,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2050,10 +1928,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2072,8 +1946,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2082,7 +1956,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2149,8 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2158,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2169,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2180,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2191,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2202,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2213,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2224,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2235,10 +2095,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2246,7 +2102,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2257,8 +2113,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2267,7 +2123,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2530,8 +2386,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2552,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2574,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2596,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2618,10 +2460,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2640,8 +2478,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2650,7 +2488,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2717,8 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2726,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2737,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2748,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2759,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2770,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2781,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2792,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2803,10 +2627,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2814,7 +2634,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2825,8 +2645,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2835,7 +2655,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3098,8 +2918,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3120,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3142,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3164,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3186,10 +2992,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3208,8 +3010,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3218,7 +3020,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3285,8 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3294,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3305,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3316,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3327,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3338,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3349,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3360,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3371,10 +3159,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3382,7 +3166,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3393,8 +3177,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3403,7 +3187,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3666,8 +3450,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3688,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3710,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3732,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3754,10 +3524,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3776,8 +3542,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3786,7 +3552,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3853,8 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3862,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3873,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3884,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3895,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3906,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3917,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3928,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3939,10 +3691,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3950,7 +3698,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3961,8 +3709,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3971,7 +3719,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/data_sources_output/example_data_source_gen.go b/internal/cmd/testdata/custom_and_external/data_sources_output/example_data_source_gen.go index 5cb497de..b46e0a96 100644 --- a/internal/cmd/testdata/custom_and_external/data_sources_output/example_data_source_gen.go +++ b/internal/cmd/testdata/custom_and_external/data_sources_output/example_data_source_gen.go @@ -617,8 +617,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -639,10 +637,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -661,10 +655,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -683,10 +673,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -705,10 +691,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -727,8 +709,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -737,7 +719,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -804,8 +786,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -813,7 +793,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -824,10 +804,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -835,7 +811,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -846,10 +822,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -857,7 +829,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -868,10 +840,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -879,7 +847,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -890,10 +858,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -901,7 +865,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -912,8 +876,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -922,7 +886,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1185,8 +1149,6 @@ func (t ListNestedAttributeOneType) String() string { func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1207,13 +1169,13 @@ func (t ListNestedAttributeOneType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1280,8 +1242,6 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1289,7 +1249,7 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1300,13 +1260,13 @@ func NewListNestedAttributeOneValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1501,8 +1461,6 @@ func (t ListNestedAttributeThreeType) String() string { func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] @@ -1523,13 +1481,13 @@ func (t ListNestedAttributeThreeType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1596,8 +1554,6 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri return NewListNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeThreeListNestedAttributeOne, ok := attributes["list_nested_attribute_three_list_nested_attribute_one"] if !ok { @@ -1605,7 +1561,7 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `list_nested_attribute_three_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeThreeValueNull(), diags + return NewListNestedAttributeThreeValueUnknown(), diags } listNestedAttributeThreeListNestedAttributeOneVal, ok := listNestedAttributeThreeListNestedAttributeOne.(basetypes.ListValue) @@ -1616,13 +1572,13 @@ func NewListNestedAttributeThreeValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`list_nested_attribute_three_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeThreeListNestedAttributeOne)) } - if listNestedAttributeThreeListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeValueUnknown(), diags } return ListNestedAttributeThreeValue{ ListNestedAttributeThreeListNestedAttributeOne: listNestedAttributeThreeListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1852,8 +1808,6 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) String() string { func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -1874,13 +1828,13 @@ func (t ListNestedAttributeThreeListNestedAttributeOneType) ValueFromObject(ctx fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1947,8 +1901,6 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -1956,7 +1908,7 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedAttributeThreeListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -1967,13 +1919,13 @@ func NewListNestedAttributeThreeListNestedAttributeOneValue(attributeTypes map[s fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeThreeListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeThreeListNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2174,8 +2126,6 @@ func (t ListNestedAttributeTwoType) String() string { func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] @@ -2196,13 +2146,13 @@ func (t ListNestedAttributeTwoType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2269,8 +2219,6 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu return NewListNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedAttributeTwoListNestedAttributeOne, ok := attributes["list_nested_attribute_two_list_nested_attribute_one"] if !ok { @@ -2278,7 +2226,7 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `list_nested_attribute_two_list_nested_attribute_one is missing from object`) - return NewListNestedAttributeTwoValueNull(), diags + return NewListNestedAttributeTwoValueUnknown(), diags } listNestedAttributeTwoListNestedAttributeOneVal, ok := listNestedAttributeTwoListNestedAttributeOne.(basetypes.ListValue) @@ -2289,13 +2237,13 @@ func NewListNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`list_nested_attribute_two_list_nested_attribute_one expected to be basetypes.ListValue, was: %T`, listNestedAttributeTwoListNestedAttributeOne)) } - if listNestedAttributeTwoListNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoValueUnknown(), diags } return ListNestedAttributeTwoValue{ ListNestedAttributeTwoListNestedAttributeOne: listNestedAttributeTwoListNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2525,8 +2473,6 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) String() string { func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2547,13 +2493,13 @@ func (t ListNestedAttributeTwoListNestedAttributeOneType) ValueFromObject(ctx co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2620,8 +2566,6 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2629,7 +2573,7 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeTwoListNestedAttributeOneValueNull(), diags + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2640,13 +2584,13 @@ func NewListNestedAttributeTwoListNestedAttributeOneValue(attributeTypes map[str fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeTwoListNestedAttributeOneValueUnknown(), diags } return ListNestedAttributeTwoListNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2841,8 +2785,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2863,10 +2805,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2885,10 +2823,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2907,10 +2841,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2929,10 +2859,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2951,8 +2877,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -2961,7 +2887,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3028,8 +2954,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3037,7 +2961,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3048,10 +2972,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3059,7 +2979,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3070,10 +2990,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3081,7 +2997,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3092,10 +3008,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3103,7 +3015,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3114,10 +3026,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3125,7 +3033,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3136,8 +3044,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -3146,7 +3054,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3409,8 +3317,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3431,10 +3337,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3453,10 +3355,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3475,10 +3373,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3497,10 +3391,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3519,8 +3409,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3529,7 +3419,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3596,8 +3486,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3605,7 +3493,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3616,10 +3504,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3627,7 +3511,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3638,10 +3522,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3649,7 +3529,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3660,10 +3540,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3671,7 +3547,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3682,10 +3558,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3693,7 +3565,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3704,8 +3576,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -3714,7 +3586,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3977,8 +3849,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3999,10 +3869,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4021,10 +3887,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4043,10 +3905,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4065,10 +3923,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4087,8 +3941,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4097,7 +3951,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4164,8 +4018,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4173,7 +4025,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4184,10 +4036,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -4195,7 +4043,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -4206,10 +4054,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -4217,7 +4061,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -4228,10 +4072,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -4239,7 +4079,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -4250,10 +4090,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -4261,7 +4097,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -4272,8 +4108,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -4282,7 +4118,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4545,8 +4381,6 @@ func (t SingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -4567,13 +4401,13 @@ func (t SingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4640,8 +4474,6 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -4649,7 +4481,7 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -4660,13 +4492,13 @@ func NewSingleNestedAttributeOneValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4861,8 +4693,6 @@ func (t SingleNestedAttributeThreeType) String() string { func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] @@ -4883,13 +4713,13 @@ func (t SingleNestedAttributeThreeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -4956,8 +4786,6 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att return NewSingleNestedAttributeThreeValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeThreeSingleNestedAttributeOne, ok := attributes["single_nested_attribute_three_single_nested_attribute_one"] if !ok { @@ -4965,7 +4793,7 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `single_nested_attribute_three_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeThreeValueNull(), diags + return NewSingleNestedAttributeThreeValueUnknown(), diags } singleNestedAttributeThreeSingleNestedAttributeOneVal, ok := singleNestedAttributeThreeSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -4976,13 +4804,13 @@ func NewSingleNestedAttributeThreeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`single_nested_attribute_three_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeThreeSingleNestedAttributeOne)) } - if singleNestedAttributeThreeSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeValueUnknown(), diags } return SingleNestedAttributeThreeValue{ SingleNestedAttributeThreeSingleNestedAttributeOne: singleNestedAttributeThreeSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5204,8 +5032,6 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) String() string func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -5226,13 +5052,13 @@ func (t SingleNestedAttributeThreeSingleNestedAttributeOneType) ValueFromObject( fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5299,8 +5125,6 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -5308,7 +5132,7 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -5319,13 +5143,13 @@ func NewSingleNestedAttributeThreeSingleNestedAttributeOneValue(attributeTypes m fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeThreeSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeThreeSingleNestedAttributeOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5526,8 +5350,6 @@ func (t SingleNestedAttributeTwoType) String() string { func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] @@ -5548,13 +5370,13 @@ func (t SingleNestedAttributeTwoType) ValueFromObject(ctx context.Context, in ba fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5621,8 +5443,6 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri return NewSingleNestedAttributeTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedAttributeTwoSingleNestedAttributeOne, ok := attributes["single_nested_attribute_two_single_nested_attribute_one"] if !ok { @@ -5630,7 +5450,7 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri "Attribute Missing", `single_nested_attribute_two_single_nested_attribute_one is missing from object`) - return NewSingleNestedAttributeTwoValueNull(), diags + return NewSingleNestedAttributeTwoValueUnknown(), diags } singleNestedAttributeTwoSingleNestedAttributeOneVal, ok := singleNestedAttributeTwoSingleNestedAttributeOne.(basetypes.ObjectValue) @@ -5641,13 +5461,13 @@ func NewSingleNestedAttributeTwoValue(attributeTypes map[string]attr.Type, attri fmt.Sprintf(`single_nested_attribute_two_single_nested_attribute_one expected to be basetypes.ObjectValue, was: %T`, singleNestedAttributeTwoSingleNestedAttributeOne)) } - if singleNestedAttributeTwoSingleNestedAttributeOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoValueUnknown(), diags } return SingleNestedAttributeTwoValue{ SingleNestedAttributeTwoSingleNestedAttributeOne: singleNestedAttributeTwoSingleNestedAttributeOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5869,8 +5689,6 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) String() string { func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -5891,13 +5709,13 @@ func (t SingleNestedAttributeTwoSingleNestedAttributeOneType) ValueFromObject(ct fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -5964,8 +5782,6 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -5973,7 +5789,7 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueNull(), diags + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -5984,13 +5800,13 @@ func NewSingleNestedAttributeTwoSingleNestedAttributeOneValue(attributeTypes map fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeTwoSingleNestedAttributeOneValueUnknown(), diags } return SingleNestedAttributeTwoSingleNestedAttributeOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6185,8 +6001,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6207,10 +6021,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6229,10 +6039,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6251,10 +6057,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6273,10 +6075,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6295,8 +6093,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -6305,7 +6103,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6372,8 +6170,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6381,7 +6177,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6392,10 +6188,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -6403,7 +6195,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -6414,10 +6206,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -6425,7 +6213,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -6436,10 +6224,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -6447,7 +6231,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -6458,10 +6242,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -6469,7 +6249,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -6480,8 +6260,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -6490,7 +6270,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6753,8 +6533,6 @@ func (t ListNestedBlockOneType) String() string { func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -6775,13 +6553,13 @@ func (t ListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -6848,8 +6626,6 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -6857,7 +6633,7 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockOneValueNull(), diags + return NewListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -6868,13 +6644,13 @@ func NewListNestedBlockOneValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockOneValueUnknown(), diags } return ListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7069,8 +6845,6 @@ func (t ListNestedBlockThreeType) String() string { func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] @@ -7091,10 +6865,6 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7113,14 +6883,14 @@ func (t ListNestedBlockThreeType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7187,8 +6957,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute return NewListNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockThreeListNestedBlockOne, ok := attributes["list_nested_block_three_list_nested_block_one"] if !ok { @@ -7196,7 +6964,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `list_nested_block_three_list_nested_block_one is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } listNestedBlockThreeListNestedBlockOneVal, ok := listNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -7207,10 +6975,6 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`list_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockThreeListNestedBlockOne)) } - if listNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown - } - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -7218,7 +6982,7 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `object_attribute is missing from object`) - return NewListNestedBlockThreeValueNull(), diags + return NewListNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -7229,14 +6993,14 @@ func NewListNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeValueUnknown(), diags } return ListNestedBlockThreeValue{ ListNestedBlockThreeListNestedBlockOne: listNestedBlockThreeListNestedBlockOneVal, ObjectAttribute: objectAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7495,8 +7259,6 @@ func (t ListNestedBlockThreeListNestedBlockOneType) String() string { func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -7517,13 +7279,13 @@ func (t ListNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context. fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7590,8 +7352,6 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -7599,7 +7359,7 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at "Attribute Missing", `list_attribute is missing from object`) - return NewListNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -7610,13 +7370,13 @@ func NewListNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string]at fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return ListNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7817,8 +7577,6 @@ func (t ListNestedBlockTwoType) String() string { func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] @@ -7839,13 +7597,13 @@ func (t ListNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetype fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -7912,8 +7670,6 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes return NewListNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - listNestedBlockTwoListNestedBlockOne, ok := attributes["list_nested_block_two_list_nested_block_one"] if !ok { @@ -7921,7 +7677,7 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes "Attribute Missing", `list_nested_block_two_list_nested_block_one is missing from object`) - return NewListNestedBlockTwoValueNull(), diags + return NewListNestedBlockTwoValueUnknown(), diags } listNestedBlockTwoListNestedBlockOneVal, ok := listNestedBlockTwoListNestedBlockOne.(basetypes.ListValue) @@ -7932,13 +7688,13 @@ func NewListNestedBlockTwoValue(attributeTypes map[string]attr.Type, attributes fmt.Sprintf(`list_nested_block_two_list_nested_block_one expected to be basetypes.ListValue, was: %T`, listNestedBlockTwoListNestedBlockOne)) } - if listNestedBlockTwoListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoValueUnknown(), diags } return ListNestedBlockTwoValue{ ListNestedBlockTwoListNestedBlockOne: listNestedBlockTwoListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8168,8 +7924,6 @@ func (t ListNestedBlockTwoListNestedBlockOneType) String() string { func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8190,13 +7944,13 @@ func (t ListNestedBlockTwoListNestedBlockOneType) ValueFromObject(ctx context.Co fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8263,8 +8017,6 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8272,7 +8024,7 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockTwoListNestedBlockOneValueNull(), diags + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8283,13 +8035,13 @@ func NewListNestedBlockTwoListNestedBlockOneValue(attributeTypes map[string]attr fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockTwoListNestedBlockOneValueUnknown(), diags } return ListNestedBlockTwoListNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8484,8 +8236,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -8506,10 +8256,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8528,10 +8274,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8550,10 +8292,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8572,10 +8310,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8594,8 +8328,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -8604,7 +8338,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -8671,8 +8405,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -8680,7 +8412,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -8691,10 +8423,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -8702,7 +8430,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -8713,10 +8441,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -8724,7 +8448,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -8735,10 +8459,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -8746,7 +8466,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -8757,10 +8477,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -8768,7 +8484,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -8779,8 +8495,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -8789,7 +8505,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9052,8 +8768,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9074,10 +8788,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9096,10 +8806,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9118,10 +8824,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9140,10 +8842,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9162,8 +8860,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9172,7 +8870,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9239,8 +8937,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9248,7 +8944,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9259,10 +8955,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -9270,7 +8962,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -9281,10 +8973,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -9292,7 +8980,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -9303,10 +8991,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -9314,7 +8998,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -9325,10 +9009,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -9336,7 +9016,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -9347,8 +9027,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -9357,7 +9037,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9620,8 +9300,6 @@ func (t SingleNestedBlockOneType) String() string { func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -9642,13 +9320,13 @@ func (t SingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9715,8 +9393,6 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -9724,7 +9400,7 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -9735,13 +9411,13 @@ func NewSingleNestedBlockOneValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -9936,8 +9612,6 @@ func (t SingleNestedBlockThreeType) String() string { func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() objectAttribute, ok := attributes["object_attribute"] @@ -9958,10 +9632,6 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -9980,14 +9650,14 @@ func (t SingleNestedBlockThreeType) ValueFromObject(ctx context.Context, in base fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10054,8 +9724,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu return NewSingleNestedBlockThreeValueUnknown(), diags } - state := attr.ValueStateKnown - objectAttribute, ok := attributes["object_attribute"] if !ok { @@ -10063,7 +9731,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `object_attribute is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } objectAttributeVal, ok := objectAttribute.(basetypes.ObjectValue) @@ -10074,10 +9742,6 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`object_attribute expected to be basetypes.ObjectValue, was: %T`, objectAttribute)) } - if objectAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - singleNestedBlockThreeListNestedBlockOne, ok := attributes["single_nested_block_three_list_nested_block_one"] if !ok { @@ -10085,7 +9749,7 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu "Attribute Missing", `single_nested_block_three_list_nested_block_one is missing from object`) - return NewSingleNestedBlockThreeValueNull(), diags + return NewSingleNestedBlockThreeValueUnknown(), diags } singleNestedBlockThreeListNestedBlockOneVal, ok := singleNestedBlockThreeListNestedBlockOne.(basetypes.ListValue) @@ -10096,14 +9760,14 @@ func NewSingleNestedBlockThreeValue(attributeTypes map[string]attr.Type, attribu fmt.Sprintf(`single_nested_block_three_list_nested_block_one expected to be basetypes.ListValue, was: %T`, singleNestedBlockThreeListNestedBlockOne)) } - if singleNestedBlockThreeListNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeValueUnknown(), diags } return SingleNestedBlockThreeValue{ ObjectAttribute: objectAttributeVal, SingleNestedBlockThreeListNestedBlockOne: singleNestedBlockThreeListNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10362,8 +10026,6 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) String() string { func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() listAttribute, ok := attributes["list_attribute"] @@ -10384,13 +10046,13 @@ func (t SingleNestedBlockThreeListNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10457,8 +10119,6 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - listAttribute, ok := attributes["list_attribute"] if !ok { @@ -10466,7 +10126,7 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `list_attribute is missing from object`) - return NewSingleNestedBlockThreeListNestedBlockOneValueNull(), diags + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } listAttributeVal, ok := listAttribute.(basetypes.ListValue) @@ -10477,13 +10137,13 @@ func NewSingleNestedBlockThreeListNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`list_attribute expected to be basetypes.ListValue, was: %T`, listAttribute)) } - if listAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockThreeListNestedBlockOneValueUnknown(), diags } return SingleNestedBlockThreeListNestedBlockOneValue{ ListAttribute: listAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10684,8 +10344,6 @@ func (t SingleNestedBlockTwoType) String() string { func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] @@ -10706,13 +10364,13 @@ func (t SingleNestedBlockTwoType) ValueFromObject(ctx context.Context, in basety fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -10779,8 +10437,6 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute return NewSingleNestedBlockTwoValueUnknown(), diags } - state := attr.ValueStateKnown - singleNestedBlockTwoSingleNestedBlockOne, ok := attributes["single_nested_block_two_single_nested_block_one"] if !ok { @@ -10788,7 +10444,7 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute "Attribute Missing", `single_nested_block_two_single_nested_block_one is missing from object`) - return NewSingleNestedBlockTwoValueNull(), diags + return NewSingleNestedBlockTwoValueUnknown(), diags } singleNestedBlockTwoSingleNestedBlockOneVal, ok := singleNestedBlockTwoSingleNestedBlockOne.(basetypes.ObjectValue) @@ -10799,13 +10455,13 @@ func NewSingleNestedBlockTwoValue(attributeTypes map[string]attr.Type, attribute fmt.Sprintf(`single_nested_block_two_single_nested_block_one expected to be basetypes.ObjectValue, was: %T`, singleNestedBlockTwoSingleNestedBlockOne)) } - if singleNestedBlockTwoSingleNestedBlockOneVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoValueUnknown(), diags } return SingleNestedBlockTwoValue{ SingleNestedBlockTwoSingleNestedBlockOne: singleNestedBlockTwoSingleNestedBlockOneVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11027,8 +10683,6 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) String() string { func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -11049,13 +10703,13 @@ func (t SingleNestedBlockTwoSingleNestedBlockOneType) ValueFromObject(ctx contex fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -11122,8 +10776,6 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -11131,7 +10783,7 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockTwoSingleNestedBlockOneValueNull(), diags + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -11142,13 +10794,13 @@ func NewSingleNestedBlockTwoSingleNestedBlockOneValue(attributeTypes map[string] fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockTwoSingleNestedBlockOneValueUnknown(), diags } return SingleNestedBlockTwoSingleNestedBlockOneValue{ BoolAttribute: boolAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/provider_output/example_provider_gen.go b/internal/cmd/testdata/custom_and_external/provider_output/example_provider_gen.go index a1dda087..4231e9b2 100644 --- a/internal/cmd/testdata/custom_and_external/provider_output/example_provider_gen.go +++ b/internal/cmd/testdata/custom_and_external/provider_output/example_provider_gen.go @@ -240,8 +240,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -262,10 +260,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -284,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -306,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -328,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -350,8 +332,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -360,7 +342,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -427,8 +409,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -436,7 +416,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -447,10 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -458,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -469,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -480,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -491,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -502,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -513,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -524,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -535,8 +499,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -545,7 +509,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -808,8 +772,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -830,10 +792,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -852,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -874,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -896,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -918,8 +864,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -928,7 +874,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -995,8 +941,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1004,7 +948,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1015,10 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1026,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1037,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1048,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1059,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1070,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1081,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1092,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1103,8 +1031,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1113,7 +1041,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1376,8 +1304,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1398,10 +1324,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1420,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1442,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1464,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1486,8 +1396,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1496,7 +1406,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1563,8 +1473,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1572,7 +1480,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1583,10 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1594,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1605,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1616,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1627,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1638,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1649,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1660,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1671,8 +1563,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1681,7 +1573,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1944,8 +1836,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1966,10 +1856,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1988,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2010,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2032,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2054,8 +1928,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2064,7 +1938,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2131,8 +2005,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2140,7 +2012,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2151,10 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2162,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2173,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2184,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2195,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2206,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2217,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2228,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2239,8 +2095,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2249,7 +2105,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2512,8 +2368,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2534,10 +2388,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2556,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2578,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2600,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2622,8 +2460,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2632,7 +2470,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2699,8 +2537,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2708,7 +2544,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2719,10 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2730,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2741,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2752,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2763,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2774,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2785,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2796,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2807,8 +2627,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2817,7 +2637,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3080,8 +2900,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3102,10 +2920,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3124,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3146,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3168,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3190,8 +2992,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3200,7 +3002,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3267,8 +3069,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3276,7 +3076,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3287,10 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3298,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3309,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3320,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3331,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3342,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3353,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3364,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3375,8 +3159,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3385,7 +3169,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3648,8 +3432,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3670,10 +3452,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3692,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3714,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3736,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3758,8 +3524,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3768,7 +3534,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3835,8 +3601,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3844,7 +3608,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3855,10 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3866,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3877,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3888,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3899,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3910,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3921,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3932,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3943,8 +3691,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3953,7 +3701,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/cmd/testdata/custom_and_external/resources_output/example_resource_gen.go b/internal/cmd/testdata/custom_and_external/resources_output/example_resource_gen.go index 1dce3371..78f094a2 100644 --- a/internal/cmd/testdata/custom_and_external/resources_output/example_resource_gen.go +++ b/internal/cmd/testdata/custom_and_external/resources_output/example_resource_gen.go @@ -258,8 +258,6 @@ func (t ListNestedAttributeAssocExtTypeType) String() string { func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -280,10 +278,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -302,10 +296,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -324,10 +314,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -346,10 +332,6 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -368,8 +350,8 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedAttributeAssocExtTypeValue{ @@ -378,7 +360,7 @@ func (t ListNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -445,8 +427,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -454,7 +434,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -465,10 +445,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -476,7 +452,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -487,10 +463,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -498,7 +470,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -509,10 +481,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -520,7 +488,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -531,10 +499,6 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -542,7 +506,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedAttributeAssocExtTypeValueNull(), diags + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -553,8 +517,8 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedAttributeAssocExtTypeValueUnknown(), diags } return ListNestedAttributeAssocExtTypeValue{ @@ -563,7 +527,7 @@ func NewListNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -826,8 +790,6 @@ func (t MapNestedAttributeAssocExtTypeType) String() string { func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -848,10 +810,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -870,10 +828,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -892,10 +846,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -914,10 +864,6 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -936,8 +882,8 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return MapNestedAttributeAssocExtTypeValue{ @@ -946,7 +892,7 @@ func (t MapNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1013,8 +959,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1022,7 +966,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1033,10 +977,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1044,7 +984,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1055,10 +995,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1066,7 +1002,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1077,10 +1013,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1088,7 +1020,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1099,10 +1031,6 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1110,7 +1038,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewMapNestedAttributeAssocExtTypeValueNull(), diags + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1121,8 +1049,8 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewMapNestedAttributeAssocExtTypeValueUnknown(), diags } return MapNestedAttributeAssocExtTypeValue{ @@ -1131,7 +1059,7 @@ func NewMapNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1394,8 +1322,6 @@ func (t SetNestedAttributeAssocExtTypeType) String() string { func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1416,10 +1342,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1438,10 +1360,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1460,10 +1378,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1482,10 +1396,6 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1504,8 +1414,8 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1514,7 +1424,7 @@ func (t SetNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1581,8 +1491,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -1590,7 +1498,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -1601,10 +1509,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -1612,7 +1516,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -1623,10 +1527,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -1634,7 +1534,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -1645,10 +1545,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -1656,7 +1552,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -1667,10 +1563,6 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -1678,7 +1570,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedAttributeAssocExtTypeValueNull(), diags + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -1689,8 +1581,8 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedAttributeAssocExtTypeValueUnknown(), diags } return SetNestedAttributeAssocExtTypeValue{ @@ -1699,7 +1591,7 @@ func NewSetNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -1962,8 +1854,6 @@ func (t SingleNestedAttributeAssocExtTypeType) String() string { func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -1984,10 +1874,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2006,10 +1892,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2028,10 +1910,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2050,10 +1928,6 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2072,8 +1946,8 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2082,7 +1956,7 @@ func (t SingleNestedAttributeAssocExtTypeType) ValueFromObject(ctx context.Conte Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2149,8 +2023,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2158,7 +2030,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2169,10 +2041,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2180,7 +2048,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2191,10 +2059,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2202,7 +2066,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2213,10 +2077,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2224,7 +2084,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2235,10 +2095,6 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2246,7 +2102,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedAttributeAssocExtTypeValueNull(), diags + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2257,8 +2113,8 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedAttributeAssocExtTypeValueUnknown(), diags } return SingleNestedAttributeAssocExtTypeValue{ @@ -2267,7 +2123,7 @@ func NewSingleNestedAttributeAssocExtTypeValue(attributeTypes map[string]attr.Ty Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2530,8 +2386,6 @@ func (t ListNestedBlockAssocExtTypeType) String() string { func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -2552,10 +2406,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2574,10 +2424,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2596,10 +2442,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2618,10 +2460,6 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2640,8 +2478,8 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return ListNestedBlockAssocExtTypeValue{ @@ -2650,7 +2488,7 @@ func (t ListNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -2717,8 +2555,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at return NewListNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -2726,7 +2562,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `bool_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -2737,10 +2573,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -2748,7 +2580,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `float64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -2759,10 +2591,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -2770,7 +2598,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `int64_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -2781,10 +2609,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -2792,7 +2616,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `number_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -2803,10 +2627,6 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -2814,7 +2634,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at "Attribute Missing", `string_attribute is missing from object`) - return NewListNestedBlockAssocExtTypeValueNull(), diags + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -2825,8 +2645,8 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewListNestedBlockAssocExtTypeValueUnknown(), diags } return ListNestedBlockAssocExtTypeValue{ @@ -2835,7 +2655,7 @@ func NewListNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, at Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3098,8 +2918,6 @@ func (t SetNestedBlockAssocExtTypeType) String() string { func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3120,10 +2938,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3142,10 +2956,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3164,10 +2974,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3186,10 +2992,6 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3208,8 +3010,8 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SetNestedBlockAssocExtTypeValue{ @@ -3218,7 +3020,7 @@ func (t SetNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3285,8 +3087,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3294,7 +3094,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `bool_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3305,10 +3105,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3316,7 +3112,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `float64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3327,10 +3123,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3338,7 +3130,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `int64_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3349,10 +3141,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3360,7 +3148,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `number_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3371,10 +3159,6 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3382,7 +3166,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att "Attribute Missing", `string_attribute is missing from object`) - return NewSetNestedBlockAssocExtTypeValueNull(), diags + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3393,8 +3177,8 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSetNestedBlockAssocExtTypeValueUnknown(), diags } return SetNestedBlockAssocExtTypeValue{ @@ -3403,7 +3187,7 @@ func NewSetNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, att Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3666,8 +3450,6 @@ func (t SingleNestedBlockAssocExtTypeType) String() string { func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics - state := attr.ValueStateKnown - attributes := in.Attributes() boolAttribute, ok := attributes["bool_attribute"] @@ -3688,10 +3470,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3710,10 +3488,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3732,10 +3506,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3754,10 +3524,6 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3776,8 +3542,8 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return nil, diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3786,7 +3552,7 @@ func (t SingleNestedBlockAssocExtTypeType) ValueFromObject(ctx context.Context, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } @@ -3853,8 +3619,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } - state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] if !ok { @@ -3862,7 +3626,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `bool_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -3873,10 +3637,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`bool_attribute expected to be basetypes.BoolValue, was: %T`, boolAttribute)) } - if boolAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - float64Attribute, ok := attributes["float64_attribute"] if !ok { @@ -3884,7 +3644,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `float64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } float64AttributeVal, ok := float64Attribute.(basetypes.Float64Value) @@ -3895,10 +3655,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`float64_attribute expected to be basetypes.Float64Value, was: %T`, float64Attribute)) } - if float64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - int64Attribute, ok := attributes["int64_attribute"] if !ok { @@ -3906,7 +3662,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `int64_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } int64AttributeVal, ok := int64Attribute.(basetypes.Int64Value) @@ -3917,10 +3673,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`int64_attribute expected to be basetypes.Int64Value, was: %T`, int64Attribute)) } - if int64AttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - numberAttribute, ok := attributes["number_attribute"] if !ok { @@ -3928,7 +3680,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `number_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } numberAttributeVal, ok := numberAttribute.(basetypes.NumberValue) @@ -3939,10 +3691,6 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`number_attribute expected to be basetypes.NumberValue, was: %T`, numberAttribute)) } - if numberAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown - } - stringAttribute, ok := attributes["string_attribute"] if !ok { @@ -3950,7 +3698,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, "Attribute Missing", `string_attribute is missing from object`) - return NewSingleNestedBlockAssocExtTypeValueNull(), diags + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } stringAttributeVal, ok := stringAttribute.(basetypes.StringValue) @@ -3961,8 +3709,8 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, fmt.Sprintf(`string_attribute expected to be basetypes.StringValue, was: %T`, stringAttribute)) } - if stringAttributeVal.IsUnknown() { - state = attr.ValueStateUnknown + if diags.HasError() { + return NewSingleNestedBlockAssocExtTypeValueUnknown(), diags } return SingleNestedBlockAssocExtTypeValue{ @@ -3971,7 +3719,7 @@ func NewSingleNestedBlockAssocExtTypeValue(attributeTypes map[string]attr.Type, Int64Attribute: int64AttributeVal, NumberAttribute: numberAttributeVal, StringAttribute: stringAttributeVal, - state: state, + state: attr.ValueStateKnown, }, diags } diff --git a/internal/schema/custom_object_test.go b/internal/schema/custom_object_test.go index 26a20506..77cf96d3 100644 --- a/internal/schema/custom_object_test.go +++ b/internal/schema/custom_object_test.go @@ -228,8 +228,6 @@ if diags.HasError() { return NewExampleValueUnknown(), diags } -state := attr.ValueStateKnown - boolAttribute, ok := attributes["bool_attribute"] @@ -238,7 +236,7 @@ diags.AddError( "Attribute Missing", ` + "`bool_attribute is missing from object`" + `) -return NewExampleValueNull(), diags +return NewExampleValueUnknown(), diags } boolAttributeVal, ok := boolAttribute.(basetypes.BoolValue) @@ -249,14 +247,14 @@ diags.AddError( fmt.Sprintf(` + "`bool_attribute expected to be basetypes.BoolValue, was: %T`" + `, boolAttribute)) } -if boolAttributeVal.IsUnknown() { -state = attr.ValueStateUnknown -} +if diags.HasError() { +return NewExampleValueUnknown(), diags +} return ExampleValue{ BoolAttribute: boolAttributeVal, -state: state, +state: attr.ValueStateKnown, }, diags }`), }, @@ -301,8 +299,6 @@ func TestCustomObjectType_renderValueFromObject(t *testing.T) { func (t ExampleType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics -state := attr.ValueStateKnown - attributes := in.Attributes() @@ -324,14 +320,14 @@ diags.AddError( fmt.Sprintf(` + "`bool_attribute expected to be basetypes.BoolValue, was: %T`" + `, boolAttribute)) } -if boolAttributeVal.IsUnknown() { -state = attr.ValueStateUnknown -} +if diags.HasError() { +return nil, diags +} return ExampleValue{ BoolAttribute: boolAttributeVal, -state: state, +state: attr.ValueStateKnown, }, diags }`), }, diff --git a/internal/schema/templates/object_type_value.gotmpl b/internal/schema/templates/object_type_value.gotmpl index b91def91..2cc738b3 100644 --- a/internal/schema/templates/object_type_value.gotmpl +++ b/internal/schema/templates/object_type_value.gotmpl @@ -50,8 +50,6 @@ if diags.HasError() { return New{{.Name}}ValueUnknown(), diags } -state := attr.ValueStateKnown - {{range $key, $value := .AttrValues }} {{$key.ToCamelCase}}, ok := attributes["{{$key}}"] @@ -60,7 +58,7 @@ diags.AddError( "Attribute Missing", `{{$key}} is missing from object`) -return New{{$.Name}}ValueNull(), diags +return New{{$.Name}}ValueUnknown(), diags } {{$key.ToCamelCase}}Val, ok := {{$key.ToCamelCase}}.({{$value}}) @@ -70,16 +68,16 @@ diags.AddError( "Attribute Wrong Type", fmt.Sprintf(`{{$key}} expected to be {{$value}}, was: %T`, {{$key.ToCamelCase}})) } +{{end}} -if {{$key.ToCamelCase}}Val.IsUnknown() { -state = attr.ValueStateUnknown +if diags.HasError() { +return New{{.Name}}ValueUnknown(), diags } -{{end}} return {{.Name}}Value{ {{- range $key, $value := .AttrValues }} {{$key.ToPascalCase}}: {{$key.ToCamelCase}}Val, {{- end}} -state: state, +state: attr.ValueStateKnown, }, diags } \ No newline at end of file diff --git a/internal/schema/templates/object_type_value_from_object.gotmpl b/internal/schema/templates/object_type_value_from_object.gotmpl index 929bafee..cc0d8914 100644 --- a/internal/schema/templates/object_type_value_from_object.gotmpl +++ b/internal/schema/templates/object_type_value_from_object.gotmpl @@ -2,8 +2,6 @@ func (t {{.Name}}Type) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { var diags diag.Diagnostics -state := attr.ValueStateKnown - attributes := in.Attributes() {{range $key, $value := .AttrValues }} @@ -24,16 +22,16 @@ diags.AddError( "Attribute Wrong Type", fmt.Sprintf(`{{$key}} expected to be {{$value}}, was: %T`, {{$key.ToCamelCase}})) } +{{end}} -if {{$key.ToCamelCase}}Val.IsUnknown() { -state = attr.ValueStateUnknown +if diags.HasError() { +return nil, diags } -{{end}} return {{.Name}}Value{ {{- range $key, $value := .AttrValues }} {{$key.ToPascalCase}}: {{$key.ToCamelCase}}Val, {{- end}} -state: state, +state: attr.ValueStateKnown, }, diags } \ No newline at end of file