diff --git a/internal/framework/flex/autoflex.go b/internal/framework/flex/autoflex.go index 1322c7504893..68df864f16b2 100644 --- a/internal/framework/flex/autoflex.go +++ b/internal/framework/flex/autoflex.go @@ -28,6 +28,7 @@ const ( type autoFlexer interface { convert(context.Context, path.Path, reflect.Value, path.Path, reflect.Value, fieldOpts) diag.Diagnostics getOptions() AutoFlexOptions + handleXMLWrapperCollapse(context.Context, path.Path, reflect.Value, path.Path, reflect.Value, reflect.Type, reflect.Type, map[string]bool) diag.Diagnostics } // autoFlexValues returns the underlying `reflect.Value`s of `from` and `to`. diff --git a/internal/framework/flex/autoflex_expand.go b/internal/framework/flex/autoflex_expand.go index 22d543d5499e..eb751790f740 100644 --- a/internal/framework/flex/autoflex_expand.go +++ b/internal/framework/flex/autoflex_expand.go @@ -8,6 +8,7 @@ import ( "fmt" "iter" "reflect" + "strings" "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" "github.com/hashicorp/terraform-plugin-framework/attr" @@ -19,6 +20,11 @@ import ( tfreflect "github.com/hashicorp/terraform-provider-aws/internal/reflect" ) +const ( + xmlWrapperFieldItems = "Items" + xmlWrapperFieldQuantity = "Quantity" +) + // Expand = TF --> AWS // Expander is implemented by types that customize their expansion @@ -629,7 +635,7 @@ func (expander autoExpander) listOrSetOfInt64(ctx context.Context, vFrom valueWi case reflect.Struct: // Check if target is an XML wrapper struct if fieldOpts.xmlWrapper && isXMLWrapperStruct(vTo.Type()) { - diags.Append(expander.xmlWrapper(ctx, vFrom, vTo, "Items")...) + diags.Append(expander.xmlWrapper(ctx, vFrom, vTo, xmlWrapperFieldItems)...) return diags } @@ -690,6 +696,21 @@ func (expander autoExpander) listOrSetOfInt64(ctx context.Context, vFrom valueWi return diags } } + + case reflect.Pointer: + switch tElem := vTo.Type().Elem(); tElem.Kind() { + case reflect.Struct: + // Check if target is a pointer to an XML wrapper struct + if isXMLWrapperStruct(tElem) { + // Create new instance of the XML wrapper struct + newStruct := reflect.New(tElem).Elem() + diags.Append(expander.xmlWrapper(ctx, vFrom, newStruct, xmlWrapperFieldItems)...) + if !diags.HasError() { + vTo.Set(newStruct.Addr()) + } + return diags + } + } } tflog.SubsystemError(ctx, subsystemName, "AutoFlex Expand; incompatible types", map[string]any{ @@ -708,7 +729,7 @@ func (expander autoExpander) listOrSetOfString(ctx context.Context, vFrom valueW case reflect.Struct: // Check if target is an XML wrapper struct if fieldOpts.xmlWrapper && isXMLWrapperStruct(vTo.Type()) { - diags.Append(expander.xmlWrapper(ctx, vFrom, vTo, "Items")...) + diags.Append(expander.xmlWrapper(ctx, vFrom, vTo, xmlWrapperFieldItems)...) return diags } @@ -755,6 +776,21 @@ func (expander autoExpander) listOrSetOfString(ctx context.Context, vFrom valueW return diags } } + + case reflect.Pointer: + switch tElem := vTo.Type().Elem(); tElem.Kind() { + case reflect.Struct: + // Check if target is a pointer to an XML wrapper struct + if isXMLWrapperStruct(tElem) { + // Create new instance of the XML wrapper struct + newStruct := reflect.New(tElem).Elem() + diags.Append(expander.xmlWrapper(ctx, vFrom, newStruct, xmlWrapperFieldItems)...) + if !diags.HasError() { + vTo.Set(newStruct.Addr()) + } + return diags + } + } } tflog.SubsystemError(ctx, subsystemName, "AutoFlex Expand; incompatible types", map[string]any{ @@ -765,6 +801,80 @@ func (expander autoExpander) listOrSetOfString(ctx context.Context, vFrom valueW return diags } +// listOrSetOfInt32 copies a Plugin Framework ListOfInt32(ish) or SetOfInt32(ish) value to a compatible AWS API value. +func (expander autoExpander) listOrSetOfInt32(ctx context.Context, vFrom valueWithElementsAs, vTo reflect.Value, fieldOpts fieldOpts) diag.Diagnostics { + var diags diag.Diagnostics + + switch vTo.Kind() { + case reflect.Struct: + // Check if target is an XML wrapper struct + if fieldOpts.xmlWrapper && isXMLWrapperStruct(vTo.Type()) { + diags.Append(expander.xmlWrapper(ctx, vFrom, vTo, xmlWrapperFieldItems)...) + return diags + } + + case reflect.Slice: + switch tSliceElem := vTo.Type().Elem(); tSliceElem.Kind() { + case reflect.Int32: + // + // types.Set(OfInt32) -> []int32 + // + tflog.SubsystemTrace(ctx, subsystemName, "Expanding with ElementsAs", map[string]any{ + logAttrKeySourceSize: len(vFrom.Elements()), + }) + var to []int32 + diags.Append(vFrom.ElementsAs(ctx, &to, false)...) + if diags.HasError() { + return diags + } + + vTo.Set(reflect.ValueOf(to)) + return diags + + case reflect.Pointer: + switch tSliceElem.Elem().Kind() { + case reflect.Int32: + // + // types.Set(OfInt32) -> []*int32 + // + tflog.SubsystemTrace(ctx, subsystemName, "Expanding with ElementsAs", map[string]any{ + logAttrKeySourceSize: len(vFrom.Elements()), + }) + var to []*int32 + diags.Append(vFrom.ElementsAs(ctx, &to, false)...) + if diags.HasError() { + return diags + } + + vTo.Set(reflect.ValueOf(to)) + return diags + } + } + + case reflect.Pointer: + switch tElem := vTo.Type().Elem(); tElem.Kind() { + case reflect.Struct: + // Check if target is a pointer to an XML wrapper struct + if isXMLWrapperStruct(tElem) { + // Create new instance of the XML wrapper struct + newStruct := reflect.New(tElem).Elem() + diags.Append(expander.xmlWrapper(ctx, vFrom, newStruct, xmlWrapperFieldItems)...) + if !diags.HasError() { + vTo.Set(newStruct.Addr()) + } + return diags + } + } + } + + tflog.SubsystemError(ctx, subsystemName, "AutoFlex Expand; incompatible types", map[string]any{ + "from": "Set[Int32]", + "to": vTo.Kind(), + }) + + return diags +} + // map_ copies a Plugin Framework Map(ish) value to a compatible AWS API value. func (expander autoExpander) map_(ctx context.Context, vFrom basetypes.MapValuable, vTo reflect.Value, _ fieldOpts) diag.Diagnostics { var diags diag.Diagnostics @@ -907,6 +1017,10 @@ func (expander autoExpander) set(ctx context.Context, sourcePath path.Path, vFro diags.Append(expander.listOrSetOfInt64(ctx, v, vTo, fieldOpts)...) return diags + case basetypes.Int32Typable: + diags.Append(expander.listOrSetOfInt32(ctx, v, vTo, fieldOpts)...) + return diags + case basetypes.StringTypable: diags.Append(expander.listOrSetOfString(ctx, v, vTo, fieldOpts)...) return diags @@ -1192,10 +1306,26 @@ func expandStruct(ctx context.Context, sourcePath path.Path, from any, targetPat typeFrom := valFrom.Type() typeTo := valTo.Type() + // Handle XML wrapper collapse patterns where multiple source fields + // need to be combined into a single complex target field + processedFields := make(map[string]bool) + diags.Append(flexer.handleXMLWrapperCollapse(ctx, sourcePath, valFrom, targetPath, valTo, typeFrom, typeTo, processedFields)...) + if diags.HasError() { + return diags + } + for fromField := range expandSourceFields(ctx, typeFrom, flexer.getOptions()) { fromFieldName := fromField.Name _, fromFieldOpts := autoflexTags(fromField) + // Skip fields that were already processed by XML wrapper collapse + if processedFields[fromFieldName] { + tflog.SubsystemTrace(ctx, subsystemName, "Skipping field already processed by XML wrapper collapse", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + }) + continue + } + toField, ok := (&fuzzyFieldFinder{}).findField(ctx, fromFieldName, typeFrom, typeTo, flexer) if !ok { // Corresponding field not found in to. @@ -1478,8 +1608,8 @@ func (expander autoExpander) xmlWrapper(ctx context.Context, vFrom valueWithElem } // Get the Items and Quantity fields - itemsField := vTo.FieldByName("Items") - quantityField := vTo.FieldByName("Quantity") + itemsField := vTo.FieldByName(xmlWrapperFieldItems) + quantityField := vTo.FieldByName(xmlWrapperFieldQuantity) if !itemsField.IsValid() || !quantityField.IsValid() { tflog.SubsystemError(ctx, subsystemName, "XML wrapper struct missing required fields") @@ -1502,7 +1632,20 @@ func (expander autoExpander) xmlWrapper(ctx context.Context, vFrom valueWithElem // Handle different element types switch elemTyped := elem.(type) { case basetypes.StringValuable: - if itemsSliceType.Elem().Kind() == reflect.String { + // Check if target is a pointer to the enum type and source is StringEnum + if itemsSliceType.Elem().Kind() == reflect.Pointer { + // Try to extract StringEnum value for pointer slice conversion + strVal, d := elemTyped.ToStringValue(ctx) + diags.Append(d...) + if !diags.HasError() && !strVal.IsNull() { + enumValue := strVal.ValueString() + + // Create a pointer to the enum type + enumPtr := reflect.New(itemsSliceType.Elem().Elem()) + enumPtr.Elem().SetString(enumValue) + itemValue.Set(enumPtr) + } + } else if itemsSliceType.Elem().Kind() == reflect.String { strVal, d := elemTyped.ToStringValue(ctx) diags.Append(d...) if !diags.HasError() { @@ -1572,13 +1715,13 @@ func isXMLWrapperStruct(t reflect.Type) bool { } // Check for Items field (slice) - itemsField, hasItems := t.FieldByName("Items") + itemsField, hasItems := t.FieldByName(xmlWrapperFieldItems) if !hasItems || itemsField.Type.Kind() != reflect.Slice { return false } // Check for Quantity field (pointer to int32) - quantityField, hasQuantity := t.FieldByName("Quantity") + quantityField, hasQuantity := t.FieldByName(xmlWrapperFieldQuantity) if !hasQuantity || quantityField.Type.Kind() != reflect.Pointer { return false } @@ -1588,19 +1731,26 @@ func isXMLWrapperStruct(t reflect.Type) bool { return false } - // Items and Quantity should be the only non-anonymous fields - nNonAnonymousFields := 0 - for i := 0; i < t.NumField(); i++ { - if !t.Field(i).Anonymous { - nNonAnonymousFields++ - } - } - - return nNonAnonymousFields == 2 + // Rule 1: Items and Quantity only (2 fields) + // Rule 2: Items, Quantity, and any additional fields (3+ fields) + // Both are valid XML wrappers + return true } // nestedObjectCollectionToXMLWrapper converts a NestedObjectCollectionValue to an XML wrapper struct -// that follows the pattern: {Items: []T, Quantity: *int32} +// +// XML Wrapper Compatibility Rules: +// Rule 1: Items/Quantity only - Direct collection mapping +// +// AWS: {Items: []T, Quantity: *int32} +// TF: Repeatable singular blocks (e.g., lambda_function_association { ... }) +// +// Rule 2: Items/Quantity + additional fields - Single plural block +// +// AWS: {Items: []T, Quantity: *int32, Enabled: *bool, ...} +// TF: Single plural block (e.g., trusted_signers { items = [...], enabled = true }) +// +// Supports both Rule 1 (Items/Quantity only) and Rule 2 (Items/Quantity + additional fields) func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Context, _ path.Path, vFrom fwtypes.NestedObjectCollectionValue, _ path.Path, vTo reflect.Value) diag.Diagnostics { var diags diag.Diagnostics @@ -1609,6 +1759,11 @@ func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Cont "target_type": vTo.Type().String(), }) + tflog.SubsystemTrace(ctx, subsystemName, "Expanding NestedObjectCollection to XML wrapper", map[string]any{ + "source_type": vFrom.Type(ctx).String(), + "target_type": vTo.Type().String(), + }) + // Get the nested Objects as a slice from, d := vFrom.ToObjectSlice(ctx) diags.Append(d...) @@ -1623,13 +1778,98 @@ func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Cont return diags } + // Check if this is Rule 2 pattern (single nested object with items + additional fields) + if fromSlice.Len() == 1 { + nestedObj := fromSlice.Index(0) + + // Handle pointer to struct (which is what NestedObjectCollection contains) + if nestedObj.Kind() == reflect.Ptr && !nestedObj.IsNil() { + structObj := nestedObj.Elem() + if structObj.Kind() == reflect.Struct { + // Check if the struct has an xmlWrapperFieldItems field - indicates Rule 2 + itemsField := structObj.FieldByName(xmlWrapperFieldItems) + if itemsField.IsValid() { + return expander.expandRule2XMLWrapper(ctx, nestedObj, vTo) + } + } + } + } + + // Rule 1: Direct collection to XML wrapper (existing logic) + return expander.expandRule1XMLWrapper(ctx, fromSlice, vTo) +} + +// expandRule2XMLWrapper handles Rule 2: single plural block with items + additional fields +func (expander autoExpander) expandRule2XMLWrapper(ctx context.Context, nestedObjPtr reflect.Value, vTo reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + tflog.SubsystemTrace(ctx, subsystemName, "Expanding Rule 2 XML wrapper (items + additional fields)") + + // Get target fields + itemsField := vTo.FieldByName(xmlWrapperFieldItems) + quantityField := vTo.FieldByName(xmlWrapperFieldQuantity) + + if !itemsField.IsValid() || !quantityField.IsValid() { + diags.Append(diagExpandingIncompatibleTypes(nestedObjPtr.Type(), vTo.Type())) + return diags + } + + // Get the struct from the pointer + nestedObj := nestedObjPtr.Elem() + + // Extract xmlWrapperFieldItems field from nested object + itemsSourceField := nestedObj.FieldByName(xmlWrapperFieldItems) + if !itemsSourceField.IsValid() { + diags.AddError("Missing items field", "Rule 2 XML wrapper requires 'Items' field") + return diags + } + + // Convert items collection to Items slice using existing logic + if itemsAttr, ok := itemsSourceField.Interface().(attr.Value); ok { + if collectionValue, ok := itemsAttr.(valueWithElementsAs); ok { + diags.Append(expander.convertCollectionToXMLWrapperFields(ctx, collectionValue, itemsField, quantityField)...) + if diags.HasError() { + return diags + } + } + } + + // Handle additional fields (e.g., Enabled, CachedMethods) + for i := 0; i < vTo.NumField(); i++ { + targetField := vTo.Field(i) + targetFieldType := vTo.Type().Field(i) + fieldName := targetFieldType.Name + + // Skip Items and Quantity (already handled) + if fieldName == xmlWrapperFieldItems || fieldName == xmlWrapperFieldQuantity { + continue + } + + // Look for matching field in nested object + sourceField := nestedObj.FieldByName(fieldName) + if sourceField.IsValid() && targetField.CanAddr() { + // Convert TF field to AWS field + if tfAttr, ok := sourceField.Interface().(attr.Value); ok { + diags.Append(autoExpandConvert(ctx, tfAttr, targetField.Addr().Interface(), expander)...) + } + } + } + + return diags +} + +// expandRule1XMLWrapper handles Rule 1: direct collection to XML wrapper (existing logic) +func (expander autoExpander) expandRule1XMLWrapper(ctx context.Context, fromSlice reflect.Value, vTo reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + tflog.SubsystemTrace(ctx, subsystemName, "Expanding Rule 1 XML wrapper (direct collection)") + // Get the Items and Quantity fields from target struct - itemsField := vTo.FieldByName("Items") - quantityField := vTo.FieldByName("Quantity") + itemsField := vTo.FieldByName(xmlWrapperFieldItems) + quantityField := vTo.FieldByName(xmlWrapperFieldQuantity) if !itemsField.IsValid() || !quantityField.IsValid() { - tflog.SubsystemError(ctx, subsystemName, "XML wrapper struct missing required fields") - diags.Append(diagExpandingIncompatibleTypes(reflect.TypeOf(vFrom), vTo.Type())) + diags.Append(diagExpandingIncompatibleTypes(fromSlice.Type(), vTo.Type())) return diags } @@ -1658,7 +1898,7 @@ func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Cont return diags } targetItem.Set(newItem) - } else { + } else if targetItemType.Kind() == reflect.Struct { // For []struct - need to set the value directly newItem := reflect.New(targetItemType) diags.Append(autoExpandConvert(ctx, sourceItem.Interface(), newItem.Interface(), expander)...) @@ -1666,6 +1906,12 @@ func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Cont return diags } targetItem.Set(newItem.Elem()) + } else { + // For primitive types ([]int32, []string, etc.) - direct conversion + diags.Append(autoExpandConvert(ctx, sourceItem.Interface(), targetItem.Addr().Interface(), expander)...) + if diags.HasError() { + return diags + } } } @@ -1682,9 +1928,456 @@ func (expander autoExpander) nestedObjectCollectionToXMLWrapper(ctx context.Cont quantityField.Set(quantityPtr) } - tflog.SubsystemTrace(ctx, subsystemName, "Successfully expanded NestedObjectCollection to XML wrapper", map[string]any{ - "items_count": itemsCount, + return diags +} + +// handleXMLWrapperCollapse handles the special case where multiple source fields +// need to be combined into a single complex target field containing XML wrapper structures. +// This handles patterns like: +// - Source: separate XMLWrappedEnumSlice and Other fields +// - Target: single XMLWrappedEnumSlice field containing XMLWrappedEnumSliceOther struct +// with Items/Quantity from main field and Other nested XML wrapper from other field +func (expander autoExpander) handleXMLWrapperCollapse(ctx context.Context, sourcePath path.Path, valFrom reflect.Value, targetPath path.Path, valTo reflect.Value, typeFrom, typeTo reflect.Type, processedFields map[string]bool) diag.Diagnostics { + var diags diag.Diagnostics + + // Look for target fields that are complex XML wrapper structures + for i := 0; i < typeTo.NumField(); i++ { + toField := typeTo.Field(i) + toFieldName := toField.Name + toFieldType := toField.Type + toFieldVal := valTo.Field(i) + + // Check if this is a pointer to a struct or direct struct + var targetStructType reflect.Type + if toFieldType.Kind() == reflect.Pointer && toFieldType.Elem().Kind() == reflect.Struct { + targetStructType = toFieldType.Elem() + } else if toFieldType.Kind() == reflect.Struct { + targetStructType = toFieldType + } else { + continue + } + + // Check if this target struct has the XML wrapper collapse pattern: + // - Contains Items/Quantity fields (making it an XML wrapper) + // - Contains additional fields that should come from other source fields + if !expander.isXMLWrapperCollapseTarget(targetStructType) { + continue + } + + tflog.SubsystemTrace(ctx, subsystemName, "Found XML wrapper collapse target", map[string]any{ + logAttrKeyTargetFieldname: toFieldName, + logAttrKeyTargetType: targetStructType.String(), + }) + + // Handle XML wrapper collapse patterns generically + diags.Append(expander.buildGenericXMLWrapperCollapse(ctx, sourcePath, valFrom, targetPath.AtName(toFieldName), toFieldVal, typeFrom, targetStructType, toFieldType.Kind() == reflect.Pointer, processedFields)...) + if diags.HasError() { + return diags + } + } + + return diags +} + +// isXMLWrapperCollapseTarget checks if a struct type represents a target that should be +// populated via XML wrapper collapse (multiple source fields -> single complex target) +func (expander autoExpander) isXMLWrapperCollapseTarget(structType reflect.Type) bool { + hasItems := false + hasQuantity := false + hasOtherFields := false + + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + fieldName := field.Name + + switch fieldName { + case xmlWrapperFieldItems: + hasItems = true + case xmlWrapperFieldQuantity: + hasQuantity = true + default: + // Any other field suggests this is a complex collapse target + hasOtherFields = true + } + } + + // Must have Items/Quantity (XML wrapper pattern) plus other fields + return hasItems && hasQuantity && hasOtherFields +} + +// convertCollectionToItemsQuantity converts a source collection to Items slice and Quantity fields +func (expander autoExpander) convertCollectionToItemsQuantity(ctx context.Context, sourcePath path.Path, sourceFieldVal reflect.Value, targetPath path.Path, itemsField, quantityField reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + sourceValue, ok := sourceFieldVal.Interface().(attr.Value) + if !ok { + tflog.SubsystemError(ctx, subsystemName, "Source field is not an attr.Value") + return diags + } + + // Convert based on source type + switch vFrom := sourceValue.(type) { + case basetypes.SetValuable, basetypes.ListValuable: + if setValue, ok := vFrom.(valueWithElementsAs); ok { + // Use existing logic to convert to Items/Quantity, but target specific fields + diags.Append(expander.convertCollectionToXMLWrapperFields(ctx, setValue, itemsField, quantityField)...) + } + default: + tflog.SubsystemError(ctx, subsystemName, "Unsupported source type for Items/Quantity conversion", map[string]any{ + "source_type": fmt.Sprintf("%T", vFrom), + }) + } + + return diags +} + +// convertCollectionToXMLWrapperFields converts a collection directly to Items and Quantity fields +func (expander autoExpander) convertCollectionToXMLWrapperFields(ctx context.Context, vFrom valueWithElementsAs, itemsField, quantityField reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + // Get the source elements + elements := vFrom.Elements() + itemsCount := len(elements) + + // Create the Items slice + if itemsField.CanSet() { + itemsType := itemsField.Type() + itemsSlice := reflect.MakeSlice(itemsType, itemsCount, itemsCount) + + // Convert each element - use the same logic as xmlWrapper + for i, elem := range elements { + itemValue := itemsSlice.Index(i) + if !itemValue.CanSet() { + continue + } + + // Handle different element types + switch elemTyped := elem.(type) { + case basetypes.StringValuable: + // Check if target is a pointer to the enum type and source is StringEnum + if itemsType.Elem().Kind() == reflect.Pointer { + // Try to extract StringEnum value for pointer slice conversion + strVal, d := elemTyped.ToStringValue(ctx) + diags.Append(d...) + if !diags.HasError() && !strVal.IsNull() { + enumValue := strVal.ValueString() + + // Create a pointer to the enum type + enumPtr := reflect.New(itemsType.Elem().Elem()) + enumPtr.Elem().SetString(enumValue) + itemValue.Set(enumPtr) + } + } else if itemsType.Elem().Kind() == reflect.String { + strVal, d := elemTyped.ToStringValue(ctx) + diags.Append(d...) + if !diags.HasError() { + itemValue.SetString(strVal.ValueString()) + } + } + case basetypes.Int64Valuable: + if elemKind := itemsType.Elem().Kind(); elemKind == reflect.Int32 { + int64Val, d := elemTyped.ToInt64Value(ctx) + diags.Append(d...) + if !diags.HasError() { + itemValue.SetInt(int64(int32(int64Val.ValueInt64()))) + } + } else if elemKind == reflect.Int64 { + int64Val, d := elemTyped.ToInt64Value(ctx) + diags.Append(d...) + if !diags.HasError() { + itemValue.SetInt(int64Val.ValueInt64()) + } + } + case basetypes.Int32Valuable: + if itemsType.Elem().Kind() == reflect.Int32 { + int32Val, d := elemTyped.ToInt32Value(ctx) + diags.Append(d...) + if !diags.HasError() { + itemValue.SetInt(int64(int32Val.ValueInt32())) + } + } + default: + // For complex types, try direct assignment if types are compatible + if elem != nil && !elem.IsNull() && !elem.IsUnknown() { + if itemValue.Type().AssignableTo(reflect.TypeOf(elem)) { + itemValue.Set(reflect.ValueOf(elem)) + } + } + } + } + + itemsField.Set(itemsSlice) + } + + // Set the Quantity field + if quantityField.CanSet() && quantityField.Type().Kind() == reflect.Pointer { + quantity := int32(itemsCount) + quantityPtr := reflect.New(quantityField.Type().Elem()) + quantityPtr.Elem().Set(reflect.ValueOf(quantity)) + quantityField.Set(quantityPtr) + } + + return diags +} + +// shouldConvertToXMLWrapper determines if a source field should be converted to XML wrapper format +func (expander autoExpander) shouldConvertToXMLWrapper(sourceFieldVal, targetFieldVal reflect.Value) bool { + // Check if source is a collection (Set/List) and target is XML wrapper struct + sourceValue, ok := sourceFieldVal.Interface().(attr.Value) + if !ok { + return false + } + + // Source should be a collection + switch sourceValue.(type) { + case basetypes.SetValuable, basetypes.ListValuable: + // Target should be a pointer to struct or struct with XML wrapper pattern + targetType := targetFieldVal.Type() + if targetType.Kind() == reflect.Pointer && targetType.Elem().Kind() == reflect.Struct { + return isXMLWrapperStruct(targetType.Elem()) + } + if targetType.Kind() == reflect.Struct { + return isXMLWrapperStruct(targetType) + } + } + + return false +} + +// convertToXMLWrapper converts a source collection to an XML wrapper structure +func (expander autoExpander) convertToXMLWrapper(ctx context.Context, sourcePath path.Path, sourceFieldVal reflect.Value, targetPath path.Path, targetFieldVal reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + sourceValue, ok := sourceFieldVal.Interface().(attr.Value) + if !ok { + tflog.SubsystemError(ctx, subsystemName, "Source field is not an attr.Value", map[string]any{ + "source_type": sourceFieldVal.Type().String(), + }) + return diags + } + + // Handle conversion based on source type + switch vFrom := sourceValue.(type) { + case basetypes.SetValuable: + if setValue, ok := vFrom.(valueWithElementsAs); ok { + diags.Append(expander.listOrSetOfString(ctx, setValue, targetFieldVal, fieldOpts{})...) + } + case basetypes.ListValuable: + if listValue, ok := vFrom.(valueWithElementsAs); ok { + diags.Append(expander.listOrSetOfString(ctx, listValue, targetFieldVal, fieldOpts{})...) + } + default: + tflog.SubsystemError(ctx, subsystemName, "Unsupported source type for XML wrapper conversion", map[string]any{ + "source_type": fmt.Sprintf("%T", vFrom), + }) + } + + return diags +} + +// buildGenericXMLWrapperCollapse handles any XML wrapper collapse pattern generically +func (expander autoExpander) buildGenericXMLWrapperCollapse(ctx context.Context, sourcePath path.Path, valFrom reflect.Value, targetPath path.Path, toFieldVal reflect.Value, typeFrom, targetStructType reflect.Type, isPointer bool, processedFields map[string]bool) diag.Diagnostics { + var diags diag.Diagnostics + + // Create the target struct + targetStruct := reflect.New(targetStructType) + targetStructVal := targetStruct.Elem() + + tflog.SubsystemTrace(ctx, subsystemName, "Building generic XML wrapper collapse struct", map[string]any{ + "target_type": targetStructType.String(), + }) + + // Check for null handling - if all source collection fields are null and target is pointer, set to nil + if isPointer { + allFieldsNull := true + hasCollectionFields := false + + for i := 0; i < typeFrom.NumField(); i++ { + sourceField := typeFrom.Field(i) + sourceFieldVal := valFrom.FieldByName(sourceField.Name) + + if sourceValue, ok := sourceFieldVal.Interface().(attr.Value); ok { + switch sourceValue.(type) { + case basetypes.SetValuable, basetypes.ListValuable: + hasCollectionFields = true + if !sourceValue.IsNull() { + allFieldsNull = false + break + } + } + } + } + + if hasCollectionFields && allFieldsNull { + // All collection fields are null and target is pointer - set to nil + toFieldVal.SetZero() + + // Mark all collection fields as processed + for i := 0; i < typeFrom.NumField(); i++ { + sourceField := typeFrom.Field(i) + sourceFieldVal := valFrom.FieldByName(sourceField.Name) + if sourceValue, ok := sourceFieldVal.Interface().(attr.Value); ok { + switch sourceValue.(type) { + case basetypes.SetValuable, basetypes.ListValuable: + processedFields[sourceField.Name] = true + } + } + } + + tflog.SubsystemTrace(ctx, subsystemName, "All source collection fields null - setting target to nil") + return diags + } + } + + // First, identify which source field should populate Items/Quantity + // This is typically the field that matches the target field name or the "main" collection + var mainSourceFieldName string + + // Try to find a source field that matches the target field name + targetFieldName := targetPath.String() + if lastDot := strings.LastIndex(targetFieldName, "."); lastDot >= 0 { + targetFieldName = targetFieldName[lastDot+1:] + } + + if _, found := typeFrom.FieldByName(targetFieldName); found { + mainSourceFieldName = targetFieldName + } + // Remove the fallback logic that incorrectly picks any collection field + // This was causing the wrong field data to be used for XML wrappers + + tflog.SubsystemTrace(ctx, subsystemName, "Identified main source field", map[string]any{ + "main_source_field": mainSourceFieldName, }) + // Process Items and Quantity from the main source field + hasMainSourceField := false + if mainSourceFieldName != "" { + sourceFieldVal := valFrom.FieldByName(mainSourceFieldName) + + // Check if source is a NestedObjectCollectionValue (Rule 2 pattern) + if sourceValue, ok := sourceFieldVal.Interface().(attr.Value); ok { + if !sourceValue.IsNull() && !sourceValue.IsUnknown() { + if nestedObjCollection, ok := sourceValue.(fwtypes.NestedObjectCollectionValue); ok { + // This is Rule 2: single nested object with items + additional fields + // Delegate to nestedObjectCollectionToXMLWrapper which handles Rule 2 + tflog.SubsystemTrace(ctx, subsystemName, "Detected Rule 2 pattern - delegating to nestedObjectCollectionToXMLWrapper") + diags.Append(expander.nestedObjectCollectionToXMLWrapper(ctx, sourcePath.AtName(mainSourceFieldName), nestedObjCollection, targetPath, targetStructVal)...) + if diags.HasError() { + return diags + } + processedFields[mainSourceFieldName] = true + + // Set the populated struct to the target field + if isPointer { + toFieldVal.Set(targetStruct) + } else { + toFieldVal.Set(targetStructVal) + } + return diags + } + } + } + + // Get the Items and Quantity fields in the target + itemsField := targetStructVal.FieldByName(xmlWrapperFieldItems) + quantityField := targetStructVal.FieldByName(xmlWrapperFieldQuantity) + + if itemsField.IsValid() && quantityField.IsValid() { + // Check if the source field is actually usable (not null/unknown) + if sourceValue, ok := sourceFieldVal.Interface().(attr.Value); ok { + if !sourceValue.IsNull() && !sourceValue.IsUnknown() { + // Convert the collection to Items slice and Quantity + diags.Append(expander.convertCollectionToItemsQuantity(ctx, sourcePath.AtName(mainSourceFieldName), sourceFieldVal, targetPath.AtName(xmlWrapperFieldItems), itemsField, quantityField)...) + if diags.HasError() { + return diags + } + hasMainSourceField = true + } else { + tflog.SubsystemDebug(ctx, subsystemName, "Main source field is null or unknown - skipping XML wrapper creation", map[string]any{ + "source_field": mainSourceFieldName, + "is_null": sourceValue.IsNull(), + "is_unknown": sourceValue.IsUnknown(), + }) + } + } + } + + // Mark main source field as processed + processedFields[mainSourceFieldName] = true + } + + // Track if we found any fields to populate + hasAnySourceFields := hasMainSourceField + + // Now process each remaining field in the target struct + for i := 0; i < targetStructType.NumField(); i++ { + targetField := targetStructType.Field(i) + targetFieldName := targetField.Name + targetFieldVal := targetStructVal.Field(i) + + // Skip Items and Quantity as they were handled above + if targetFieldName == xmlWrapperFieldItems || targetFieldName == xmlWrapperFieldQuantity { + continue + } + + if !targetFieldVal.CanSet() { + continue + } + + tflog.SubsystemTrace(ctx, subsystemName, "Processing additional target field", map[string]any{ + "target_field": targetFieldName, + "target_type": targetField.Type.String(), + }) + + // Look for a source field with the same name + if _, found := typeFrom.FieldByName(targetFieldName); found { + sourceFieldVal := valFrom.FieldByName(targetFieldName) + + tflog.SubsystemTrace(ctx, subsystemName, "Found matching source field", map[string]any{ + "source_field": targetFieldName, + "target_field": targetFieldName, + }) + + // Check if we need special XML wrapper conversion + if expander.shouldConvertToXMLWrapper(sourceFieldVal, targetFieldVal) { + // Convert collection to XML wrapper structure + diags.Append(expander.convertToXMLWrapper(ctx, sourcePath.AtName(targetFieldName), sourceFieldVal, targetPath.AtName(targetFieldName), targetFieldVal)...) + if diags.HasError() { + return diags + } + } else { + // Regular field conversion + opts := fieldOpts{} + diags.Append(expander.convert(ctx, sourcePath.AtName(targetFieldName), sourceFieldVal, targetPath.AtName(targetFieldName), targetFieldVal, opts)...) + if diags.HasError() { + return diags + } + } + + // Mark source field as processed and track that we found fields + processedFields[targetFieldName] = true + hasAnySourceFields = true + } else { + tflog.SubsystemDebug(ctx, subsystemName, "No source field found for target field", map[string]any{ + "target_field": targetFieldName, + }) + } + } + + // Only set the constructed struct if we found source fields to populate it + if hasAnySourceFields { + // Set the constructed struct into the target field + if isPointer { + toFieldVal.Set(targetStruct) + } else { + toFieldVal.Set(targetStruct.Elem()) + } + + tflog.SubsystemTrace(ctx, subsystemName, "Successfully built generic XML wrapper collapse struct") + } else { + tflog.SubsystemDebug(ctx, subsystemName, "No source fields found for XML wrapper collapse target - leaving as nil/zero value") + // Leave the field as nil/zero value (don't set anything) + } + return diags } diff --git a/internal/framework/flex/autoflex_flatten.go b/internal/framework/flex/autoflex_flatten.go index c7f6513bf48f..551b5945ff97 100644 --- a/internal/framework/flex/autoflex_flatten.go +++ b/internal/framework/flex/autoflex_flatten.go @@ -104,6 +104,109 @@ func autoFlattenConvert(ctx context.Context, from, to any, flexer autoFlexer) di return diags } + // Special case: XML wrapper struct to NestedObjectCollectionType (Rule 2) + // Check this BEFORE struct-to-struct conversion + if valFrom.IsValid() { + sourceType := valFrom.Type() + sourceVal := valFrom + + // Handle pointer to XML wrapper struct + if sourceType.Kind() == reflect.Pointer && !valFrom.IsNil() && isXMLWrapperStruct(sourceType.Elem()) { + sourceType = sourceType.Elem() + sourceVal = valFrom.Elem() + } + + tflog.SubsystemDebug(ctx, subsystemName, "Checking XML wrapper special case", map[string]any{ + "sourceType": sourceType.String(), + "sourceKind": sourceType.Kind().String(), + "isXMLWrapper": isXMLWrapperStruct(sourceType), + "toType": reflect.TypeOf(to).String(), + }) + + if sourceType.Kind() == reflect.Struct && isXMLWrapperStruct(sourceType) { + tflog.SubsystemDebug(ctx, subsystemName, "Source is XML wrapper, checking target", map[string]any{ + "toImplementsAttrValue": reflect.TypeOf(to).Implements(reflect.TypeFor[attr.Value]()), + }) + if attrVal, ok := to.(attr.Value); ok { + // Handle Rule 2: NestedObjectCollectionType target + if nestedObjType, ok := attrVal.Type(ctx).(fwtypes.NestedObjectCollectionType); ok { + // Check if wrapper is in empty state (Enabled=false, Items empty/nil) + // If so, return null instead of creating a block + enabledField := sourceVal.FieldByName("Enabled") + itemsField := sourceVal.FieldByName("Items") + + if enabledField.IsValid() && itemsField.IsValid() { + // Check if Enabled is false and Items is empty + isEnabled := true + if enabledField.Kind() == reflect.Pointer && !enabledField.IsNil() { + isEnabled = enabledField.Elem().Bool() + } + + itemsEmpty := itemsField.IsNil() || (itemsField.Kind() == reflect.Slice && itemsField.Len() == 0) + + if !isEnabled && itemsEmpty { + tflog.SubsystemTrace(ctx, subsystemName, "XML wrapper is empty (Enabled=false, Items empty), returning null") + nullVal, d := nestedObjType.NullValue(ctx) + diags.Append(d...) + if !diags.HasError() { + valTo.Set(reflect.ValueOf(nullVal)) + } + return diags + } + } + + tflog.SubsystemTrace(ctx, subsystemName, "Flattening XML wrapper to NestedObjectCollection via autoFlattenConvert") + + // Inline Rule 2 logic + nestedObjPtr, d := nestedObjType.NewObjectPtr(ctx) + diags.Append(d...) + if !diags.HasError() { + nestedObjValue := reflect.ValueOf(nestedObjPtr).Elem() + + // Map all fields except Quantity + for i := 0; i < sourceVal.NumField(); i++ { + sourceField := sourceVal.Field(i) + fieldName := sourceVal.Type().Field(i).Name + + if fieldName == "Quantity" { + continue + } + + if targetField := nestedObjValue.FieldByName(fieldName); targetField.IsValid() && targetField.CanAddr() { + if targetAttr, ok := targetField.Addr().Interface().(attr.Value); ok { + diags.Append(autoFlattenConvert(ctx, sourceField.Interface(), targetAttr, flexer)...) + } + } + } + + if !diags.HasError() { + ptrType := reflect.TypeOf(nestedObjPtr) + objectSlice := reflect.MakeSlice(reflect.SliceOf(ptrType), 1, 1) + objectSlice.Index(0).Set(reflect.ValueOf(nestedObjPtr)) + + targetValue, d := nestedObjType.ValueFromObjectSlice(ctx, objectSlice.Interface()) + diags.Append(d...) + if !diags.HasError() { + valTo.Set(reflect.ValueOf(targetValue)) + return diags + } + } + } + return diags + } + + // Handle Rule 1: Simple Set/List target (extract Items field) + itemsField := sourceVal.FieldByName("Items") + if itemsField.IsValid() { + tflog.SubsystemTrace(ctx, subsystemName, "Flattening XML wrapper Items to simple collection") + // Call convert on the Items field + diags.Append(flexer.convert(ctx, sourcePath, itemsField, targetPath, valTo, fieldOpts{})...) + return diags + } + } + } + } + // Top-level struct to struct conversion. if valFrom.IsValid() && valTo.IsValid() { if typFrom, typTo := valFrom.Type(), valTo.Type(); typFrom.Kind() == reflect.Struct && typTo.Kind() == reflect.Struct && @@ -835,6 +938,49 @@ func (flattener autoFlattener) slice(ctx context.Context, sourcePath path.Path, diags.Append(flattener.sliceOfStructToNestedObjectCollection(ctx, sourcePath, vFrom, targetPath, tTo, vTo, fieldOpts)...) return diags } + + default: + // Check for custom types with string underlying type (e.g., enums) + // For type declarations like "type MyEnum string", Kind() will not be reflect.String, + // but we can convert values to string using String() method + if tSliceElem.Kind() != reflect.String { + // Try to see if this is a string-based custom type by checking if we can call String() on it + sampleVal := reflect.New(tSliceElem).Elem() + if sampleVal.CanInterface() { + // Check if it has an underlying string type + if tSliceElem.ConvertibleTo(reflect.TypeOf("")) { + var elementType attr.Type = types.StringType + attrValueFromReflectValue := newStringValueFromReflectValue + if tTo, ok := tTo.(attr.TypeWithElementType); ok { + if tElem, ok := tTo.ElementType().(basetypes.StringTypable); ok { + // + // []stringy -> types.List/Set(OfStringEnum). + // + elementType = tElem + attrValueFromReflectValue = func(val reflect.Value) (attr.Value, diag.Diagnostics) { + return tElem.ValueFromString(ctx, types.StringValue(val.String())) + } + } + } + + switch tTo := tTo.(type) { + case basetypes.ListTypable: + // + // []custom_string_type -> types.List(OfString). + // + diags.Append(flattener.sliceOfPrimtiveToList(ctx, vFrom, tTo, vTo, elementType, attrValueFromReflectValue, fieldOpts)...) + return diags + + case basetypes.SetTypable: + // + // []custom_string_type -> types.Set(OfString). + // + diags.Append(flattener.sliceOfPrimitiveToSet(ctx, vFrom, tTo, vTo, elementType, attrValueFromReflectValue, fieldOpts)...) + return diags + } + } + } + } } tflog.SubsystemError(ctx, subsystemName, "AutoFlex Flatten; incompatible types", map[string]any{ @@ -1488,7 +1634,19 @@ func (flattener autoFlattener) sliceOfStructToNestedObjectCollection(ctx context } // xmlWrapperFlatten handles flattening from AWS XML wrapper structs to TF collection types -// that follow the pattern: {Items: []T, Quantity: *int32} -> []T +// +// XML Wrapper Compatibility Rules: +// Rule 1: Items/Quantity only - Direct collection mapping +// +// AWS: {Items: []T, Quantity: *int32} +// TF: Repeatable singular blocks (e.g., lambda_function_association { ... }) +// +// Rule 2: Items/Quantity + additional fields - Single plural block +// +// AWS: {Items: []T, Quantity: *int32, Enabled: *bool, ...} +// TF: Single plural block (e.g., trusted_signers { items = [...], enabled = true }) +// +// Supports both Rule 1 (Items/Quantity only) and Rule 2 (Items/Quantity + additional fields) func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom reflect.Value, tTo attr.Type, vTo reflect.Value, wrapperField string) diag.Diagnostics { var diags diag.Diagnostics @@ -1498,6 +1656,39 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl "wrapper_field": wrapperField, }) + // Check if target is a NestedObjectCollection (Rule 2 pattern) + // Rule 2: Target model has Items field (represents wrapper structure) + // Rule 1: Target model represents actual items directly + if nestedObjType, ok := tTo.(fwtypes.NestedObjectCollectionType); ok { + tflog.SubsystemTrace(ctx, subsystemName, "Target is NestedObjectCollectionType - checking for Rule 2", map[string]any{ + "target_type": tTo.String(), + }) + + // Create a sample object to check its structure + samplePtr, d := nestedObjType.NewObjectPtr(ctx) + diags.Append(d...) + if diags.HasError() { + tflog.SubsystemError(ctx, subsystemName, "Failed to create sample object for Rule 2 detection") + return diags + } + + // Check if the target model has an Items field (Rule 2 pattern) + sampleValue := reflect.ValueOf(samplePtr).Elem() + hasItems := sampleValue.FieldByName("Items").IsValid() + + tflog.SubsystemTrace(ctx, subsystemName, "Rule 2 detection result", map[string]any{ + "has_items_field": hasItems, + "sample_type": sampleValue.Type().String(), + }) + + if hasItems { + tflog.SubsystemTrace(ctx, subsystemName, "Using Rule 2 flatten") + return flattener.xmlWrapperFlattenRule2(ctx, vFrom, nestedObjType, vTo) + } + // Otherwise continue with Rule 1 logic below + } + + // Rule 1: Continue with existing logic // Verify source is a valid XML wrapper struct if !isXMLWrapperStruct(vFrom.Type()) { tflog.SubsystemError(ctx, subsystemName, "Source is not a valid XML wrapper struct", map[string]any{ @@ -1548,15 +1739,26 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl // Convert items slice to list elements itemsLen := itemsField.Len() - elements := make([]attr.Value, itemsLen) + + // Filter out nil pointers first and collect valid items + validItems := make([]reflect.Value, 0, itemsLen) + for i := range itemsLen { + item := itemsField.Index(i) + // Skip nil pointers + if item.Kind() == reflect.Pointer && item.IsNil() { + continue + } + validItems = append(validItems, item) + } + + elements := make([]attr.Value, len(validItems)) tflog.SubsystemTrace(ctx, subsystemName, "Converting items to list elements", map[string]any{ "items_count": itemsLen, + "valid_count": len(validItems), }) - for i := range itemsLen { - item := itemsField.Index(i) - + for i, item := range validItems { tflog.SubsystemTrace(ctx, subsystemName, "Processing item", map[string]any{ "index": i, "item_kind": item.Kind().String(), @@ -1568,12 +1770,59 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl case reflect.Int32: elements[i] = types.Int64Value(item.Int()) case reflect.String: - elements[i] = types.StringValue(item.String()) + // Try to create a value that matches the target element type + if val, d := flattener.createTargetValue(ctx, types.StringValue(item.String()), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + case reflect.Pointer: + // Handle pointer types like *testEnum (pointer to enum) + // (nil pointers are already filtered out) + // Dereference the pointer and get the underlying value + derefItem := item.Elem() + + // Handle the dereferenced value based on its type + switch derefItem.Kind() { + case reflect.String: + // Handle *string or *testEnum (where testEnum is a string type) + stringVal := derefItem.String() + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + default: + // Check if the dereferenced type is convertible to string (like custom enums) + if derefItem.Type().ConvertibleTo(reflect.TypeOf("")) { + stringVal := derefItem.Convert(reflect.TypeOf("")).String() + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + } else { + diags.Append(DiagFlatteningIncompatibleTypes(derefItem.Type(), reflect.TypeOf(elementType))) + return diags + } + } default: - // For complex types, handle struct conversion if needed - if item.Kind() == reflect.Struct { - // This would need to be handled by a nested object conversion - // For now, we'll return an error for unsupported types + // Check for custom string types (like enums) + if item.Type().ConvertibleTo(reflect.TypeOf("")) { + // Convert custom string type (like testEnum/Method) to string + stringVal := item.Convert(reflect.TypeOf("")).String() + + // Try to create a value that matches the target element type + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + } else { diags.Append(DiagFlatteningIncompatibleTypes(item.Type(), reflect.TypeOf(elementType))) return diags } @@ -1622,15 +1871,26 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl // Convert items slice to set elements itemsLen := itemsField.Len() - elements := make([]attr.Value, itemsLen) + + // Filter out nil pointers first and collect valid items + validItems := make([]reflect.Value, 0, itemsLen) + for i := range itemsLen { + item := itemsField.Index(i) + // Skip nil pointers + if item.Kind() == reflect.Pointer && item.IsNil() { + continue + } + validItems = append(validItems, item) + } + + elements := make([]attr.Value, len(validItems)) tflog.SubsystemTrace(ctx, subsystemName, "Converting items to set elements", map[string]any{ "items_count": itemsLen, + "valid_count": len(validItems), }) - for i := range itemsLen { - item := itemsField.Index(i) - + for i, item := range validItems { tflog.SubsystemTrace(ctx, subsystemName, "Processing item", map[string]any{ "index": i, "item_kind": item.Kind().String(), @@ -1642,7 +1902,45 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl case reflect.Int32: elements[i] = types.Int64Value(item.Int()) case reflect.String: - elements[i] = types.StringValue(item.String()) + // Try to create a value that matches the target element type + if val, d := flattener.createTargetValue(ctx, types.StringValue(item.String()), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + case reflect.Pointer: + // Handle pointer types like *testEnum (pointer to enum) + // (nil pointers are already filtered out) + // Dereference the pointer and get the underlying value + derefItem := item.Elem() + + // Handle the dereferenced value based on its type + switch derefItem.Kind() { + case reflect.String: + // Handle *string or *testEnum (where testEnum is a string type) + stringVal := derefItem.String() + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + default: + // Check if the dereferenced type is convertible to string (like custom enums) + if derefItem.Type().ConvertibleTo(reflect.TypeOf("")) { + stringVal := derefItem.Convert(reflect.TypeOf("")).String() + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + } else { + diags.Append(DiagFlatteningIncompatibleTypes(derefItem.Type(), reflect.TypeOf(elementType))) + return diags + } + } case reflect.Struct: // Handle complex struct types by converting to the target element type if elemTyper, ok := tTo.(attr.TypeWithElementType); ok && elemTyper.ElementType() != nil { @@ -1669,9 +1967,23 @@ func (flattener autoFlattener) xmlWrapperFlatten(ctx context.Context, vFrom refl return diags } default: - // For other complex types, handle conversion if needed - diags.Append(DiagFlatteningIncompatibleTypes(item.Type(), reflect.TypeOf(elementType))) - return diags + // Check for custom string types (like enums) + if item.Type().ConvertibleTo(reflect.TypeOf("")) { + // Convert custom string type (like testEnum/Method) to string + stringVal := item.Convert(reflect.TypeOf("")).String() + + // Try to create a value that matches the target element type + if val, d := flattener.createTargetValue(ctx, types.StringValue(stringVal), elementType); d.HasError() { + diags.Append(d...) + return diags + } else { + elements[i] = val + } + } else { + // For other complex types, handle conversion if needed + diags.Append(DiagFlatteningIncompatibleTypes(item.Type(), reflect.TypeOf(elementType))) + return diags + } } } @@ -1725,9 +2037,114 @@ func flattenStruct(ctx context.Context, sourcePath path.Path, from any, targetPa typeFrom := valFrom.Type() typeTo := valTo.Type() - // Special handling: Check if the entire source struct is an XML wrapper - // and should be flattened to a target field with wrapper tag + // Special case: If source is an XML wrapper and target is a NestedObjectCollectionType, + // handle it directly without needing xmlWrapperFlatten if isXMLWrapperStruct(typeFrom) { + tflog.SubsystemTrace(ctx, subsystemName, "Source is XML wrapper struct", map[string]any{ + logAttrKeySourceType: typeFrom.String(), + logAttrKeyTargetType: typeTo.String(), + }) + + if attrVal, ok := to.(attr.Value); ok { + tflog.SubsystemTrace(ctx, subsystemName, "Target implements attr.Value", map[string]any{ + "target_type": attrVal.Type(ctx).String(), + }) + + if nestedObjType, ok := attrVal.Type(ctx).(fwtypes.NestedObjectCollectionType); ok { + tflog.SubsystemTrace(ctx, subsystemName, "Target is NestedObjectCollectionType", map[string]any{ + "target_type": nestedObjType.String(), + }) + + // Check if wrapper is in empty state (Enabled=false, Items empty/nil) + // If so, return null instead of creating a block + enabledField := valFrom.FieldByName("Enabled") + itemsField := valFrom.FieldByName("Items") + + if enabledField.IsValid() && itemsField.IsValid() { + // Check if Enabled is false and Items is empty + isEnabled := true + if enabledField.Kind() == reflect.Pointer && !enabledField.IsNil() { + isEnabled = enabledField.Elem().Bool() + } + + itemsEmpty := itemsField.IsNil() || (itemsField.Kind() == reflect.Slice && itemsField.Len() == 0) + + if !isEnabled && itemsEmpty { + tflog.SubsystemTrace(ctx, subsystemName, "XML wrapper is empty (Enabled=false, Items empty), returning null for Rule 2") + nullVal, d := nestedObjType.NullValue(ctx) + diags.Append(d...) + if !diags.HasError() { + valTo.Set(reflect.ValueOf(nullVal)) + } + return diags + } + } + + // Check if target model has Items field (Rule 2) + samplePtr, d := nestedObjType.NewObjectPtr(ctx) + diags.Append(d...) + if !diags.HasError() { + sampleValue := reflect.ValueOf(samplePtr).Elem() + if sampleValue.FieldByName("Items").IsValid() { + // Rule 2: Create single-element collection with nested object containing Items + other fields + tflog.SubsystemTrace(ctx, subsystemName, "Flattening XML wrapper to NestedObjectCollection (Rule 2)", map[string]any{ + logAttrKeySourceType: typeFrom.String(), + logAttrKeyTargetType: typeTo.String(), + }) + + // Map source fields to target nested object fields + for i := 0; i < typeFrom.NumField(); i++ { + sourceField := typeFrom.Field(i) + sourceFieldName := sourceField.Name + sourceFieldVal := valFrom.Field(i) + + if sourceFieldName == "Quantity" { + continue // Skip Quantity + } + + targetField := sampleValue.FieldByName(sourceFieldName) + if targetField.IsValid() && targetField.CanAddr() { + if targetAttr, ok := targetField.Addr().Interface().(attr.Value); ok { + diags.Append(autoFlattenConvert(ctx, sourceFieldVal.Interface(), targetAttr, flexer)...) + } + } + } + + if !diags.HasError() { + // Create single-element collection + ptrType := reflect.TypeOf(samplePtr) + objectSlice := reflect.MakeSlice(reflect.SliceOf(ptrType), 1, 1) + objectSlice.Index(0).Set(reflect.ValueOf(samplePtr)) + + targetValue, d := nestedObjType.ValueFromObjectSlice(ctx, objectSlice.Interface()) + diags.Append(d...) + if !diags.HasError() { + valTo.Set(reflect.ValueOf(targetValue)) + return diags + } + } + } + } + } + + // Try other collection types if we have autoFlattener + if f, ok := flexer.(*autoFlattener); ok { + switch attrVal.Type(ctx).(type) { + case basetypes.SetTypable, basetypes.ListTypable: + tflog.SubsystemTrace(ctx, subsystemName, "Flattening XML wrapper directly to collection", map[string]any{ + logAttrKeySourceType: typeFrom.String(), + logAttrKeyTargetType: typeTo.String(), + }) + return f.xmlWrapperFlatten(ctx, valFrom, attrVal.Type(ctx), valTo, "Items") + } + } + } + } + + // Special handling: Check if the entire source struct is an XML wrapper + // and should be flattened to a target field with wrapper tag (Rule 1 only) + // Skip this if target is a struct - that's Rule 2 where we map fields individually + if isXMLWrapperStruct(typeFrom) && typeTo.Kind() != reflect.Struct { for toField := range tfreflect.ExportedStructFields(typeTo) { toFieldName := toField.Name _, toOpts := autoflexTags(toField) @@ -1737,7 +2154,7 @@ func flattenStruct(ctx context.Context, sourcePath path.Path, from any, targetPa continue } - tflog.SubsystemTrace(ctx, subsystemName, "Converting entire XML wrapper struct to collection field", map[string]any{ + tflog.SubsystemTrace(ctx, subsystemName, "Converting entire XML wrapper struct to collection field (Rule 1)", map[string]any{ logAttrKeySourceType: typeFrom.String(), logAttrKeyTargetFieldname: toFieldName, "wrapper_field": wrapperField, @@ -1764,9 +2181,25 @@ func flattenStruct(ctx context.Context, sourcePath path.Path, from any, targetPa } } + // Handle XML wrapper split patterns where complex source fields + // need to be split into multiple target collection fields + processedFields := make(map[string]bool) + diags.Append(flexer.handleXMLWrapperCollapse(ctx, sourcePath, valFrom, targetPath, valTo, typeFrom, typeTo, processedFields)...) + if diags.HasError() { + return diags + } + for fromField := range flattenSourceFields(ctx, typeFrom, flexer.getOptions()) { fromFieldName := fromField.Name + // Skip fields that were already processed by XML wrapper split + if processedFields[fromFieldName] { + tflog.SubsystemTrace(ctx, subsystemName, "Skipping field already processed by XML wrapper split", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + }) + continue + } + toField, ok := (&fuzzyFieldFinder{}).findField(ctx, fromFieldName, typeFrom, typeTo, flexer) if !ok { // Corresponding field not found in to. @@ -1809,6 +2242,8 @@ func flattenStruct(ctx context.Context, sourcePath path.Path, from any, targetPa // Check if target has wrapper tag and source is an XML wrapper struct if wrapperField := toFieldOpts.XMLWrapperField(); wrapperField != "" { fromFieldVal := valFrom.FieldByIndex(fromField.Index) + + // Handle direct XML wrapper struct if isXMLWrapperStruct(fromFieldVal.Type()) { tflog.SubsystemTrace(ctx, subsystemName, "Converting XML wrapper struct to collection", map[string]any{ logAttrKeySourceFieldname: fromFieldName, @@ -1833,6 +2268,224 @@ func flattenStruct(ctx context.Context, sourcePath path.Path, from any, targetPa } continue } + + // Handle pointer to XML wrapper struct + if fromFieldVal.Kind() == reflect.Pointer && !fromFieldVal.IsNil() && isXMLWrapperStruct(fromFieldVal.Type().Elem()) { + tflog.SubsystemTrace(ctx, subsystemName, "Converting pointer to XML wrapper struct to collection via wrapper tag", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + "wrapper_field": wrapperField, + "flexer_type": fmt.Sprintf("%T", flexer), + }) + + valTo, ok := toFieldVal.Interface().(attr.Value) + if !ok { + tflog.SubsystemError(ctx, subsystemName, "Target field does not implement attr.Value") + diags.Append(diagFlatteningTargetDoesNotImplementAttrValue(reflect.TypeOf(toFieldVal.Interface()))) + break + } + + // Try both value and pointer type assertions + if f, ok := flexer.(autoFlattener); ok { + diags.Append(f.xmlWrapperFlatten(ctx, fromFieldVal.Elem(), valTo.Type(ctx), toFieldVal, wrapperField)...) + } else if f, ok := flexer.(*autoFlattener); ok { + diags.Append(f.xmlWrapperFlatten(ctx, fromFieldVal.Elem(), valTo.Type(ctx), toFieldVal, wrapperField)...) + } else { + tflog.SubsystemError(ctx, subsystemName, "Type assertion to autoFlattener failed for wrapper tag", map[string]any{ + "flexer_type": fmt.Sprintf("%T", flexer), + }) + diags.Append(DiagFlatteningIncompatibleTypes(fromFieldVal.Type(), reflect.TypeOf(toFieldVal.Interface()))) + } + if diags.HasError() { + break + } + continue + } + + // Handle nil pointer to XML wrapper struct + if fromFieldVal.Kind() == reflect.Pointer && fromFieldVal.IsNil() && isXMLWrapperStruct(fromFieldVal.Type().Elem()) { + tflog.SubsystemTrace(ctx, subsystemName, "Converting nil pointer to XML wrapper struct to null collection", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + "wrapper_field": wrapperField, + }) + + valTo, ok := toFieldVal.Interface().(attr.Value) + if !ok { + tflog.SubsystemError(ctx, subsystemName, "Target field does not implement attr.Value") + diags.Append(diagFlatteningTargetDoesNotImplementAttrValue(reflect.TypeOf(toFieldVal.Interface()))) + break + } + + // For nil XML wrapper pointers, set target to null collection + switch tTo := valTo.Type(ctx).(type) { + case basetypes.ListTypable: + var elementType attr.Type = types.StringType // default + if tToWithElem, ok := tTo.(attr.TypeWithElementType); ok { + elementType = tToWithElem.ElementType() + } + nullList, d := tTo.ValueFromList(ctx, types.ListNull(elementType)) + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullList)) + } + case basetypes.SetTypable: + var elementType attr.Type = types.StringType // default + if tToWithElem, ok := tTo.(attr.TypeWithElementType); ok { + elementType = tToWithElem.ElementType() + } + nullSet, d := tTo.ValueFromSet(ctx, types.SetNull(elementType)) + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullSet)) + } + default: + diags.Append(DiagFlatteningIncompatibleTypes(fromFieldVal.Type(), reflect.TypeOf(toFieldVal.Interface()))) + } + if diags.HasError() { + break + } + continue + } + } + + // Automatic XML wrapper detection (without explicit wrapper tags) + fromFieldVal := valFrom.FieldByIndex(fromField.Index) + _, toOpts := autoflexTags(toField) + + // Handle pointer to XML wrapper struct + // Only auto-detect if target has explicit wrapper tag + if fromFieldVal.Kind() == reflect.Pointer { + if toOpts.XMLWrapperField() != "" && !fromFieldVal.IsNil() && isXMLWrapperStruct(fromFieldVal.Type().Elem()) { + // Check if target is a collection type (Set, List, or NestedObjectCollection) + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + targetType := valTo.Type(ctx) + switch tt := targetType.(type) { + case basetypes.SetTypable, basetypes.ListTypable, fwtypes.NestedObjectCollectionType: + // Check if wrapper is in empty state (Enabled=false, Items empty/nil) + // If so, set null and skip processing + wrapperVal := fromFieldVal.Elem() + enabledField := wrapperVal.FieldByName("Enabled") + itemsField := wrapperVal.FieldByName("Items") + + if enabledField.IsValid() && itemsField.IsValid() { + isEnabled := true + if enabledField.Kind() == reflect.Pointer && !enabledField.IsNil() { + isEnabled = enabledField.Elem().Bool() + } + + itemsEmpty := itemsField.IsNil() || (itemsField.Kind() == reflect.Slice && itemsField.Len() == 0) + + if !isEnabled && itemsEmpty { + tflog.SubsystemTrace(ctx, subsystemName, "XML wrapper is empty (Enabled=false, Items empty), setting null", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + }) + + // Call NullValue on NestedObjectCollectionType + if nestedObjType, ok := tt.(fwtypes.NestedObjectCollectionType); ok { + nullVal, d := nestedObjType.NullValue(ctx) + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullVal)) + } + continue + } + } + } + + // Determine wrapper field based on target type + // For NestedObjectCollection, the wrapper field doesn't matter as Rule 2 will be used + wrapperField := "Items" + + tflog.SubsystemTrace(ctx, subsystemName, "Auto-converting pointer to XML wrapper struct to collection", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + "wrapper_field": wrapperField, + }) + + // Try both value and pointer type assertions + if f, ok := flexer.(autoFlattener); ok { + diags.Append(f.xmlWrapperFlatten(ctx, fromFieldVal.Elem(), targetType, toFieldVal, wrapperField)...) + if diags.HasError() { + break + } + continue // Successfully handled, skip normal processing + } else if f, ok := flexer.(*autoFlattener); ok { + diags.Append(f.xmlWrapperFlatten(ctx, fromFieldVal.Elem(), targetType, toFieldVal, wrapperField)...) + if diags.HasError() { + break + } + continue // Successfully handled, skip normal processing + } + // If flexer is not autoFlattener, fall through to normal field matching + } + } + } else if toOpts.XMLWrapperField() != "" && fromFieldVal.IsNil() && isXMLWrapperStruct(fromFieldVal.Type().Elem()) { + // Handle nil pointer to XML wrapper struct - should result in null collection + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + switch tTo := valTo.Type(ctx).(type) { + case basetypes.SetTypable: + tflog.SubsystemTrace(ctx, subsystemName, "Auto-converting nil pointer to XML wrapper struct to null set", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + }) + var elemType attr.Type = types.StringType + if tToWithElem, ok := tTo.(attr.TypeWithElementType); ok { + elemType = tToWithElem.ElementType() + } + nullSet, d := tTo.ValueFromSet(ctx, types.SetNull(elemType)) + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullSet)) + } + if diags.HasError() { + break + } + continue + case basetypes.ListTypable: + tflog.SubsystemTrace(ctx, subsystemName, "Auto-converting nil pointer to XML wrapper struct to null list", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + }) + var elemType attr.Type = types.StringType + if tToWithElem, ok := tTo.(attr.TypeWithElementType); ok { + elemType = tToWithElem.ElementType() + } + nullList, d := tTo.ValueFromList(ctx, types.ListNull(elemType)) + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullList)) + } + if diags.HasError() { + break + } + continue + } + } + } + } else if toOpts.XMLWrapperField() != "" && isXMLWrapperStruct(fromFieldVal.Type()) { + // Handle direct XML wrapper struct (non-pointer) + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + switch valTo.Type(ctx).(type) { + case basetypes.SetTypable, basetypes.ListTypable: + tflog.SubsystemTrace(ctx, subsystemName, "Auto-converting XML wrapper struct to collection", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: toFieldName, + "wrapper_field": "Items", + }) + + if f, ok := flexer.(*autoFlattener); ok { + diags.Append(f.xmlWrapperFlatten(ctx, fromFieldVal, valTo.Type(ctx), toFieldVal, "Items")...) + } else { + diags.Append(DiagFlatteningIncompatibleTypes(fromFieldVal.Type(), reflect.TypeOf(toFieldVal.Interface()))) + } + if diags.HasError() { + break + } + continue + } + } } opts := fieldOpts{ @@ -2054,3 +2707,396 @@ func DiagFlatteningIncompatibleTypes(sourceType, targetType reflect.Type) diag.E fmt.Sprintf("Source type %q cannot be flattened to target type %q.", fullTypeName(sourceType), fullTypeName(targetType)), ) } + +// handleXMLWrapperCollapse handles the reverse of XML wrapper collapse - i.e., XML wrapper split. +// This takes complex AWS structures with XML wrapper patterns and splits them into multiple TF fields. +func (flattener autoFlattener) handleXMLWrapperCollapse(ctx context.Context, sourcePath path.Path, valFrom reflect.Value, targetPath path.Path, valTo reflect.Value, typeFrom, typeTo reflect.Type, processedFields map[string]bool) diag.Diagnostics { + var diags diag.Diagnostics + + // Look for source fields that are complex XML wrapper structures that should be split + for i := 0; i < typeFrom.NumField(); i++ { + fromField := typeFrom.Field(i) + fromFieldName := fromField.Name + fromFieldType := fromField.Type + fromFieldVal := valFrom.Field(i) + + // Skip already processed fields + if processedFields[fromFieldName] { + continue + } + + // Check if this is a pointer to a struct or direct struct that could be split + var sourceStructType reflect.Type + var sourceStructVal reflect.Value + isNil := false + + if fromFieldType.Kind() == reflect.Pointer && fromFieldType.Elem().Kind() == reflect.Struct { + if fromFieldVal.IsNil() { + isNil = true + sourceStructType = fromFieldType.Elem() + sourceStructVal = reflect.Zero(sourceStructType) + } else { + sourceStructType = fromFieldType.Elem() + sourceStructVal = fromFieldVal.Elem() + } + } else if fromFieldType.Kind() == reflect.Struct { + sourceStructType = fromFieldType + sourceStructVal = fromFieldVal + } else { + continue + } + + // Check if this source struct should be split into multiple target fields + if !flattener.isXMLWrapperSplitSource(sourceStructType) { + continue + } + + // Before splitting, check if there's a direct field match in the target + // If the target has a field with the same name that can accept this XML wrapper, + // skip the split and let normal field matching handle it + if targetField, ok := (&fuzzyFieldFinder{}).findField(ctx, fromFieldName, typeFrom, typeTo, flattener); ok { + if targetFieldVal := valTo.FieldByIndex(targetField.Index); targetFieldVal.CanSet() { + // Check if target field is a NestedObjectCollection that can accept this wrapper + if targetAttr, ok := targetFieldVal.Interface().(attr.Value); ok { + if _, isNestedObjCollection := targetAttr.Type(ctx).(fwtypes.NestedObjectCollectionType); isNestedObjCollection { + // Skip split - let normal field matching handle this as a direct wrapper-to-wrapper mapping + tflog.SubsystemTrace(ctx, subsystemName, "Skipping XML wrapper split - direct field match found", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeyTargetFieldname: targetField.Name, + }) + continue + } + } + } + } + + tflog.SubsystemTrace(ctx, subsystemName, "Found XML wrapper split source", map[string]any{ + logAttrKeySourceFieldname: fromFieldName, + logAttrKeySourceType: sourceStructType.String(), + "is_nil": isNil, + }) + + // Handle the XML wrapper split + diags.Append(flattener.handleXMLWrapperSplit(ctx, sourcePath.AtName(fromFieldName), sourceStructVal, targetPath, valTo, sourceStructType, typeTo, isNil, processedFields)...) + if diags.HasError() { + return diags + } + + // Mark the source field as processed + processedFields[fromFieldName] = true + } + + return diags +} + +// isXMLWrapperSplitSource checks if a struct type represents a source that should be +// split into multiple target fields (complex XML wrapper with additional fields beyond Items/Quantity) +func (flattener autoFlattener) isXMLWrapperSplitSource(structType reflect.Type) bool { + hasValidItems := false + hasValidQuantity := false + hasOtherFields := false + + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + fieldName := field.Name + fieldType := field.Type + + switch fieldName { + case "Items": + // Items must be a slice to be a valid XML wrapper + if fieldType.Kind() == reflect.Slice { + hasValidItems = true + } + case "Quantity": + // Quantity must be *int32 to be a valid XML wrapper + if fieldType == reflect.TypeOf((*int32)(nil)) { + hasValidQuantity = true + } + default: + // Any other field suggests this is a complex structure that should be split + hasOtherFields = true + } + } + + // Must have properly typed Items/Quantity (XML wrapper pattern) plus other fields to be a split candidate + return hasValidItems && hasValidQuantity && hasOtherFields +} + +// handleXMLWrapperSplit splits a complex AWS XML wrapper structure into multiple Terraform fields +func (flattener autoFlattener) handleXMLWrapperSplit(ctx context.Context, sourcePath path.Path, sourceStructVal reflect.Value, targetPath path.Path, valTo reflect.Value, sourceStructType, typeTo reflect.Type, isNil bool, processedFields map[string]bool) diag.Diagnostics { + var diags diag.Diagnostics + + tflog.SubsystemTrace(ctx, subsystemName, "Handling XML wrapper split", map[string]any{ + logAttrKeySourceType: sourceStructType.String(), + logAttrKeyTargetType: typeTo.String(), + }) + + // If source is nil, find and set the matching target field to null + if isNil { + // Extract source field name from path + sourceFieldName := "" + sourcePathStr := sourcePath.String() + if lastDot := strings.LastIndex(sourcePathStr, "."); lastDot >= 0 { + sourceFieldName = sourcePathStr[lastDot+1:] + } + + // Find matching target field + if sourceFieldName != "" { + if targetField, ok := (&fuzzyFieldFinder{}).findField(ctx, sourceFieldName, reflect.StructOf([]reflect.StructField{{Name: sourceFieldName, Type: reflect.TypeOf(""), PkgPath: ""}}), typeTo, flattener); ok { + toFieldVal := valTo.FieldByIndex(targetField.Index) + if toFieldVal.CanSet() { + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + switch tTo := valTo.Type(ctx).(type) { + case basetypes.SetTypable, basetypes.ListTypable: + tflog.SubsystemTrace(ctx, subsystemName, "Setting target collection field to null", map[string]any{ + logAttrKeyTargetFieldname: targetField.Name, + }) + + var elemType attr.Type = types.StringType + if tToWithElem, ok := tTo.(attr.TypeWithElementType); ok { + elemType = tToWithElem.ElementType() + } + + var nullVal attr.Value + var d diag.Diagnostics + if setType, ok := tTo.(basetypes.SetTypable); ok { + nullVal, d = setType.ValueFromSet(ctx, types.SetNull(elemType)) + } else if listType, ok := tTo.(basetypes.ListTypable); ok { + nullVal, d = listType.ValueFromList(ctx, types.ListNull(elemType)) + } + diags.Append(d...) + if !diags.HasError() { + toFieldVal.Set(reflect.ValueOf(nullVal)) + } + } + } + } + } + } + return diags + } + + // Map each field in the source struct to corresponding target fields + for i := 0; i < sourceStructType.NumField(); i++ { + sourceField := sourceStructType.Field(i) + sourceFieldName := sourceField.Name + sourceFieldVal := sourceStructVal.Field(i) + + tflog.SubsystemTrace(ctx, subsystemName, "Processing source field for split", map[string]any{ + "source_field": sourceFieldName, + "source_type": sourceField.Type.String(), + }) + + // Map the source field to target field(s) + if sourceFieldName == "Items" || sourceFieldName == "Quantity" { + // Items and Quantity should map to the main collection field + // Find a target field that matches the parent source field name + mainTargetFieldName := flattener.findMainTargetFieldForSplit(sourcePath, typeTo) + if mainTargetFieldName != "" { + if _, found := typeTo.FieldByName(mainTargetFieldName); found { + toFieldVal := valTo.FieldByName(mainTargetFieldName) + if toFieldVal.CanSet() { + tflog.SubsystemTrace(ctx, subsystemName, "Mapping Items/Quantity to main target field", map[string]any{ + "source_field": sourceFieldName, + "target_field": mainTargetFieldName, + }) + + // Only process this for the Items field, skip Quantity + if sourceFieldName == "Items" { + diags.Append(flattener.convertXMLWrapperFieldToCollection(ctx, sourcePath, sourceStructVal, targetPath.AtName(mainTargetFieldName), toFieldVal)...) + if diags.HasError() { + return diags + } + } + } + } + } + } else { + // Other fields should map directly by name + if _, found := typeTo.FieldByName(sourceFieldName); found { + toFieldVal := valTo.FieldByName(sourceFieldName) + if toFieldVal.CanSet() { + tflog.SubsystemTrace(ctx, subsystemName, "Mapping additional field by name", map[string]any{ + "source_field": sourceFieldName, + "target_field": sourceFieldName, + }) + + // Convert the source field to target field + diags.Append(flattener.convertXMLWrapperFieldToCollection(ctx, sourcePath.AtName(sourceFieldName), sourceFieldVal, targetPath.AtName(sourceFieldName), toFieldVal)...) + if diags.HasError() { + return diags + } + } + } + } + } + + return diags +} + +// findMainTargetFieldForSplit determines which target field should receive the Items/Quantity from the source +func (flattener autoFlattener) findMainTargetFieldForSplit(sourcePath path.Path, typeTo reflect.Type) string { + sourcePathStr := sourcePath.String() + if lastDot := strings.LastIndex(sourcePathStr, "."); lastDot >= 0 { + sourceFieldName := sourcePathStr[lastDot+1:] + + // Use fuzzy field finder for proper singular/plural and case matching + dummySourceType := reflect.StructOf([]reflect.StructField{{Name: sourceFieldName, Type: reflect.TypeOf(""), PkgPath: ""}}) + if targetField, ok := (&fuzzyFieldFinder{}).findField(context.Background(), sourceFieldName, dummySourceType, typeTo, flattener); ok { + return targetField.Name + } + } + + return "" +} + +// convertXMLWrapperFieldToCollection converts a source field (either XML wrapper or simple field) to a target collection +func (flattener autoFlattener) convertXMLWrapperFieldToCollection(ctx context.Context, sourcePath path.Path, sourceFieldVal reflect.Value, targetPath path.Path, toFieldVal reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + // Check if source is an XML wrapper struct (has Items/Quantity) + if sourceFieldVal.Kind() == reflect.Struct && isXMLWrapperStruct(sourceFieldVal.Type()) { + tflog.SubsystemTrace(ctx, subsystemName, "Converting XML wrapper struct to collection", map[string]any{ + "source_type": sourceFieldVal.Type().String(), + }) + + // Use existing XML wrapper flatten logic + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + diags.Append(flattener.xmlWrapperFlatten(ctx, sourceFieldVal, valTo.Type(ctx), toFieldVal, "Items")...) + } + } else if sourceFieldVal.Kind() == reflect.Pointer && !sourceFieldVal.IsNil() && isXMLWrapperStruct(sourceFieldVal.Type().Elem()) { + tflog.SubsystemTrace(ctx, subsystemName, "Converting pointer to XML wrapper struct to collection", map[string]any{ + "source_type": sourceFieldVal.Type().String(), + }) + + // Use existing XML wrapper flatten logic + if valTo, ok := toFieldVal.Interface().(attr.Value); ok { + diags.Append(flattener.xmlWrapperFlatten(ctx, sourceFieldVal.Elem(), valTo.Type(ctx), toFieldVal, "Items")...) + } + } else { + tflog.SubsystemTrace(ctx, subsystemName, "Converting non-XML wrapper field", map[string]any{ + "source_type": sourceFieldVal.Type().String(), + }) + + // For non-XML wrapper fields, use regular conversion + opts := fieldOpts{} + diags.Append(flattener.convert(ctx, sourcePath, sourceFieldVal, targetPath, toFieldVal, opts)...) + } + + return diags +} + +// createTargetValue creates a value of the target type from a source string value +func (flattener autoFlattener) createTargetValue(ctx context.Context, sourceValue types.String, targetType attr.Type) (attr.Value, diag.Diagnostics) { + var diags diag.Diagnostics + + // Check what type of target we have + switch targetType := targetType.(type) { + case basetypes.StringTypable: + // Regular string type + val, d := targetType.ValueFromString(ctx, sourceValue) + diags.Append(d...) + return val, diags + default: + // For StringEnum types or other complex types, try to use regular conversion + // This is a bit of a hack, but StringEnum types should accept string values + targetTypeStr := targetType.String() + if strings.Contains(targetTypeStr, "StringEnum") { + // Create a zero value of the target type and try to set it + targetVal := reflect.New(reflect.TypeOf(targetType.ValueType(ctx))).Elem() + + // Try to convert using the AutoFlex conversion logic + diags.Append(flattener.convert(ctx, path.Empty(), reflect.ValueOf(sourceValue), path.Empty(), targetVal, fieldOpts{})...) + if diags.HasError() { + return nil, diags + } + + if attrVal, ok := targetVal.Interface().(attr.Value); ok { + return attrVal, diags + } + } + + // Fallback to string value + return sourceValue, diags + } +} + +// xmlWrapperFlattenRule2 handles Rule 2: XML wrapper to single plural block with items + additional fields +func (flattener autoFlattener) xmlWrapperFlattenRule2(ctx context.Context, vFrom reflect.Value, tTo fwtypes.NestedObjectCollectionType, vTo reflect.Value) diag.Diagnostics { + var diags diag.Diagnostics + + if !isXMLWrapperStruct(vFrom.Type()) { + diags.Append(DiagFlatteningIncompatibleTypes(vFrom.Type(), reflect.TypeOf(vTo.Interface()))) + return diags + } + + // Check if wrapper is in empty state (Enabled=false, Items empty/nil) + // If so, return null instead of creating a block + enabledField := vFrom.FieldByName("Enabled") + itemsField := vFrom.FieldByName("Items") + + if enabledField.IsValid() && itemsField.IsValid() { + // Check if Enabled is false and Items is empty + isEnabled := true + if enabledField.Kind() == reflect.Pointer && !enabledField.IsNil() { + isEnabled = enabledField.Elem().Bool() + } + + itemsEmpty := itemsField.IsNil() || (itemsField.Kind() == reflect.Slice && itemsField.Len() == 0) + + if !isEnabled && itemsEmpty { + tflog.SubsystemTrace(ctx, subsystemName, "XML wrapper is empty (Enabled=false, Items empty), returning null for Rule 2") + nullVal, d := tTo.NullValue(ctx) + diags.Append(d...) + if !diags.HasError() { + vTo.Set(reflect.ValueOf(nullVal)) + } + return diags + } + } + + nestedObjPtr, d := tTo.NewObjectPtr(ctx) + diags.Append(d...) + if diags.HasError() { + return diags + } + + nestedObjValue := reflect.ValueOf(nestedObjPtr).Elem() + + // Map Items field + if itemsField := vFrom.FieldByName("Items"); itemsField.IsValid() { + if targetField := nestedObjValue.FieldByName("Items"); targetField.IsValid() && targetField.CanAddr() { + if targetAttr, ok := targetField.Addr().Interface().(attr.Value); ok { + diags.Append(autoFlattenConvert(ctx, itemsField.Interface(), targetAttr, flattener)...) + } + } + } + + // Map all other fields (skip Items and Quantity) + for i := 0; i < vFrom.NumField(); i++ { + sourceField := vFrom.Field(i) + fieldName := vFrom.Type().Field(i).Name + + if fieldName == "Items" || fieldName == "Quantity" { + continue + } + + if targetField := nestedObjValue.FieldByName(fieldName); targetField.IsValid() && targetField.CanAddr() { + if targetAttr, ok := targetField.Addr().Interface().(attr.Value); ok { + diags.Append(autoFlattenConvert(ctx, sourceField.Interface(), targetAttr, flattener)...) + } + } + } + + ptrType := reflect.TypeOf(nestedObjPtr) + objectSlice := reflect.MakeSlice(reflect.SliceOf(ptrType), 1, 1) + objectSlice.Index(0).Set(reflect.ValueOf(nestedObjPtr)) + + targetValue, d := tTo.ValueFromObjectSlice(ctx, objectSlice.Interface()) + diags.Append(d...) + if !diags.HasError() { + vTo.Set(reflect.ValueOf(targetValue)) + } + + return diags +} diff --git a/internal/framework/flex/autoflex_xml_compat_test.go b/internal/framework/flex/autoflex_xml_compat_test.go deleted file mode 100644 index 630d939eaa3c..000000000000 --- a/internal/framework/flex/autoflex_xml_compat_test.go +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package flex - -// Tests AutoFlex's Expand/Flatten of AWS API XML wrappers (Items/Quantity). - -import ( - "context" - "reflect" - "testing" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/types" - fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" -) - -// AWS SDK types that mirror CloudFront function association patterns -type FunctionAssociation struct { - EventType string `json:"EventType"` - FunctionARN *string `json:"FunctionARN"` -} - -type FunctionAssociations struct { - Items []FunctionAssociation `json:"Items"` - Quantity *int32 `json:"Quantity"` -} - -// Terraform model types -type FunctionAssociationTF struct { - EventType types.String `tfsdk:"event_type"` - FunctionARN types.String `tfsdk:"function_arn"` -} - -type DistributionConfigTF struct { - FunctionAssociations fwtypes.SetNestedObjectValueOf[FunctionAssociationTF] `tfsdk:"function_associations" autoflex:",xmlwrapper=items"` -} - -type DistributionConfigAWS struct { - FunctionAssociations *FunctionAssociations -} - -func TestExpandXMLWrapper(t *testing.T) { - t.Parallel() - - ctx := context.Background() - - testCases := autoFlexTestCases{ - "valid function associations": { - Source: DistributionConfigTF{ - FunctionAssociations: fwtypes.NewSetNestedObjectValueOfSliceMust( - ctx, - []*FunctionAssociationTF{ - { - EventType: types.StringValue("viewer-request"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: types.StringValue("viewer-response"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }, - ), - }, - Target: &DistributionConfigAWS{}, - WantTarget: &DistributionConfigAWS{ - FunctionAssociations: &FunctionAssociations{ - Quantity: aws.Int32(2), - Items: []FunctionAssociation{ - { - EventType: "viewer-request", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: "viewer-response", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }, - }, - }, - }, - "empty function associations": { - Source: DistributionConfigTF{ - FunctionAssociations: fwtypes.NewSetNestedObjectValueOfSliceMust( - ctx, - []*FunctionAssociationTF{}, - ), - }, - Target: &DistributionConfigAWS{}, - WantTarget: &DistributionConfigAWS{ - FunctionAssociations: &FunctionAssociations{ - Quantity: aws.Int32(0), - Items: []FunctionAssociation{}, - }, - }, - }, - "single function association": { - Source: DistributionConfigTF{ - FunctionAssociations: fwtypes.NewSetNestedObjectValueOfSliceMust( - ctx, - []*FunctionAssociationTF{ - { - EventType: types.StringValue("origin-request"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/origin-function"), - }, - }, - ), - }, - Target: &DistributionConfigAWS{}, - WantTarget: &DistributionConfigAWS{ - FunctionAssociations: &FunctionAssociations{ - Quantity: aws.Int32(1), - Items: []FunctionAssociation{ - { - EventType: "origin-request", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/origin-function"), - }, - }, - }, - }, - }, - } - - runAutoExpandTestCases(t, testCases, runChecks{CompareDiags: true, CompareTarget: true, GoldenLogs: true}) -} - -// Test XML wrapper expansion for direct struct (not pointer to struct) -type DirectXMLWrapper struct { - Items []string - Quantity *int32 -} - -type DirectWrapperTF struct { - Items fwtypes.SetValueOf[types.String] `tfsdk:"items" autoflex:",xmlwrapper=items"` -} - -type DirectWrapperAWS struct { - Items DirectXMLWrapper -} - -func TestExpandXMLWrapperDirect(t *testing.T) { - t.Parallel() - - ctx := context.Background() - - testCases := autoFlexTestCases{ - "direct xml wrapper": { - Source: DirectWrapperTF{ - Items: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{ - types.StringValue("item1"), - types.StringValue("item2"), - }), - }, - Target: &DirectWrapperAWS{}, - WantTarget: &DirectWrapperAWS{ - Items: DirectXMLWrapper{ - Items: []string{"item1", "item2"}, - Quantity: aws.Int32(2), - }, - }, - }, - } - - runAutoExpandTestCases(t, testCases, runChecks{CompareDiags: true, CompareTarget: true, GoldenLogs: true}) -} - -func TestIsXMLWrapperStruct(t *testing.T) { - t.Parallel() - - type embedWithField struct { - Count int64 - } - type embedWithoutField struct{} - - testCases := []struct { - name string - input any - expected bool - }{ - { - name: "valid XML wrapper", - input: FunctionAssociations{}, - expected: true, - }, - { - name: "valid XML wrapper with slice of strings", - input: DirectXMLWrapper{}, - expected: true, - }, - { - name: "valid XML wrapper with anonymous struct", - input: struct { - Items []string - Quantity *int32 - }{}, - expected: true, - }, - { - name: "not a struct", - input: "string", - expected: false, - }, - { - name: "struct without Items field", - input: struct{ Quantity *int32 }{}, - expected: false, - }, - { - name: "struct without Quantity field", - input: struct{ Items []string }{}, - expected: false, - }, - { - name: "struct with wrong Quantity type", - input: struct { - Items []string - Quantity int32 - }{}, - expected: false, - }, - { - name: "struct with Items not a slice", - input: struct { - Items string - Quantity *int32 - }{}, - expected: false, - }, - { - name: "struct with extra field", - input: struct { - Items []string - Quantity *int32 - Name string - }{}, - expected: false, - }, - { - name: "struct with anonymous embedWithField", - input: struct { - Items []string - Quantity *int32 - embedWithField - }{}, - expected: true, - }, - { - name: "struct with anonymous embedWithoutField", - input: struct { - Items []string - Quantity *int32 - embedWithoutField - }{}, - expected: true, - }, - { - name: "struct with private embedWithField", - input: struct { - Items []string - Quantity *int32 - private embedWithField - }{}, - expected: false, - }, - { - name: "struct with private embedWithoutField", - input: struct { - Items []string - Quantity *int32 - private embedWithoutField - }{}, - expected: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - result := isXMLWrapperStruct(reflect.TypeOf(tc.input)) - if result != tc.expected { - t.Errorf("Expected %v, got %v", tc.expected, result) - } - }) - } -} - -// Mock AWS types with XML wrapper pattern (for flattening - AWS to TF) -type awsStatusCodesForFlatten struct { - Items []int32 - Quantity *int32 -} - -type awsHeadersForFlatten struct { - Items []string - Quantity *int32 -} - -// TF model types with wrapper tags (for flattening - AWS to TF) -type tfStatusCodesModelForFlatten struct { - StatusCodes fwtypes.SetValueOf[types.Int64] `tfsdk:"status_codes" autoflex:",xmlwrapper=items"` -} - -type tfHeadersModelForFlatten struct { - Headers fwtypes.ListValueOf[types.String] `tfsdk:"headers" autoflex:",xmlwrapper=items"` -} - -func TestFlattenXMLWrapper(t *testing.T) { - t.Parallel() - - ctx := context.Background() - - testCases := autoFlexTestCases{ - "int32 slice to set": { - Source: awsStatusCodesForFlatten{ - Items: []int32{400, 404}, - Quantity: aws.Int32(2), - }, - Target: &tfStatusCodesModelForFlatten{}, - WantTarget: &tfStatusCodesModelForFlatten{ - StatusCodes: fwtypes.NewSetValueOfMust[types.Int64](ctx, []attr.Value{ - types.Int64Value(400), - types.Int64Value(404), - }), - }, - }, - "string slice to list": { - Source: awsHeadersForFlatten{ - Items: []string{"accept", "content-type"}, - Quantity: aws.Int32(2), - }, - Target: &tfHeadersModelForFlatten{}, - WantTarget: &tfHeadersModelForFlatten{ - Headers: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{ - types.StringValue("accept"), - types.StringValue("content-type"), - }), - }, - }, - "complex type - function associations": { - Source: FunctionAssociations{ - Items: []FunctionAssociation{ - { - EventType: "viewer-request", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/example-function"), - }, - { - EventType: "viewer-response", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/another-function"), - }, - }, - Quantity: aws.Int32(2), - }, - Target: &DistributionConfigTF{}, - WantTarget: &DistributionConfigTF{ - FunctionAssociations: fwtypes.NewSetNestedObjectValueOfSliceMust(ctx, []*FunctionAssociationTF{ - { - EventType: types.StringValue("viewer-request"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/example-function"), - }, - { - EventType: types.StringValue("viewer-response"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/another-function"), - }, - }), - }, - }, - "empty slice to null set": { - Source: awsStatusCodesForFlatten{ - Items: nil, - Quantity: aws.Int32(0), - }, - Target: &tfStatusCodesModelForFlatten{}, - WantTarget: &tfStatusCodesModelForFlatten{ - StatusCodes: fwtypes.NewSetValueOfNull[types.Int64](ctx), - }, - }, - } - - runAutoFlattenTestCases(t, testCases, runChecks{CompareDiags: true, CompareTarget: true, GoldenLogs: true}) -} - -type FunctionAssociationsTF struct { - Items fwtypes.ListNestedObjectValueOf[FunctionAssociationTF] `tfsdk:"items"` - Quantity types.Int64 `tfsdk:"quantity"` -} - -type DistributionConfigTFNoXMLWrapper struct { - FunctionAssociations fwtypes.ListNestedObjectValueOf[FunctionAssociationsTF] `tfsdk:"function_associations"` -} - -func TestExpandNoXMLWrapper(t *testing.T) { - t.Parallel() - - ctx := context.Background() - - testCases := autoFlexTestCases{ - "valid function associations": { - Source: DistributionConfigTFNoXMLWrapper{ - FunctionAssociations: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &FunctionAssociationsTF{ - Items: fwtypes.NewListNestedObjectValueOfSliceMust( - ctx, - []*FunctionAssociationTF{ - { - EventType: types.StringValue("viewer-request"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: types.StringValue("viewer-response"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }, - ), - Quantity: types.Int64Value(2), - }), - }, - Target: &DistributionConfigAWS{}, - WantTarget: &DistributionConfigAWS{ - FunctionAssociations: &FunctionAssociations{ - Quantity: aws.Int32(2), - Items: []FunctionAssociation{ - { - EventType: "viewer-request", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: "viewer-response", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }, - }, - }, - }, - } - - runAutoExpandTestCases(t, testCases, runChecks{CompareDiags: true, CompareTarget: true, GoldenLogs: true}) -} - -func TestFlattenNoXMLWrapper(t *testing.T) { - t.Parallel() - - ctx := context.Background() - - testCases := autoFlexTestCases{ - "complex type - function associations": { - Source: DistributionConfigAWS{ - FunctionAssociations: &FunctionAssociations{ - Quantity: aws.Int32(2), - Items: []FunctionAssociation{ - { - EventType: "viewer-request", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: "viewer-response", - FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }, - }, - }, - // Items: []FunctionAssociation{ - // { - // EventType: "viewer-request", - // FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/example-function"), - // }, - // { - // EventType: "viewer-response", - // FunctionARN: aws.String("arn:aws:cloudfront::123456789012:function/another-function"), - // }, - // }, - // Quantity: aws.Int32(2), - // }, - Target: &DistributionConfigTFNoXMLWrapper{}, - WantTarget: &DistributionConfigTFNoXMLWrapper{ - FunctionAssociations: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &FunctionAssociationsTF{ - Items: fwtypes.NewListNestedObjectValueOfSliceMust(ctx, []*FunctionAssociationTF{ - { - EventType: types.StringValue("viewer-request"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-1"), - }, - { - EventType: types.StringValue("viewer-response"), - FunctionARN: types.StringValue("arn:aws:cloudfront::123456789012:function/test-function-2"), - }, - }), - Quantity: types.Int64Value(2), - }), - }, - }, - } - - runAutoFlattenTestCases(t, testCases, runChecks{CompareDiags: true, CompareTarget: true, GoldenLogs: true}) -} diff --git a/internal/framework/flex/autoflex_xml_wrapper_test.go b/internal/framework/flex/autoflex_xml_wrapper_test.go new file mode 100644 index 000000000000..73b5f88b1385 --- /dev/null +++ b/internal/framework/flex/autoflex_xml_wrapper_test.go @@ -0,0 +1,1134 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// XML Wrapper Compatibility Tests +// +// These tests validate AutoFlex handling of AWS XML wrapper patterns commonly found in CloudFront APIs. +// XML wrappers are 3-field structs that encapsulate collections for XML serialization. +// +// ## Rule 1: Wrapper contains only Items/Quantity +// AWS: {Items: []T, Quantity: *int32} +// +// Scalar elements ([]string, []enum): +// Terraform: SetAttribute or ListAttribute +// Example: origin_ssl_protocols = ["TLSv1.2", "TLSv1.3"] +// +// Struct elements ([]CustomStruct): +// Terraform: Repeatable singular blocks (one block per item) +// Example: lambda_function_association { ... } +// lambda_function_association { ... } +// +// ## Rule 2: Wrapper contains Items/Quantity + additional fields (e.g., Enabled) +// AWS: {Items: []T, Quantity: *int32, Enabled: *bool} +// +// Terraform: Single plural block containing collection + extra fields +// Example: trusted_signers { +// items = ["signer1", "signer2"] +// enabled = true # computed from len(items) > 0 +// } +// +// ## Key Behaviors: +// - null/unknown Terraform input → nil AWS pointer (no empty struct creation) +// - empty collection → {Items: [], Quantity: 0, ...} +// - Quantity is always derived from len(Items), never user-specified +// - Expand and flatten must be symmetrical for stable apply/refresh cycles + +package flex + +import ( + "context" + "reflect" + "testing" + + "github.com/aws/aws-sdk-go-v2/aws" + awstypes "github.com/aws/aws-sdk-go-v2/service/cloudfront/types" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/types" + fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" +) + +// Test data types for Rule 1 XML wrappers +type testXMLWrapperScalar struct { + Items []string + Quantity *int32 +} + +// Test int32 slice items (like StatusCodes) +type testXMLWrapperInt32 struct { + Items []int32 + Quantity *int32 +} + +// Test int64 slice items +type testXMLWrapperInt64 struct { + Items []int64 + Quantity *int32 +} + +type testXMLWrapperStruct struct { + Items []testStructItem + Quantity *int32 +} + +type testStructItem struct { + Name *string + Value *int32 +} + +type testStructItemModel struct { + Name types.String `tfsdk:"name"` + Value types.Int32 `tfsdk:"value"` +} + +// Test Rule 1: XML wrappers with Items/Quantity only (scalar elements) +func TestExpandXMLWrapperRule1ScalarElements(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + testCases := map[string]autoFlexTestCases{ + "OriginSslProtocols": { + "null set": { + Source: fwtypes.NewSetValueOfNull[fwtypes.StringEnum[awstypes.SslProtocol]](ctx), + Target: &awstypes.OriginSslProtocols{}, + WantTarget: (*awstypes.OriginSslProtocols)(nil), + }, + "single protocol": { + Source: fwtypes.NewSetValueOfMust[fwtypes.StringEnum[awstypes.SslProtocol]](ctx, []attr.Value{ + fwtypes.StringEnumValue(awstypes.SslProtocolTLSv12), + }), + Target: &awstypes.OriginSslProtocols{}, + WantTarget: &awstypes.OriginSslProtocols{Items: []awstypes.SslProtocol{awstypes.SslProtocolTLSv12}, Quantity: aws.Int32(1)}, + }, + }, + "TestXMLWrapperScalar": func() autoFlexTestCases { + type tfModel struct { + Field fwtypes.SetValueOf[types.String] `tfsdk:"field" autoflex:",xmlwrapper=Items"` + } + type awsModel struct { + Field *testXMLWrapperScalar + } + return autoFlexTestCases{ + "null set": { + Source: &tfModel{Field: fwtypes.NewSetValueOfNull[types.String](ctx)}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: nil}, + }, + "empty set": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperScalar{Items: []string{}, Quantity: aws.Int32(0)}}, + }, + "single item": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{ + types.StringValue("item1"), + })}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperScalar{Items: []string{"item1"}, Quantity: aws.Int32(1)}}, + }, + "multiple items": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{ + types.StringValue("item1"), + types.StringValue("item2"), + })}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperScalar{Items: []string{"item1", "item2"}, Quantity: aws.Int32(2)}}, + }, + } + }(), + "TestXMLWrapperInt32": func() autoFlexTestCases { + type tfModel struct { + Field fwtypes.SetValueOf[types.Int32] `tfsdk:"field" autoflex:",xmlwrapper=Items"` + } + type awsModel struct { + Field *testXMLWrapperInt32 + } + return autoFlexTestCases{ + "empty set": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.Int32](ctx, []attr.Value{})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperInt32{Items: []int32{}, Quantity: aws.Int32(0)}}, + }, + "single item": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.Int32](ctx, []attr.Value{types.Int32Value(404)})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperInt32{Items: []int32{404}, Quantity: aws.Int32(1)}}, + }, + } + }(), + "TestXMLWrapperInt64": func() autoFlexTestCases { + type tfModel struct { + Field fwtypes.SetValueOf[types.Int64] `tfsdk:"field" autoflex:",xmlwrapper=Items"` + } + type awsModel struct { + Field *testXMLWrapperInt64 + } + return autoFlexTestCases{ + "empty set": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.Int64](ctx, []attr.Value{})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperInt64{Items: []int64{}, Quantity: aws.Int32(0)}}, + }, + "single item": { + Source: &tfModel{Field: fwtypes.NewSetValueOfMust[types.Int64](ctx, []attr.Value{types.Int64Value(12345)})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperInt64{Items: []int64{12345}, Quantity: aws.Int32(1)}}, + }, + } + }(), + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + if testName == "OriginSslProtocols" { + runAutoExpandTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: false}) + } else { + runAutoExpandTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + } + }) + } +} + +// Test Rule 1: XML wrappers with Items/Quantity only (struct elements) +func TestExpandXMLWrapperRule1StructElements(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + type tfModel struct { + Field fwtypes.SetNestedObjectValueOf[testStructItemModel] `tfsdk:"field" autoflex:",xmlwrapper=Items"` + } + type awsModel struct { + Field *testXMLWrapperStruct + } + + testCases := map[string]autoFlexTestCases{ + "TestXMLWrapperStruct": { + "null set": { + Source: &tfModel{Field: fwtypes.NewSetNestedObjectValueOfNull[testStructItemModel](ctx)}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: nil}, + }, + "empty set": { + Source: &tfModel{Field: fwtypes.NewSetNestedObjectValueOfValueSliceMust[testStructItemModel](ctx, []testStructItemModel{})}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperStruct{Items: []testStructItem{}, Quantity: aws.Int32(0)}}, + }, + "single item": { + Source: &tfModel{Field: fwtypes.NewSetNestedObjectValueOfValueSliceMust[testStructItemModel](ctx, []testStructItemModel{ + { + Name: types.StringValue("test"), + Value: types.Int32Value(42), + }, + })}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperStruct{ + Items: []testStructItem{ + { + Name: aws.String("test"), + Value: aws.Int32(42), + }, + }, + Quantity: aws.Int32(1), + }}, + }, + }, + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + runAutoExpandTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + }) + } +} + +// Test Rule 1 Flatten: XML wrappers with Items/Quantity only (scalar elements) +func TestFlattenXMLWrapperRule1ScalarElements(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // Source struct containing XML wrapper + type sourceStruct struct { + XMLWrapper *testXMLWrapperScalar + } + + // Target struct containing collection + type targetStruct struct { + XMLWrapper fwtypes.SetValueOf[types.String] `autoflex:",xmlwrapper=Items"` + } + + testCases := map[string]autoFlexTestCases{ + "TestXMLWrapperScalar": { + "nil source": { + Source: &sourceStruct{XMLWrapper: nil}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewSetValueOfNull[types.String](ctx)}, + }, + "empty items": { + Source: &sourceStruct{XMLWrapper: &testXMLWrapperScalar{Items: []string{}, Quantity: aws.Int32(0)}}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{})}, + }, + "single item": { + Source: &sourceStruct{XMLWrapper: &testXMLWrapperScalar{Items: []string{"item1"}, Quantity: aws.Int32(1)}}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{types.StringValue("item1")})}, + }, + }, + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + runAutoFlattenTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + }) + } +} + +// Test Rule 1 Flatten: XML wrappers with Items/Quantity only (struct elements) +func TestFlattenXMLWrapperRule1StructElements(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // Source struct containing XML wrapper + type sourceStruct struct { + XMLWrapper *testXMLWrapperStruct + } + + // Target struct containing collection + type targetStruct struct { + XMLWrapper fwtypes.SetNestedObjectValueOf[testStructItemModel] `autoflex:",xmlwrapper=Items"` + } + + testCases := map[string]autoFlexTestCases{ + "TestXMLWrapperStruct": { + "nil source": { + Source: &sourceStruct{XMLWrapper: nil}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewSetNestedObjectValueOfNull[testStructItemModel](ctx)}, + }, + "empty items": { + Source: &sourceStruct{XMLWrapper: &testXMLWrapperStruct{Items: []testStructItem{}, Quantity: aws.Int32(0)}}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewSetNestedObjectValueOfValueSliceMust[testStructItemModel](ctx, []testStructItemModel{})}, + }, + "single item": { + Source: &sourceStruct{ + XMLWrapper: &testXMLWrapperStruct{ + Items: []testStructItem{ + {Name: aws.String("test"), Value: aws.Int32(42)}, + }, + Quantity: aws.Int32(1), + }, + }, + Target: &targetStruct{}, + WantTarget: &targetStruct{ + XMLWrapper: fwtypes.NewSetNestedObjectValueOfValueSliceMust[testStructItemModel](ctx, []testStructItemModel{ + {Name: types.StringValue("test"), Value: types.Int32Value(42)}, + }), + }, + }, + }, + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + runAutoFlattenTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + }) + } +} + +// Test Rule 1 Symmetry: Verify expand→flatten produces identical results +func TestXMLWrapperRule1Symmetry(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // Test scalar elements symmetry + t.Run("ScalarElements", func(t *testing.T) { + t.Parallel() + + type tfSource struct { + XMLWrapper fwtypes.SetValueOf[types.String] `tfsdk:"xml_wrapper" autoflex:",xmlwrapper=Items"` + } + + type awsTarget struct { + XMLWrapper *testXMLWrapperScalar + } + + // Original Terraform value + original := tfSource{ + XMLWrapper: fwtypes.NewSetValueOfMust[types.String](ctx, []attr.Value{ + types.StringValue("item1"), + types.StringValue("item2"), + }), + } + + // Expand: TF → AWS + var awsStruct awsTarget + expandDiags := Expand(ctx, original, &awsStruct) + if expandDiags.HasError() { + t.Fatalf("Expand failed: %v", expandDiags) + } + + // Verify expand result + if awsStruct.XMLWrapper == nil { + t.Fatal("Expected non-nil XMLWrapper") + } + if len(awsStruct.XMLWrapper.Items) != 2 || *awsStruct.XMLWrapper.Quantity != 2 { + t.Errorf("Expand produced incorrect result: Items=%v, Quantity=%v", awsStruct.XMLWrapper.Items, *awsStruct.XMLWrapper.Quantity) + } + + // Flatten: AWS → TF + var targetStruct tfSource + flattenDiags := Flatten(ctx, &awsStruct, &targetStruct) + if flattenDiags.HasError() { + t.Fatalf("Flatten failed: %v", flattenDiags) + } + + // Verify symmetry: flattened result should match original + if !original.XMLWrapper.Equal(targetStruct.XMLWrapper) { + t.Errorf("Symmetry broken: original=%v, flattened=%v", original.XMLWrapper, targetStruct.XMLWrapper) + } + }) + + // Test struct elements symmetry + t.Run("StructElements", func(t *testing.T) { + t.Parallel() + + type tfSource struct { + XMLWrapper fwtypes.SetNestedObjectValueOf[testStructItemModel] `tfsdk:"xml_wrapper" autoflex:",xmlwrapper=Items"` + } + + type awsTarget struct { + XMLWrapper *testXMLWrapperStruct + } + + // Original Terraform value + original := tfSource{ + XMLWrapper: fwtypes.NewSetNestedObjectValueOfValueSliceMust[testStructItemModel](ctx, []testStructItemModel{ + {Name: types.StringValue("test"), Value: types.Int32Value(42)}, + }), + } + + // Expand: TF → AWS + var awsStruct awsTarget + expandDiags := Expand(ctx, original, &awsStruct) + if expandDiags.HasError() { + t.Fatalf("Expand failed: %v", expandDiags) + } + + // Verify expand result + if awsStruct.XMLWrapper == nil { + t.Fatal("Expected non-nil XMLWrapper") + } + if len(awsStruct.XMLWrapper.Items) != 1 || *awsStruct.XMLWrapper.Quantity != 1 { + t.Errorf("Expand produced incorrect result: Items=%v, Quantity=%v", awsStruct.XMLWrapper.Items, *awsStruct.XMLWrapper.Quantity) + } + + // Flatten: AWS → TF + var targetStruct tfSource + flattenDiags := Flatten(ctx, &awsStruct, &targetStruct) + if flattenDiags.HasError() { + t.Fatalf("Flatten failed: %v", flattenDiags) + } + + // Verify symmetry: flattened result should match original + if !original.XMLWrapper.Equal(targetStruct.XMLWrapper) { + t.Errorf("Symmetry broken: original=%v, flattened=%v", original.XMLWrapper, targetStruct.XMLWrapper) + } + }) +} + +// Test data types for Rule 2 XML wrappers (Items/Quantity + additional fields) +type testXMLWrapperRule2 struct { + Items []string + Quantity *int32 + Enabled *bool +} + +// Test different field ordering (matches real TrustedSigners/TrustedKeyGroups) +type testXMLWrapperRule2DifferentOrder struct { + Enabled *bool + Quantity *int32 + Items []string +} + +type testRule2Model struct { + Items fwtypes.ListValueOf[types.String] `tfsdk:"items"` + Enabled types.Bool `tfsdk:"enabled"` +} + +// Test Rule 2: XML wrappers with Items/Quantity + additional fields (e.g., Enabled) +func TestExpandXMLWrapperRule2(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + type tfModel struct { + Field fwtypes.ListNestedObjectValueOf[testRule2Model] `tfsdk:"field" autoflex:",xmlwrapper=Items"` + } + type awsModel struct { + Field *testXMLWrapperRule2 + } + type awsModelDifferentOrder struct { + Field *testXMLWrapperRule2DifferentOrder + } + + testCases := map[string]autoFlexTestCases{ + "TestXMLWrapperRule2": { + "null block": { + Source: &tfModel{Field: fwtypes.NewListNestedObjectValueOfNull[testRule2Model](ctx)}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: nil}, + }, + "empty items, enabled false": { + Source: &tfModel{Field: fwtypes.NewListNestedObjectValueOfValueSliceMust[testRule2Model](ctx, []testRule2Model{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{}), + Enabled: types.BoolValue(false), + }, + })}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperRule2{Items: []string{}, Quantity: aws.Int32(0), Enabled: aws.Bool(false)}}, + }, + "with items, enabled true": { + Source: &tfModel{Field: fwtypes.NewListNestedObjectValueOfValueSliceMust[testRule2Model](ctx, []testRule2Model{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{types.StringValue("item1")}), + Enabled: types.BoolValue(true), + }, + })}, + Target: &awsModel{}, + WantTarget: &awsModel{Field: &testXMLWrapperRule2{Items: []string{"item1"}, Quantity: aws.Int32(1), Enabled: aws.Bool(true)}}, + }, + }, + "TestXMLWrapperRule2DifferentOrder": { + "different field order": { + Source: &tfModel{Field: fwtypes.NewListNestedObjectValueOfValueSliceMust[testRule2Model](ctx, []testRule2Model{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{types.StringValue("item1")}), + Enabled: types.BoolValue(true), + }, + })}, + Target: &awsModelDifferentOrder{}, + WantTarget: &awsModelDifferentOrder{Field: &testXMLWrapperRule2DifferentOrder{Items: []string{"item1"}, Quantity: aws.Int32(1), Enabled: aws.Bool(true)}}, + }, + }, + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + runAutoExpandTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + }) + } +} + +// Test Rule 2 Flatten: XML wrappers with Items/Quantity + additional fields +func TestFlattenXMLWrapperRule2(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // Source struct containing Rule 2 XML wrapper + type sourceStruct struct { + XMLWrapper *testXMLWrapperRule2 + } + + // Target struct containing Rule 2 pattern + type targetStruct struct { + XMLWrapper fwtypes.ListNestedObjectValueOf[testRule2Model] `autoflex:",xmlwrapper=Items"` + } + + testCases := map[string]autoFlexTestCases{ + "TestXMLWrapperRule2": { + "nil source": { + Source: &sourceStruct{XMLWrapper: nil}, + Target: &targetStruct{}, + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewListNestedObjectValueOfNull[testRule2Model](ctx)}, + }, + "empty items, enabled false": { + Source: &sourceStruct{ + XMLWrapper: &testXMLWrapperRule2{Items: []string{}, Quantity: aws.Int32(0), Enabled: aws.Bool(false)}, + }, + Target: &targetStruct{}, + // Empty state (Enabled=false, Items=[]) should flatten to null per Rule 2 + WantTarget: &targetStruct{XMLWrapper: fwtypes.NewListNestedObjectValueOfNull[testRule2Model](ctx)}, + }, + }, + } + + for testName, cases := range testCases { + t.Run(testName, func(t *testing.T) { + t.Parallel() + + runAutoFlattenTestCases(t, cases, runChecks{CompareDiags: true, CompareTarget: true}) + }) + } +} + +// Test Rule 2 Symmetry: Verify expand→flatten produces identical results +func TestXMLWrapperRule2Symmetry(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + t.Run("Rule2Pattern", func(t *testing.T) { + t.Parallel() + + // Wrap source and target in structs with xmlwrapper tags + type tfSource struct { + XMLWrapper fwtypes.ListNestedObjectValueOf[testRule2Model] `tfsdk:"xml_wrapper" autoflex:",xmlwrapper=Items"` + } + + type awsTarget struct { + XMLWrapper *testXMLWrapperRule2 + } + + // Original Terraform value (Rule 2 pattern) + original := tfSource{ + XMLWrapper: fwtypes.NewListNestedObjectValueOfValueSliceMust[testRule2Model](ctx, []testRule2Model{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{types.StringValue("signer1"), types.StringValue("signer2")}), + Enabled: types.BoolValue(true), + }, + }), + } + + // Expand: TF → AWS + var awsStruct awsTarget + expandDiags := Expand(ctx, original, &awsStruct) + if expandDiags.HasError() { + t.Fatalf("Expand failed: %v", expandDiags) + } + + // Verify expand result + if awsStruct.XMLWrapper == nil { + t.Fatal("Expected non-nil XMLWrapper") + } + if len(awsStruct.XMLWrapper.Items) != 2 || *awsStruct.XMLWrapper.Quantity != 2 || !*awsStruct.XMLWrapper.Enabled { + t.Errorf("Expand produced incorrect result: Items=%v, Quantity=%v, Enabled=%v", + awsStruct.XMLWrapper.Items, *awsStruct.XMLWrapper.Quantity, *awsStruct.XMLWrapper.Enabled) + } + + // Flatten: AWS → TF + var targetStruct tfSource + flattenDiags := Flatten(ctx, &awsStruct, &targetStruct) + if flattenDiags.HasError() { + t.Fatalf("Flatten failed: %v", flattenDiags) + } + + // Verify symmetry: flattened result should match original + if !original.XMLWrapper.Equal(targetStruct.XMLWrapper) { + t.Errorf("Symmetry broken: original=%v, flattened=%v", original.XMLWrapper, targetStruct.XMLWrapper) + } + }) +} + +// Test Real CloudFront Types: Validate actual AWS SDK types +func TestXMLWrapperRealCloudFrontTypes(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // Test with actual CloudFront TrustedSigners type + t.Run("TrustedSigners", func(t *testing.T) { + t.Parallel() + + // Terraform model matching CloudFront schema + type trustedSignersModel struct { + Items fwtypes.ListValueOf[types.String] `tfsdk:"items"` + Enabled types.Bool `tfsdk:"enabled"` + } + + type tfSource struct { + TrustedSigners fwtypes.ListNestedObjectValueOf[trustedSignersModel] `tfsdk:"trusted_signers" autoflex:",xmlwrapper=Items"` + } + + type awsTarget struct { + TrustedSigners *awstypes.TrustedSigners + } + + source := tfSource{ + TrustedSigners: fwtypes.NewListNestedObjectValueOfValueSliceMust[trustedSignersModel](ctx, []trustedSignersModel{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{types.StringValue("AKIAIOSFODNN7EXAMPLE")}), + Enabled: types.BoolValue(true), + }, + }), + } + + var target awsTarget + diags := Expand(ctx, source, &target) + + if diags.HasError() { + t.Errorf("TrustedSigners expand failed: %v", diags) + } else { + // Verify correct AWS structure + if target.TrustedSigners == nil { + t.Fatal("Expected non-nil TrustedSigners") + } + if len(target.TrustedSigners.Items) != 1 || *target.TrustedSigners.Quantity != 1 || !*target.TrustedSigners.Enabled { + t.Errorf("TrustedSigners incorrect: Items=%v, Quantity=%v, Enabled=%v", + target.TrustedSigners.Items, *target.TrustedSigners.Quantity, *target.TrustedSigners.Enabled) + } + } + }) +} + +// Test Rule 1: XML wrapper with complex struct items (like Origins) +func TestFlattenXMLWrapperRule1ComplexStructItems(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // AWS types: Origins with Items/Quantity + type awsOrigin struct { + DomainName *string + Id *string + } + + type awsOrigins struct { + Items []awsOrigin + Quantity *int32 + } + + type awsDistributionConfig struct { + Origins *awsOrigins + Comment *string + } + + // Terraform models + type tfOriginModel struct { + DomainName types.String `tfsdk:"domain_name"` + Id types.String `tfsdk:"id"` + } + + type tfDistributionModel struct { + Origin fwtypes.SetNestedObjectValueOf[tfOriginModel] `tfsdk:"origin" autoflex:",xmlwrapper=Items"` + Comment types.String `tfsdk:"comment"` + } + + t.Run("flatten origins", func(t *testing.T) { + source := &awsDistributionConfig{ + Origins: &awsOrigins{ + Items: []awsOrigin{ + {DomainName: aws.String("example.com"), Id: aws.String("origin1")}, + {DomainName: aws.String("cdn.example.com"), Id: aws.String("origin2")}, + }, + Quantity: aws.Int32(2), + }, + Comment: aws.String("test distribution"), + } + + var target tfDistributionModel + diags := Flatten(ctx, source, &target) + + if diags.HasError() { + t.Fatalf("Flatten failed: %v", diags) + } + + if target.Origin.IsNull() { + t.Fatal("Expected non-null origin set") + } + + elements := target.Origin.Elements() + if len(elements) != 2 { + t.Errorf("Expected 2 origins, got %d", len(elements)) + } + }) +} + +// Test isXMLWrapperStruct detection function +func TestIsXMLWrapperStruct(t *testing.T) { + t.Parallel() + + type embedWithField struct { + Count int64 + } + type embedWithoutField struct{} + + testCases := []struct { + name string + input any + expected bool + }{ + { + name: "valid XML wrapper - Rule 1", + input: struct { + Items []string + Quantity *int32 + }{}, + expected: true, + }, + { + name: "valid XML wrapper - Rule 2 with Enabled", + input: struct { + Items []string + Quantity *int32 + Enabled *bool + }{}, + expected: true, + }, + { + name: "not a struct", + input: "string", + expected: false, + }, + { + name: "struct without Items field", + input: struct{ Quantity *int32 }{}, + expected: false, + }, + { + name: "struct without Quantity field", + input: struct{ Items []string }{}, + expected: false, + }, + { + name: "struct with wrong Quantity type (not pointer)", + input: struct { + Items []string + Quantity int32 + }{}, + expected: false, + }, + { + name: "struct with Items not a slice", + input: struct { + Items string + Quantity *int32 + }{}, + expected: false, + }, + { + name: "struct with 4 fields including Items/Quantity", + input: struct { + Items []string + Quantity *int32 + Name string + Extra string + }{}, + expected: true, // Has Items/Quantity, so it's a valid wrapper + }, + { + name: "struct with anonymous embedWithField", + input: struct { + Items []string + Quantity *int32 + embedWithField + }{}, + expected: true, + }, + { + name: "struct with anonymous embedWithoutField", + input: struct { + Items []string + Quantity *int32 + embedWithoutField + }{}, + expected: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + result := isXMLWrapperStruct(reflect.TypeOf(tc.input)) + if result != tc.expected { + t.Errorf("Expected %v, got %v for input %T", tc.expected, result, tc.input) + } + }) + } +} + +// Test that structs with Items/Quantity but NO xmlwrapper tag are NOT treated as XML wrappers +func TestExpandNoXMLWrapperTag(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // AWS types + type awsFunctionAssociation struct { + FunctionArn *string + EventType string + } + + type awsFunctionAssociations struct { + Items []awsFunctionAssociation + Quantity *int32 + } + + // Terraform types (NO xmlwrapper tag) + type tfFunctionAssociation struct { + EventType types.String `tfsdk:"event_type"` + FunctionArn types.String `tfsdk:"function_arn"` + } + + type tfFunctionAssociations struct { + Items fwtypes.ListNestedObjectValueOf[tfFunctionAssociation] `tfsdk:"items"` + Quantity types.Int64 `tfsdk:"quantity"` + } + + // Source with nested struct containing Items/Quantity + source := tfFunctionAssociations{ + Items: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []tfFunctionAssociation{ + { + EventType: types.StringValue("viewer-request"), + FunctionArn: types.StringValue("arn:aws:cloudfront::123456789012:function/test-1"), + }, + }), + Quantity: types.Int64Value(1), + } + + var target awsFunctionAssociations + diags := Expand(ctx, source, &target) + + if diags.HasError() { + t.Fatalf("Expand failed: %v", diags) + } + + // Without xmlwrapper tag, should map fields directly (not treat as wrapper) + if len(target.Items) != 1 { + t.Errorf("Expected 1 item, got %d", len(target.Items)) + } + if target.Quantity == nil || *target.Quantity != 1 { + t.Errorf("Expected Quantity=1, got %v", target.Quantity) + } +} + +func TestFlattenNoXMLWrapperTag(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // AWS types + type awsFunctionAssociation struct { + FunctionArn *string + EventType string + } + + type awsFunctionAssociations struct { + Items []awsFunctionAssociation + Quantity *int32 + } + + // Terraform types (NO xmlwrapper tag) + type tfFunctionAssociation struct { + EventType types.String `tfsdk:"event_type"` + FunctionArn types.String `tfsdk:"function_arn"` + } + + type tfFunctionAssociations struct { + Items fwtypes.ListNestedObjectValueOf[tfFunctionAssociation] `tfsdk:"items"` + Quantity types.Int64 `tfsdk:"quantity"` + } + + source := awsFunctionAssociations{ + Quantity: aws.Int32(1), + Items: []awsFunctionAssociation{ + { + EventType: "viewer-request", + FunctionArn: aws.String("arn:aws:cloudfront::123456789012:function/test-1"), + }, + }, + } + + var target tfFunctionAssociations + diags := Flatten(ctx, source, &target) + + if diags.HasError() { + t.Fatalf("Flatten failed: %v", diags) + } + + // Without xmlwrapper tag, should map fields directly (not treat as wrapper) + if target.Items.IsNull() { + t.Error("Expected non-null Items") + } + if target.Quantity.IsNull() || target.Quantity.ValueInt64() != 1 { + t.Errorf("Expected Quantity=1, got %v", target.Quantity) + } +} + +// Test nested XML wrappers: wrapper inside wrapper +// Example: CacheBehaviors (Rule 1) → CacheBehavior → TrustedKeyGroups (Rule 2) +func TestNestedXMLWrappers(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + // AWS types: Outer wrapper (Rule 1) containing inner wrapper (Rule 2) + type awsTrustedKeyGroups struct { + Items []string + Quantity *int32 + Enabled *bool + } + + type awsCacheBehavior struct { + PathPattern *string + TargetOriginId *string + TrustedKeyGroups *awsTrustedKeyGroups + } + + type awsCacheBehaviors struct { + Items []awsCacheBehavior + Quantity *int32 + } + + // Terraform types: Both levels have xmlwrapper tags + type tfTrustedKeyGroups struct { + Items fwtypes.ListValueOf[types.String] `tfsdk:"items"` + Enabled types.Bool `tfsdk:"enabled"` + } + + type tfCacheBehavior struct { + PathPattern types.String `tfsdk:"path_pattern"` + TargetOriginId types.String `tfsdk:"target_origin_id"` + TrustedKeyGroups fwtypes.ListNestedObjectValueOf[tfTrustedKeyGroups] `tfsdk:"trusted_key_groups" autoflex:",xmlwrapper=Items"` + } + + t.Run("Expand", func(t *testing.T) { + t.Parallel() + + // Terraform source with nested wrappers + type tfSource struct { + CacheBehaviors fwtypes.SetNestedObjectValueOf[tfCacheBehavior] `tfsdk:"cache_behaviors" autoflex:",xmlwrapper=Items"` + } + + source := tfSource{ + CacheBehaviors: fwtypes.NewSetNestedObjectValueOfValueSliceMust(ctx, []tfCacheBehavior{ + { + PathPattern: types.StringValue("/api/*"), + TargetOriginId: types.StringValue("api-origin"), + TrustedKeyGroups: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []tfTrustedKeyGroups{ + { + Items: fwtypes.NewListValueOfMust[types.String](ctx, []attr.Value{types.StringValue("key-group-1")}), + Enabled: types.BoolValue(true), + }, + }), + }, + }), + } + + type awsTarget struct { + CacheBehaviors *awsCacheBehaviors + } + + var target awsTarget + diags := Expand(ctx, source, &target) + + if diags.HasError() { + t.Fatalf("Expand failed: %v", diags) + } + + // Verify outer wrapper + if target.CacheBehaviors == nil { + t.Fatal("Expected non-nil CacheBehaviors") + } + if len(target.CacheBehaviors.Items) != 1 || *target.CacheBehaviors.Quantity != 1 { + t.Errorf("Outer wrapper incorrect: Items=%d, Quantity=%v", len(target.CacheBehaviors.Items), *target.CacheBehaviors.Quantity) + } + + // Verify inner wrapper + behavior := target.CacheBehaviors.Items[0] + if behavior.TrustedKeyGroups == nil { + t.Fatal("Expected non-nil TrustedKeyGroups") + } + if len(behavior.TrustedKeyGroups.Items) != 1 || *behavior.TrustedKeyGroups.Quantity != 1 { + t.Errorf("Inner wrapper incorrect: Items=%d, Quantity=%v", + len(behavior.TrustedKeyGroups.Items), *behavior.TrustedKeyGroups.Quantity) + } + if !*behavior.TrustedKeyGroups.Enabled { + t.Error("Expected Enabled=true") + } + }) + + t.Run("Flatten", func(t *testing.T) { + t.Parallel() + + // AWS source with nested wrappers + type awsSource struct { + CacheBehaviors *awsCacheBehaviors + } + + source := awsSource{ + CacheBehaviors: &awsCacheBehaviors{ + Quantity: aws.Int32(1), + Items: []awsCacheBehavior{ + { + PathPattern: aws.String("/api/*"), + TargetOriginId: aws.String("api-origin"), + TrustedKeyGroups: &awsTrustedKeyGroups{ + Enabled: aws.Bool(true), + Quantity: aws.Int32(1), + Items: []string{"key-group-1"}, + }, + }, + }, + }, + } + + type tfTarget struct { + CacheBehaviors fwtypes.SetNestedObjectValueOf[tfCacheBehavior] `tfsdk:"cache_behaviors" autoflex:",xmlwrapper=Items"` + } + + var target tfTarget + diags := Flatten(ctx, &source, &target) + + if diags.HasError() { + t.Fatalf("Flatten failed: %v", diags) + } + + // Verify outer wrapper flattened correctly + if target.CacheBehaviors.IsNull() { + t.Fatal("Expected non-null CacheBehaviors") + } + + // Extract the actual behavior structs + var behaviors []tfCacheBehavior + diags = target.CacheBehaviors.ElementsAs(ctx, &behaviors, false) + if diags.HasError() { + t.Fatalf("ElementsAs failed: %v", diags) + } + + if len(behaviors) != 1 { + t.Fatalf("Expected 1 cache behavior, got %d", len(behaviors)) + } + + // Verify inner wrapper flattened correctly + behavior := behaviors[0] + if behavior.TrustedKeyGroups.IsNull() { + t.Error("Expected non-null TrustedKeyGroups") + } + + var keyGroups []tfTrustedKeyGroups + diags = behavior.TrustedKeyGroups.ElementsAs(ctx, &keyGroups, false) + if diags.HasError() { + t.Fatalf("ElementsAs failed: %v", diags) + } + + if len(keyGroups) != 1 { + t.Fatalf("Expected 1 TrustedKeyGroups element, got %d", len(keyGroups)) + } + + keyGroup := keyGroups[0] + if keyGroup.Items.IsNull() { + t.Error("Expected non-null Items") + } + if keyGroup.Enabled.IsNull() || !keyGroup.Enabled.ValueBool() { + t.Error("Expected Enabled=true") + } + }) +} diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_list_target.golden index 23e6c89ef88a..b226178d7cda 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderPtrSlice", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_set_target.golden index fe01250ab60f..b7bac12706e9 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_pointer_struct_list_source_and_empty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderPtrSlice", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_list_target.golden index 6cb0e36d141b..08f4b7470a63 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderStructSlice", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_set_target.golden index 1f6fa5558634..844d40fb11db 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/empty_struct_list_source_and_empty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderStructSlice", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_list_target.golden index 2c04626d4a67..87cdf9faee25 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSinglePtr", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_set_target.golden index 0f5087e7280b..61459d73dce8 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nil_pointer_struct_source_and_null_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSinglePtr", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_list_target.golden index 55359a7d3469..883fe601220e 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderPtrSlice", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_set_target.golden index 204ca5b2b33c..e6e2491569e7 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_pointer_struct_list_source_and_nonempty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderPtrSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderPtrSlice", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_nonempty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_nonempty_list_target.golden index a747025227c9..f7f65bf5a33e 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_nonempty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_nonempty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderStructSlice", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_set_target.golden index edbdf2508df8..25857d675f83 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/nonempty_struct_list_source_and_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderStructSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderStructSlice", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/pointer_struct_source_and_object_value_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/pointer_struct_source_and_object_value_target.golden index 1f6296ea1c02..6365925183ba 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/pointer_struct_source_and_object_value_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/pointer_struct_source_and_object_value_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderObjectValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderObjectValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSinglePtr", + "toType": "*flex.tfExpanderObjectValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_list_target.golden index 8b41f9ab409e..16a80b311575 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSinglePtr", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_set_target.golden index b799f8a0f872..396f0a63a064 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_pointer_struct_source_and_single_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSinglePtr", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSinglePtr", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_list_target.golden index da7ee1699c29..65afee8bed9f 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderListNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSingleStruct", + "toType": "*flex.tfExpanderListNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_set_target.golden index db4742966c57..a476e100f871 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/single_struct_source_and_single_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderSetNestedObject", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSingleStruct", + "toType": "*flex.tfExpanderSetNestedObject" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/struct_source_and_object_value_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/struct_source_and_object_value_target.golden index dff33365e7ef..29a874a3c080 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/struct_source_and_object_value_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/struct_source_and_object_value_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderObjectValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderSingleStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfExpanderObjectValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderSingleStruct", + "toType": "*flex.tfExpanderObjectValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_incompatible_struct_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_incompatible_struct_target.golden index 8d2c2eee9cf7..433e3362e512 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_incompatible_struct_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_incompatible_struct_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderIncompatible", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfFlexer" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpanderIncompatible", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfFlexer", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpanderIncompatible", + "toType": "*flex.tfFlexer" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_struct_source.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_struct_source.golden index 7b46c42e9435..4e8ce3760aa2 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_struct_source.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_flattener/top_level_struct_source.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpander", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfFlexer" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsExpander", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfFlexer", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsExpander", + "toType": "*flex.tfFlexer" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_list_target.golden index f343de973cd7..b1a564984a3d 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_set_target.golden index 2c5d83aa605c..09f69436b7f8 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/empty_interface_list_source_and_empty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/interface_source_and_nested_object_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/interface_source_and_nested_object_target.golden index 2682355c4ce7..4e3a1fc9b5cd 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/interface_source_and_nested_object_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/interface_source_and_nested_object_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_list_target.golden index d04531c3214b..25f7ae033e65 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_set_target.golden index 7b4cfca7e6c5..bf3157bad8ee 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_list_source_and_empty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_list_target.golden index d042084ea76e..3451833a123b 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nested_object_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nested_object_target.golden index 85c9b6c7c5cb..07f6f1b320af 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nested_object_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nested_object_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfObjectValue[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nonflattener_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nonflattener_list_target.golden index 2a12c67661b5..fca0c97334a3 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nonflattener_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_nonflattener_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_set_target.golden index 6998b837fede..da648bb3f291 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nil_interface_source_and_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_list_target.golden index 31fa554b7f5e..43cb106953e7 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_set_target.golden index 465de2af1aef..0f1f819eafda 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/nonempty_interface_list_source_and_nonempty_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSlice", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSlice", + "toType": "*flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_nonflattener_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_nonflattener_list_target.golden index 6a31b309a410..f7134532e13c 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_nonflattener_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_nonflattener_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_list_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_list_target.golden index c298c447fc8b..94a875285e64 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_list_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_list_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfListNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_set_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_set_target.golden index 29f3dcbca7c2..b2861eda9465 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_set_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface/single_interface_source_and_single_set_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceSingle", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsInterfaceSingle", + "toType": "*flex.tfSetNestedObject[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfInterfaceFlexer]" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue.golden index 07a24c3cdc82..409e94b5dc5b 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsRFC3339TimeValue", + "toType": "*flex.awsRFC3339TimeValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue_ptr.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue_ptr.golden index 865449d4019f..34a7f1b8d543 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue_ptr.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_field_to_nonattrvalue_ptr.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsRFC3339TimeValue", + "toType": "*flex.awsRFC3339TimePointer" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue.golden index 1a4ddd7e9c12..e696bccd7257 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimeValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsRFC3339TimePointer", + "toType": "*flex.awsRFC3339TimeValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue_ptr.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue_ptr.golden index 54cc7739a973..9d4b484b5ceb 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue_ptr.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/source_struct_ptr_field_to_nonattrvalue_ptr.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsRFC3339TimePointer", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsRFC3339TimePointer", + "toType": "*flex.awsRFC3339TimePointer" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/target_field_does_not_implement_attrvalue_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/target_field_does_not_implement_attrvalue_target.golden index a3b6f1202250..f633211b356e 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/target_field_does_not_implement_attrvalue_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_interface_contract/target_field_does_not_implement_attrvalue_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringValue", + "toType": "*flex.awsSingleStringValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/slice_or_map_of_primitive_types_source_and_collection_of_primitive_types_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/slice_or_map_of_primitive_types_source_and_collection_of_primitive_types_target.golden index aa867dc50eb4..d42ce3ebc286 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/slice_or_map_of_primitive_types_source_and_collection_of_primitive_types_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/slice_or_map_of_primitive_types_source_and_collection_of_primitive_types_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsCollectionsOfPrimitiveElements", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfCollectionsOfPrimitiveElements" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsCollectionsOfPrimitiveElements", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfCollectionsOfPrimitiveElements", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsCollectionsOfPrimitiveElements", + "toType": "*flex.tfCollectionsOfPrimitiveElements" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/zero_value_slice_or_map_of_primitive_types_source_and_collection_of_primtive_types_target.golden b/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/zero_value_slice_or_map_of_primitive_types_source_and_collection_of_primtive_types_target.golden index 3327a2557bec..89f81765dfdd 100644 --- a/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/zero_value_slice_or_map_of_primitive_types_source_and_collection_of_primtive_types_target.golden +++ b/internal/framework/flex/testdata/autoflex/dispatch/flatten_logging_collections/zero_value_slice_or_map_of_primitive_types_source_and_collection_of_primtive_types_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsCollectionsOfPrimitiveElements", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfCollectionsOfPrimitiveElements" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsCollectionsOfPrimitiveElements", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfCollectionsOfPrimitiveElements", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsCollectionsOfPrimitiveElements", + "toType": "*flex.tfCollectionsOfPrimitiveElements" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_enum_key.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_enum_key.golden index 1f087001223c..fc5c4e0f2a7c 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_enum_key.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_enum_key.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockListEnumKey" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockListEnumKey", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockValues", + "toType": "*flex.tfMapBlockListEnumKey" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_list.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_list.golden index 20a2cfd76760..f51008281170 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_list.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_list.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockValues", + "toType": "*flex.tfMapBlockList" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_both.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_both.golden index 8c2f11c65e62..79ca5226109f 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_both.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_both.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockPointers", + "toType": "*flex.tfMapBlockList" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_source.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_source.golden index 8c2f11c65e62..79ca5226109f 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_source.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_ptr_source.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockPointers", + "toType": "*flex.tfMapBlockList" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_set.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_set.golden index f886c9c14412..3ec71d43a2f1 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_set.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_key_set.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockSet" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockSet", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockValues", + "toType": "*flex.tfMapBlockSet" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_list_no_key.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_list_no_key.golden index 3423c8e8cfde..1c766d75e31b 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_list_no_key.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/map_block_list_no_key.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockListNoKey" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockListNoKey", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockValues", + "toType": "*flex.tfMapBlockListNoKey" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key.golden index 52a99c5bce60..7586a3f15c25 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockValues", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockValues", + "toType": "*flex.tfMapBlockList" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key_ptr.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key_ptr.golden index dd795f506b1a..7d71296fa013 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key_ptr.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_map_block/nil_map_block_key_ptr.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapBlockPointers", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapBlockList", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapBlockPointers", + "toType": "*flex.tfMapBlockList" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string.golden index 86f9ca29c8e2..b761225ad7ad 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfMapOfString", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfMapOfString" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfMapOfString", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfMapOfString", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapOfMapOfString", + "toType": "*flex.tfMapOfMapOfString" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string_pointer.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string_pointer.golden index 8932064712c7..3559a9740bd7 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_map_of_string_pointer.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfMapOfStringPointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfMapOfString" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfMapOfStringPointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfMapOfString", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapOfMapOfStringPointer", + "toType": "*flex.tfMapOfMapOfString" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string.golden index 608badf4b341..bdfdfb0bf689 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfString", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfString" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfString", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfString", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapOfString", + "toType": "*flex.tfMapOfString" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string_pointer.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string_pointer.golden index fbf4775a65ae..17d571a3cd69 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/map_of_string_pointer.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfStringPointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfString" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsMapOfStringPointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfMapOfString", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsMapOfStringPointer", + "toType": "*flex.tfMapOfString" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/nested_string_map.golden b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/nested_string_map.golden index 3abbe9b0565c..9cc2c4261f50 100644 --- a/internal/framework/flex/testdata/autoflex/maps/flatten_maps/nested_string_map.golden +++ b/internal/framework/flex/testdata/autoflex/maps/flatten_maps/nested_string_map.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsNestedMapOfString", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfNestedMapOfString" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsNestedMapOfString", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfNestedMapOfString", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsNestedMapOfString", + "toType": "*flex.tfNestedMapOfString" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/nested/flatten_nested_complex/complex_source_and_complex_target.golden b/internal/framework/flex/testdata/autoflex/nested/flatten_nested_complex/complex_source_and_complex_target.golden index 614f7ae03292..44065962262a 100644 --- a/internal/framework/flex/testdata/autoflex/nested/flatten_nested_complex/complex_source_and_complex_target.golden +++ b/internal/framework/flex/testdata/autoflex/nested/flatten_nested_complex/complex_source_and_complex_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsComplexValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfComplexValue" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsComplexValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfComplexValue", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsComplexValue", + "toType": "*flex.tfComplexValue" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_ok.golden b/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_ok.golden index 2479d4dbc0d6..b1a1492a0494 100644 --- a/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_ok.golden +++ b/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_ok.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsAllThePrimitiveFields", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfAllThePrimitiveFields" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsAllThePrimitiveFields", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfAllThePrimitiveFields", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsAllThePrimitiveFields", + "toType": "*flex.tfAllThePrimitiveFields" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_zero_ok.golden b/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_zero_ok.golden index 2479d4dbc0d6..b1a1492a0494 100644 --- a/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_zero_ok.golden +++ b/internal/framework/flex/testdata/autoflex/nums/flatten_primitive_pack/primitive_pack_zero_ok.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsAllThePrimitiveFields", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfAllThePrimitiveFields" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsAllThePrimitiveFields", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfAllThePrimitiveFields", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsAllThePrimitiveFields", + "toType": "*flex.tfAllThePrimitiveFields" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy.golden index 084914e0a521..606dcee013e7 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy_tf_to_aws_pointer.golden index 084914e0a521..606dcee013e7 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_standard.golden index dc50efa6f4fb..d9988541ed14 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_tf_to_aws_pointer.golden index c93e49a49035..4191df10b5bf 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_false_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy.golden index c059923c4c8f..3da45458016b 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy_tf_to_aws_pointer.golden index c059923c4c8f..3da45458016b 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_standard.golden index 1c8adc46a3fb..7f3415c3cbd4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_tf_to_aws_pointer.golden index 885731c2be5d..30e0618f8954 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy.golden index 084914e0a521..606dcee013e7 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy_tf_to_aws_pointer.golden index 084914e0a521..606dcee013e7 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_standard.golden index dc50efa6f4fb..d9988541ed14 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_tf_to_aws_pointer.golden index c93e49a49035..4191df10b5bf 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/bool_true_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *bool }", + "toType": "*struct { Field1 basetypes.BoolValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy.golden index f836d26bad92..fc824f1cf9c2 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy_tf_to_aws_pointer.golden index f836d26bad92..fc824f1cf9c2 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_standard.golden index 0793a8efcf3b..88043ad2560d 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_tf_to_aws_pointer.golden index 6956445f31b5..0cad29344ea6 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy.golden index 2ceba686b1c9..114b4e9f47ea 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy_tf_to_aws_pointer.golden index 2ceba686b1c9..114b4e9f47ea 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_standard.golden index ee09a97048a8..d2e9ddc87562 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_tf_to_aws_pointer.golden index 6ff062b1d5f5..7de1d7afbd4c 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy.golden index 2ceba686b1c9..114b4e9f47ea 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy_tf_to_aws_pointer.golden index 2ceba686b1c9..114b4e9f47ea 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_standard.golden index ee09a97048a8..d2e9ddc87562 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_tf_to_aws_pointer.golden index 6ff062b1d5f5..7de1d7afbd4c 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float32_zero_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float32 }", + "toType": "*struct { Field1 basetypes.Float32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy.golden index 504eb061446b..db8ac85d70a4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy_tf_to_aws_pointer.golden index 504eb061446b..db8ac85d70a4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_standard.golden index 894ed50249ec..04860bf9d0ab 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_tf_to_aws_pointer.golden index 8d55c7c858d8..7a6d6875bbfe 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy.golden index 7119ff04a146..93ea8f6de2c4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy_tf_to_aws_pointer.golden index 7119ff04a146..93ea8f6de2c4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_standard.golden index 697f98a9faaa..a9b9c85d4d50 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_tf_to_aws_pointer.golden index fcd33650f255..57c42afff7b1 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy.golden index 7119ff04a146..93ea8f6de2c4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy_tf_to_aws_pointer.golden index 7119ff04a146..93ea8f6de2c4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_standard.golden index 697f98a9faaa..a9b9c85d4d50 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_tf_to_aws_pointer.golden index fcd33650f255..57c42afff7b1 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/float64_zero_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *float64 }", + "toType": "*struct { Field1 basetypes.Float64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy.golden index cea99278cda2..67c89ff78dc8 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy_tf_to_aws_pointer.golden index cea99278cda2..67c89ff78dc8 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_standard.golden index 2a8c2a46bceb..255824bc624b 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_tf_to_aws_pointer.golden index eba67773deee..4c25bc24db9c 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy.golden index 70c1207b1d2f..5628171deeae 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy_tf_to_aws_pointer.golden index 70c1207b1d2f..5628171deeae 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_standard.golden index 27b1ecc16f97..1badd8876726 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_tf_to_aws_pointer.golden index 5e58035eabdd..eebf42e5defe 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy.golden index 70c1207b1d2f..5628171deeae 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy_tf_to_aws_pointer.golden index 70c1207b1d2f..5628171deeae 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_standard.golden index 27b1ecc16f97..1badd8876726 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_tf_to_aws_pointer.golden index 5e58035eabdd..eebf42e5defe 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int32_zero_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int32 }", + "toType": "*struct { Field1 basetypes.Int32Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy.golden index a184e6b65358..13cfcbda45dc 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy_tf_to_aws_pointer.golden index a184e6b65358..13cfcbda45dc 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_standard.golden index 085133610ec4..02b5a0c7be9e 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_tf_to_aws_pointer.golden index 2cc07d6880c2..2a963dec243f 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy.golden index 76dd740b2ec0..2dadf686900d 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy_tf_to_aws_pointer.golden index 76dd740b2ec0..2dadf686900d 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_standard.golden index 68aadd91a106..e700cde78e19 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_tf_to_aws_pointer.golden index f8409ff61ae3..4043c5df1037 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy.golden index 76dd740b2ec0..2dadf686900d 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy_tf_to_aws_pointer.golden index 76dd740b2ec0..2dadf686900d 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_standard.golden index 68aadd91a106..e700cde78e19 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_tf_to_aws_pointer.golden index f8409ff61ae3..4043c5df1037 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/int64_zero_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *int64 }", + "toType": "*struct { Field1 basetypes.Int64Value \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy_tf_to_aws_pointer.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_standard.golden index f14e8ea92ff1..92d61f195209 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_tf_to_aws_pointer.golden index 6b26981e2588..ec073855f6d4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_empty_string_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy_tf_to_aws_pointer.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_standard.golden index f14e8ea92ff1..92d61f195209 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_tf_to_aws_pointer.golden index 6b26981e2588..ec073855f6d4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_normal_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy.golden index a391dd10976b..7a43acf1b795 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy_tf_to_aws_pointer.golden index a391dd10976b..7a43acf1b795 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_standard.golden index 4044014c0e70..131ea5b9d605 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_standard.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_tf_to_aws_pointer.golden index 554622bde4f3..6ea45bd96f70 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_null_value_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy_tf_to_aws_pointer.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_standard.golden index f14e8ea92ff1..92d61f195209 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_tf_to_aws_pointer.golden index 6b26981e2588..ec073855f6d4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_random_value_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy_tf_to_aws_pointer.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_standard.golden index f14e8ea92ff1..92d61f195209 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_tf_to_aws_pointer.golden index 6b26981e2588..ec073855f6d4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_special_characters_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy_tf_to_aws_pointer.golden index 682b2e050960..a0d1872a8930 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_legacy_tf_to_aws_pointer.golden @@ -51,6 +51,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\" autoflex:\\\",legacy\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_standard.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_standard.golden index f14e8ea92ff1..92d61f195209 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_standard.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_standard.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_tf_to_aws_pointer.golden b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_tf_to_aws_pointer.golden index 6b26981e2588..ec073855f6d4 100644 --- a/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_tf_to_aws_pointer.golden +++ b/internal/framework/flex/testdata/autoflex/primitives/primitives_roundtrip/string_unicode_content_tf_to_aws_pointer.golden @@ -42,6 +42,19 @@ "autoflex.source.type": "*", "autoflex.target.type": "*" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "", + "autoflex.target.path": "", + "autoflex.target.type": "*", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "struct { Field1 *string }", + "toType": "*struct { Field1 basetypes.StringValue \"tfsdk:\\\"field1\\\"\" }" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_byte_slice_source_and_single_string_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_byte_slice_source_and_single_string_target.golden index 176b90340eac..7b09a876b89d 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_byte_slice_source_and_single_string_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_byte_slice_source_and_single_string_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleByteSliceValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleByteSliceValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleByteSliceValue", + "toType": "*flex.tfSingleStringField" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_empty_string_source_and_single_string_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_empty_string_source_and_single_string_target.golden index 193d87f18987..111628ae4cb8 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_empty_string_source_and_single_string_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_empty_string_source_and_single_string_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringValue", + "toType": "*flex.tfSingleStringField" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_nil_pointer_string_source_and_single_string_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_nil_pointer_string_source_and_single_string_target.golden index e94aa793a460..2ee005e9c388 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_nil_pointer_string_source_and_single_string_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_nil_pointer_string_source_and_single_string_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringPointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringPointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringPointer", + "toType": "*flex.tfSingleStringField" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_pointer_string_source_and_single_string_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_pointer_string_source_and_single_string_target.golden index e94aa793a460..2ee005e9c388 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_pointer_string_source_and_single_string_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_pointer_string_source_and_single_string_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringPointer", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringPointer", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringPointer", + "toType": "*flex.tfSingleStringField" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_int64_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_int64_target.golden index a0f11636057a..89138f62de1b 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_int64_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_int64_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleInt64Field" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleInt64Field", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringValue", + "toType": "*flex.tfSingleInt64Field" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_string_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_string_target.golden index 193d87f18987..111628ae4cb8 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_string_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_source_and_single_string_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringValue", + "toType": "*flex.tfSingleStringField" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_struct_pointer_source_and_empty_target.golden b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_struct_pointer_source_and_empty_target.golden index 27ece498d91d..cb3bf2e5f7b1 100644 --- a/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_struct_pointer_source_and_empty_target.golden +++ b/internal/framework/flex/testdata/autoflex/strings/flatten_string_special/single_string_struct_pointer_source_and_empty_target.golden @@ -6,6 +6,19 @@ "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.emptyStruct" }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsSingleStringValue", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.emptyStruct", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.awsSingleStringValue", + "toType": "*flex.emptyStruct" + }, { "@level": "info", "@message": "Converting", diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/expand_no_xmlwrapper/valid_function_associations.golden b/internal/framework/flex/testdata/autoflex/xml_compat/expand_no_xmlwrapper/valid_function_associations.golden deleted file mode 100644 index 2b6bca7ff6b6..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/expand_no_xmlwrapper/valid_function_associations.golden +++ /dev/null @@ -1,168 +0,0 @@ -[ - { - "@level": "info", - "@message": "Expanding", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionAssociations", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "Items", - "autoflex.source.path": "FunctionAssociations[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF", - "autoflex.target.fieldname": "Items", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations.Items", - "autoflex.target.type": "[]github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Expanding nested object collection", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items", - "autoflex.source.size": 2, - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations.Items", - "autoflex.target.type": "[]github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "FunctionAssociations[0].Items[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "FunctionAssociations.Items[0]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items[0].EventType", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionAssociations.Items[0].EventType", - "autoflex.target.type": "string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "FunctionAssociations[0].Items[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "FunctionAssociations.Items[0]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items[0].FunctionARN", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionAssociations.Items[0].FunctionARN", - "autoflex.target.type": "*string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "FunctionAssociations[0].Items[1]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "FunctionAssociations.Items[1]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items[1].EventType", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionAssociations.Items[1].EventType", - "autoflex.target.type": "string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "FunctionAssociations[0].Items[1]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "FunctionAssociations.Items[1]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Items[1].FunctionARN", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionAssociations.Items[1].FunctionARN", - "autoflex.target.type": "*string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "Quantity", - "autoflex.source.path": "FunctionAssociations[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF", - "autoflex.target.fieldname": "Quantity", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations[0].Quantity", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int64Value", - "autoflex.target.path": "FunctionAssociations.Quantity", - "autoflex.target.type": "*int32" - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/empty_function_associations.golden b/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/empty_function_associations.golden deleted file mode 100644 index 5c51df3bbd46..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/empty_function_associations.golden +++ /dev/null @@ -1,70 +0,0 @@ -[ - { - "@level": "info", - "@message": "Expanding", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionAssociations", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Expanding NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "source_type": "SetNestedObjectTypeOf[flex.FunctionAssociationTF]", - "target_type": "flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Converting nested objects to items", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 0, - "items_type": "[]flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Successfully expanded NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 0 - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/single_function_association.golden b/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/single_function_association.golden deleted file mode 100644 index 914f24645a32..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/single_function_association.golden +++ /dev/null @@ -1,119 +0,0 @@ -[ - { - "@level": "info", - "@message": "Expanding", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionAssociations", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Expanding NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "source_type": "SetNestedObjectTypeOf[flex.FunctionAssociationTF]", - "target_type": "flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Converting nested objects to items", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 1, - "items_type": "[]flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "EventType", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "EventType", - "autoflex.target.type": "string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionARN", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionARN", - "autoflex.target.type": "*string" - }, - { - "@level": "trace", - "@message": "Successfully expanded NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 1 - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/valid_function_associations.golden b/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/valid_function_associations.golden deleted file mode 100644 index 95d26e0d9b45..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper/valid_function_associations.golden +++ /dev/null @@ -1,168 +0,0 @@ -[ - { - "@level": "info", - "@message": "Expanding", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionAssociations", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Expanding NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "source_type": "SetNestedObjectTypeOf[flex.FunctionAssociationTF]", - "target_type": "flex.FunctionAssociations" - }, - { - "@level": "trace", - "@message": "Converting nested objects to items", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 2, - "items_type": "[]flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "EventType", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "EventType", - "autoflex.target.type": "string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionARN", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionARN", - "autoflex.target.type": "*string" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "EventType", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "EventType", - "autoflex.target.type": "string" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionARN", - "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue", - "autoflex.target.path": "FunctionARN", - "autoflex.target.type": "*string" - }, - { - "@level": "trace", - "@message": "Successfully expanded NestedObjectCollection to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "items_count": 2 - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper_direct/direct_xml_wrapper.golden b/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper_direct/direct_xml_wrapper.golden deleted file mode 100644 index feac7ec774d3..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/expand_xmlwrapper_direct/direct_xml_wrapper.golden +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "@level": "info", - "@message": "Expanding", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperTF", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperTF", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperAWS" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "Items", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperTF", - "autoflex.target.fieldname": "Items", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectWrapperAWS" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "Items", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", - "autoflex.target.path": "Items", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectXMLWrapper" - }, - { - "@level": "trace", - "@message": "Successfully expanded to XML wrapper", - "@module": "provider.autoflex", - "autoflex.source.path": "Items", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", - "autoflex.target.path": "Items", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DirectXMLWrapper", - "items_count": 2, - "source_type": "basetypes.SetValue", - "target_type": "flex.DirectXMLWrapper", - "wrapper_field": "Items" - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_no_xmlwrapper/complex_type__function_associations.golden b/internal/framework/flex/testdata/autoflex/xml_compat/flatten_no_xmlwrapper/complex_type__function_associations.golden deleted file mode 100644 index 15b240a7e704..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_no_xmlwrapper/complex_type__function_associations.golden +++ /dev/null @@ -1,168 +0,0 @@ -[ - { - "@level": "info", - "@message": "Flattening", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionAssociations", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigAWS", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTFNoXMLWrapper" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF]" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "Items", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.fieldname": "Items", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items", - "autoflex.source.type": "[]github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.path": "FunctionAssociations.Items", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]" - }, - { - "@level": "trace", - "@message": "Flattening nested object collection", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items", - "autoflex.source.size": 2, - "autoflex.source.type": "[]github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.path": "FunctionAssociations.Items", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "FunctionAssociations.Items[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "FunctionAssociations.Items[0]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items[0].EventType", - "autoflex.source.type": "string", - "autoflex.target.path": "FunctionAssociations.Items[0].EventType", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "FunctionAssociations.Items[0]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "FunctionAssociations.Items[0]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items[0].FunctionARN", - "autoflex.source.type": "*string", - "autoflex.target.path": "FunctionAssociations.Items[0].FunctionARN", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "FunctionAssociations.Items[1]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "FunctionAssociations.Items[1]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items[1].EventType", - "autoflex.source.type": "string", - "autoflex.target.path": "FunctionAssociations.Items[1].EventType", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "FunctionAssociations.Items[1]", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "FunctionAssociations.Items[1]", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Items[1].FunctionARN", - "autoflex.source.type": "*string", - "autoflex.target.path": "FunctionAssociations.Items[1].FunctionARN", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "Quantity", - "autoflex.source.path": "FunctionAssociations", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.fieldname": "Quantity", - "autoflex.target.path": "FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationsTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionAssociations.Quantity", - "autoflex.source.type": "*int32", - "autoflex.target.path": "FunctionAssociations.Quantity", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int64Value" - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/complex_type__function_associations.golden b/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/complex_type__function_associations.golden deleted file mode 100644 index e481e95568ce..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/complex_type__function_associations.golden +++ /dev/null @@ -1,213 +0,0 @@ -[ - { - "@level": "info", - "@message": "Flattening", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF" - }, - { - "@level": "trace", - "@message": "Converting entire XML wrapper struct to collection field", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "flex.FunctionAssociations", - "autoflex.target.fieldname": "FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "wrapper_field": "items" - }, - { - "@level": "trace", - "@message": "Starting XML wrapper flatten", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "source_type": "flex.FunctionAssociations", - "target_type": "SetNestedObjectTypeOf[flex.FunctionAssociationTF]", - "wrapper_field": "items" - }, - { - "@level": "trace", - "@message": "Found Items field", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "items_is_nil": false, - "items_kind": "slice", - "items_len": 2, - "items_type": "[]flex.FunctionAssociation" - }, - { - "@level": "trace", - "@message": "Using target element type", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "element_type": "ObjectTypeOf[flex.FunctionAssociationTF]" - }, - { - "@level": "trace", - "@message": "Converting items to set elements", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "items_count": 2 - }, - { - "@level": "trace", - "@message": "Processing item", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "index": 0, - "item_kind": "struct", - "item_value": { - "EventType": "viewer-request", - "FunctionARN": "arn:aws:cloudfront::123456789012:function/example-function" - } - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.path": "", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "EventType", - "autoflex.source.type": "string", - "autoflex.target.path": "EventType", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionARN", - "autoflex.source.type": "*string", - "autoflex.target.path": "FunctionARN", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Processing item", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "index": 1, - "item_kind": "struct", - "item_value": { - "EventType": "viewer-response", - "FunctionARN": "arn:aws:cloudfront::123456789012:function/another-function" - } - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.path": "", - "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF]" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "EventType", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "EventType", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "EventType", - "autoflex.source.type": "string", - "autoflex.target.path": "EventType", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Matched fields", - "@module": "provider.autoflex", - "autoflex.source.fieldname": "FunctionARN", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociation", - "autoflex.target.fieldname": "FunctionARN", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociationTF" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "FunctionARN", - "autoflex.source.type": "*string", - "autoflex.target.path": "FunctionARN", - "autoflex.target.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue" - }, - { - "@level": "trace", - "@message": "Creating set value", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.FunctionAssociations", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.DistributionConfigTF", - "element_count": 2, - "element_type": "ObjectTypeOf[flex.FunctionAssociationTF]" - } -] diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/empty_slice_to_null_set.golden b/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/empty_slice_to_null_set.golden deleted file mode 100644 index 9a5732a1645f..000000000000 --- a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/empty_slice_to_null_set.golden +++ /dev/null @@ -1,73 +0,0 @@ -[ - { - "@level": "info", - "@message": "Flattening", - "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten" - }, - { - "@level": "info", - "@message": "Converting", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten" - }, - { - "@level": "trace", - "@message": "Converting entire XML wrapper struct to collection field", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "flex.awsStatusCodesForFlatten", - "autoflex.target.fieldname": "StatusCodes", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "wrapper_field": "items" - }, - { - "@level": "trace", - "@message": "Starting XML wrapper flatten", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "source_type": "flex.awsStatusCodesForFlatten", - "target_type": "SetTypeOf[basetypes.Int64Value]", - "wrapper_field": "items" - }, - { - "@level": "trace", - "@message": "Found Items field", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "items_is_nil": true, - "items_kind": "slice", - "items_len": 0, - "items_type": "[]int32" - }, - { - "@level": "trace", - "@message": "Using target element type", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "element_type": "basetypes.Int64Type" - }, - { - "@level": "trace", - "@message": "Flattening XML wrapper with SetNull", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten" - } -] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/empty_set.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/empty_set.golden new file mode 100644 index 000000000000..e506a41751be --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/empty_set.golden @@ -0,0 +1,29 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32" + }, + { + "@level": "error", + "@message": "AutoFlex Expand; incompatible types", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32", + "from": "Set[Int32]", + "to": 25 + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/multiple_items.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/multiple_items.golden new file mode 100644 index 000000000000..73c43b5a5074 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/multiple_items.golden @@ -0,0 +1,31 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar" + }, + { + "@level": "error", + "@message": "AutoFlex Expand; incompatible types", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar", + "from": { + "ElemType": {} + }, + "to": 25 + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/null_set.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/null_set.golden new file mode 100644 index 000000000000..fbf216723a4d --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/null_set.golden @@ -0,0 +1,27 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar" + }, + { + "@level": "trace", + "@message": "Expanding null value", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperScalar" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_item.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_item.golden new file mode 100644 index 000000000000..e506a41751be --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_item.golden @@ -0,0 +1,29 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32" + }, + { + "@level": "error", + "@message": "AutoFlex Expand; incompatible types", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.Int32Value]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperInt32", + "from": "Set[Int32]", + "to": 25 + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_protocol.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_protocol.golden new file mode 100644 index 000000000000..d946a9b1d21d --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_scalar_elements/single_protocol.golden @@ -0,0 +1,31 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/types.StringEnum[github.com/aws/aws-sdk-go-v2/service/cloudfront/types.SslProtocol]]", + "autoflex.target.type": "*github.com/aws/aws-sdk-go-v2/service/cloudfront/types.OriginSslProtocols" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/types.StringEnum[github.com/aws/aws-sdk-go-v2/service/cloudfront/types.SslProtocol]]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/aws/aws-sdk-go-v2/service/cloudfront/types.OriginSslProtocols" + }, + { + "@level": "error", + "@message": "AutoFlex Expand; incompatible types", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/types.StringEnum[github.com/aws/aws-sdk-go-v2/service/cloudfront/types.SslProtocol]]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/aws/aws-sdk-go-v2/service/cloudfront/types.OriginSslProtocols", + "from": { + "ElemType": {} + }, + "to": 25 + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/empty_set.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/empty_set.golden new file mode 100644 index 000000000000..825ba90e6934 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/empty_set.golden @@ -0,0 +1,18 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/null_set.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/null_set.golden new file mode 100644 index 000000000000..edc7d5bbce04 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/null_set.golden @@ -0,0 +1,27 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "trace", + "@message": "Expanding null value", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/single_item.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/single_item.golden new file mode 100644 index 000000000000..056691911dfb --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule1_struct_elements/single_item.golden @@ -0,0 +1,38 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.SetNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "debug", + "@message": "No corresponding field", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Name", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + }, + { + "@level": "debug", + "@message": "No corresponding field", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Value", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testStructItemModel", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperStruct" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/different_field_order.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/different_field_order.golden new file mode 100644 index 000000000000..f4485529ada8 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/different_field_order.golden @@ -0,0 +1,68 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2DifferentOrder" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2DifferentOrder" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Items", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Items", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2DifferentOrder" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Expanding with ElementsAs", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.size": 1, + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Enabled", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Enabled", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2DifferentOrder" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Enabled", + "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.BoolValue", + "autoflex.target.path": "Enabled", + "autoflex.target.type": "*bool" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/empty_items_enabled_false.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/empty_items_enabled_false.golden new file mode 100644 index 000000000000..d085d406a9be --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/empty_items_enabled_false.golden @@ -0,0 +1,68 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Items", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Items", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Expanding with ElementsAs", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.size": 0, + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Enabled", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Enabled", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Enabled", + "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.BoolValue", + "autoflex.target.path": "Enabled", + "autoflex.target.type": "*bool" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/null_block.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/null_block.golden new file mode 100644 index 000000000000..4b8f67fcb824 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/null_block.golden @@ -0,0 +1,27 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "trace", + "@message": "Expanding null value", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/with_items_enabled_true.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/with_items_enabled_true.golden new file mode 100644 index 000000000000..f7d3ada56cf0 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/expand_xmlwrapper_rule2/with_items_enabled_true.golden @@ -0,0 +1,68 @@ +[ + { + "@level": "info", + "@message": "Expanding", + "@module": "provider.autoflex", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model]", + "autoflex.target.path": "", + "autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Items", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Items", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Expanding with ElementsAs", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Items", + "autoflex.source.size": 1, + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListValueOf[github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue]", + "autoflex.target.path": "Items", + "autoflex.target.type": "[]string" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "Enabled", + "autoflex.source.path": "[0]", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testRule2Model", + "autoflex.target.fieldname": "Enabled", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.testXMLWrapperRule2" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "[0].Enabled", + "autoflex.source.type": "github.com/hashicorp/terraform-plugin-framework/types/basetypes.BoolValue", + "autoflex.target.path": "Enabled", + "autoflex.target.type": "*bool" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/int32_slice_to_set.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/empty_items.golden similarity index 58% rename from internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/int32_slice_to_set.golden rename to internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/empty_items.golden index 2fdb6ce9c50c..5e88352ba5cb 100644 --- a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/int32_slice_to_set.golden +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/empty_items.golden @@ -3,107 +3,110 @@ "@level": "info", "@message": "Flattening", "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten" + "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" }, { - "@level": "info", - "@message": "Converting", + "@level": "debug", + "@message": "Checking XML wrapper special case", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.sourceStruct", + "toType": "*flex.targetStruct" }, { - "@level": "trace", - "@message": "Converting entire XML wrapper struct to collection field", + "@level": "info", + "@message": "Converting", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "flex.awsStatusCodesForFlatten", - "autoflex.target.fieldname": "StatusCodes", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "wrapper_field": "items" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" }, { "@level": "trace", - "@message": "Starting XML wrapper flatten", + "@message": "Matched fields", "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "source_type": "flex.awsStatusCodesForFlatten", - "target_type": "SetTypeOf[basetypes.Int64Value]", - "wrapper_field": "items" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" }, { "@level": "trace", - "@message": "Found Items field", + "@message": "Converting pointer to XML wrapper struct to collection via wrapper tag", "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "items_is_nil": false, - "items_kind": "slice", - "items_len": 2, - "items_type": "[]int32" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "flexer_type": "*flex.autoFlattener", + "wrapper_field": "Items" }, { "@level": "trace", - "@message": "Using target element type", + "@message": "Starting XML wrapper flatten", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "element_type": "basetypes.Int64Type" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "source_type": "flex.testXMLWrapperScalar", + "target_type": "SetTypeOf[basetypes.StringValue]", + "wrapper_field": "Items" }, { "@level": "trace", - "@message": "Converting items to set elements", + "@message": "Found Items field", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "items_count": 2 + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "items_is_nil": false, + "items_kind": "slice", + "items_len": 0, + "items_type": "[]string" }, { "@level": "trace", - "@message": "Processing item", + "@message": "Using target element type", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "index": 0, - "item_kind": "int32", - "item_value": 400 + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "element_type": "basetypes.StringType" }, { "@level": "trace", - "@message": "Processing item", + "@message": "Converting items to set elements", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "index": 1, - "item_kind": "int32", - "item_value": 404 + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "items_count": 0, + "valid_count": 0 }, { "@level": "trace", "@message": "Creating set value", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsStatusCodesForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfStatusCodesModelForFlatten", - "element_count": 2, - "element_type": "basetypes.Int64Type" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "element_count": 0, + "element_type": "basetypes.StringType" } ] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/nil_source.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/nil_source.golden new file mode 100644 index 000000000000..d12728580df1 --- /dev/null +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/nil_source.golden @@ -0,0 +1,54 @@ +[ + { + "@level": "info", + "@message": "Flattening", + "@module": "provider.autoflex", + "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" + }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.sourceStruct", + "toType": "*flex.targetStruct" + }, + { + "@level": "info", + "@message": "Converting", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" + }, + { + "@level": "trace", + "@message": "Matched fields", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" + }, + { + "@level": "trace", + "@message": "Converting nil pointer to XML wrapper struct to null collection", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "wrapper_field": "Items" + } +] \ No newline at end of file diff --git a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/string_slice_to_list.golden b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/single_item.golden similarity index 60% rename from internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/string_slice_to_list.golden rename to internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/single_item.golden index a1b7a404ca0b..748a3b9df88a 100644 --- a/internal/framework/flex/testdata/autoflex/xml_compat/flatten_xmlwrapper/string_slice_to_list.golden +++ b/internal/framework/flex/testdata/autoflex/xml_wrapper/flatten_xmlwrapper_rule1_scalar_elements/single_item.golden @@ -3,52 +3,78 @@ "@level": "info", "@message": "Flattening", "@module": "provider.autoflex", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten" + "autoflex.source.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" + }, + { + "@level": "debug", + "@message": "Checking XML wrapper special case", + "@module": "provider.autoflex", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "isXMLWrapper": false, + "sourceKind": "struct", + "sourceType": "flex.sourceStruct", + "toType": "*flex.targetStruct" }, { "@level": "info", "@message": "Converting", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" }, { "@level": "trace", - "@message": "Converting entire XML wrapper struct to collection field", + "@message": "Matched fields", "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", "autoflex.source.path": "", - "autoflex.source.type": "flex.awsHeadersForFlatten", - "autoflex.target.fieldname": "Headers", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", - "wrapper_field": "items" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct" + }, + { + "@level": "trace", + "@message": "Converting pointer to XML wrapper struct to collection via wrapper tag", + "@module": "provider.autoflex", + "autoflex.source.fieldname": "XMLWrapper", + "autoflex.source.path": "", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", + "autoflex.target.fieldname": "XMLWrapper", + "autoflex.target.path": "", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "flexer_type": "*flex.autoFlattener", + "wrapper_field": "Items" }, { "@level": "trace", "@message": "Starting XML wrapper flatten", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", - "source_type": "flex.awsHeadersForFlatten", - "target_type": "ListTypeOf[basetypes.StringValue]", - "wrapper_field": "items" + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "source_type": "flex.testXMLWrapperScalar", + "target_type": "SetTypeOf[basetypes.StringValue]", + "wrapper_field": "Items" }, { "@level": "trace", "@message": "Found Items field", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", "items_is_nil": false, "items_kind": "slice", - "items_len": 2, + "items_len": 1, "items_type": "[]string" }, { @@ -56,63 +82,43 @@ "@message": "Using target element type", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", "element_type": "basetypes.StringType" }, { "@level": "trace", - "@message": "Converting items to list elements", + "@message": "Converting items to set elements", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", - "items_count": 2 + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "items_count": 1, + "valid_count": 1 }, { "@level": "trace", "@message": "Processing item", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", "index": 0, "item_kind": "string", - "item_value": "accept" + "item_value": "item1" }, { "@level": "trace", - "@message": "Processing item", + "@message": "Creating set value", "@module": "provider.autoflex", "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", + "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.sourceStruct", "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", - "index": 1, - "item_kind": "string", - "item_value": "content-type" - }, - { - "@level": "trace", - "@message": "Creating list value", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten", - "element_count": 2, + "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.targetStruct", + "element_count": 1, "element_type": "basetypes.StringType" - }, - { - "@level": "trace", - "@message": "Setting target list value", - "@module": "provider.autoflex", - "autoflex.source.path": "", - "autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsHeadersForFlatten", - "autoflex.target.path": "", - "autoflex.target.type": "*github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfHeadersModelForFlatten" } ] \ No newline at end of file diff --git a/internal/service/cloudfront/exports_test.go b/internal/service/cloudfront/exports_test.go index 2243d6a6f6fa..a279ead556a7 100644 --- a/internal/service/cloudfront/exports_test.go +++ b/internal/service/cloudfront/exports_test.go @@ -13,6 +13,7 @@ var ( ResourceFunction = resourceFunction ResourceKeyGroup = resourceKeyGroup ResourceMonitoringSubscription = resourceMonitoringSubscription + ResourceMultiTenantDistribution = newMultiTenantDistributionResource ResourceOriginAccessControl = resourceOriginAccessControl ResourceOriginAccessIdentity = resourceOriginAccessIdentity ResourceOriginRequestPolicy = resourceOriginRequestPolicy diff --git a/internal/service/cloudfront/multitenant_distribution.go b/internal/service/cloudfront/multitenant_distribution.go new file mode 100644 index 000000000000..860aef9c1621 --- /dev/null +++ b/internal/service/cloudfront/multitenant_distribution.go @@ -0,0 +1,1064 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package cloudfront + +import ( + "context" + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudfront" + awstypes "github.com/aws/aws-sdk-go-v2/service/cloudfront/types" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/int32default" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" + "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/internal/framework" + fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" + "github.com/hashicorp/terraform-provider-aws/internal/retry" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/names" +) + +const ( + defaultConnectionAttempts = 3 + defaultConnectionTimeout = 10 + defaultResponseCompletionTimeout = 30 + defaultOriginKeepaliveTimeout = 5 + defaultOriginReadTimeout = 30 +) + +// @FrameworkResource("aws_cloudfront_multitenant_distribution", name="Multi-tenant Distribution") +// @Tags(identifierAttribute="arn") +// +// Multi-tenant Distribution Limitations: +// The following fields are NOT supported for multi-tenant distributions and have been excluded from the schema: +// - CacheBehavior.DefaultTTL, MaxTTL, MinTTL (use cache policies instead) +// - CacheBehavior.SmoothStreaming +// - CacheBehavior.TrustedSigners (use TrustedKeyGroups instead) +// - DefaultCacheBehavior.DefaultTTL, MaxTTL, MinTTL (use cache policies instead) +// - DefaultCacheBehavior.SmoothStreaming +// - DefaultCacheBehavior.TrustedSigners (use TrustedKeyGroups instead) +// - DistributionConfig.Aliases (managed by connection groups) +// - DistributionConfig.AnycastIpListId (use connection group instead) +// - DistributionConfig.ContinuousDeploymentPolicyId +// - DistributionConfig.IsIPV6Enabled (use connection group instead) +// - DistributionConfig.PriceClass +// - DistributionConfig.Staging +// - CacheBehavior.ForwardedValues (deprecated and not supported) +// - DefaultCacheBehavior.ForwardedValues (deprecated and not supported) +// - ViewerCertificate.IAMCertificateId (use ACM certificates instead) +// +// Multi-tenant Distribution Requirements: +// - DistributionConfig.ConnectionMode is automatically set to "tenant-only" +// - DistributionConfig.TenantConfig must be specified (contains parameter definitions) +// - DistributionConfig.WebACLId must be a WAF V2 web ACL if specified +func newMultiTenantDistributionResource(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &multiTenantDistributionResource{} + + r.SetDefaultCreateTimeout(30 * time.Minute) + r.SetDefaultUpdateTimeout(30 * time.Minute) + r.SetDefaultDeleteTimeout(30 * time.Minute) + + return r, nil +} + +type multiTenantDistributionResource struct { + framework.ResourceWithModel[multiTenantDistributionResourceModel] + framework.WithImportByID + framework.WithTimeouts +} + +func (r *multiTenantDistributionResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { + // Semantic equality for origin set - compares by ID only to avoid empty vs null issues + originSemanticEquals := func(ctx context.Context, a, b fwtypes.NestedCollectionValue[originModel]) (bool, diag.Diagnostics) { + var diags diag.Diagnostics + + if a.Equal(b) { + return true, diags + } + + aSlice, d := a.ToSlice(ctx) + diags.Append(d...) + if diags.HasError() { + return false, diags + } + + bSlice, d := b.ToSlice(ctx) + diags.Append(d...) + if diags.HasError() { + return false, diags + } + + // Treat null as equal to empty + if a.IsNull() && len(bSlice) == 0 { + return true, diags + } + if b.IsNull() && len(aSlice) == 0 { + return true, diags + } + + // Compare by ID and domain_name only - ignore nested block empty vs null differences + if len(aSlice) != len(bSlice) { + return false, diags + } + + for i := range aSlice { + if !aSlice[i].ID.Equal(bSlice[i].ID) || !aSlice[i].DomainName.Equal(bSlice[i].DomainName) { + return false, diags + } + } + + return true, diags + } + + response.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + names.AttrARN: framework.ARNAttributeComputedOnly(), + names.AttrDomainName: schema.StringAttribute{Computed: true}, + "etag": schema.StringAttribute{Computed: true}, + names.AttrID: framework.IDAttribute(), + "in_progress_invalidation_batches": schema.Int32Attribute{Computed: true}, + "last_modified_time": schema.StringAttribute{ + CustomType: timetypes.RFC3339Type{}, + Computed: true, + }, + names.AttrStatus: schema.StringAttribute{Computed: true}, + "caller_reference": schema.StringAttribute{ + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + names.AttrComment: schema.StringAttribute{ + Required: true, + }, + "default_root_object": schema.StringAttribute{ + Optional: true, + }, + names.AttrEnabled: schema.BoolAttribute{ + Required: true, + }, + "http_version": schema.StringAttribute{ + Optional: true, + Computed: true, + CustomType: fwtypes.StringEnumType[awstypes.HttpVersion](), + }, + names.AttrTags: tftags.TagsAttribute(), + names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), + "web_acl_id": schema.StringAttribute{ + Optional: true, + // Note: For multi-tenant distributions, this must be a WAF V2 web ACL if specified + }, + }, + Blocks: map[string]schema.Block{ + "active_trusted_key_groups": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[activeTrustedKeyGroupsModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + names.AttrEnabled: schema.BoolAttribute{Computed: true}, + }, + Blocks: map[string]schema.Block{ + "items": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[kgKeyPairIDsModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "key_group_id": schema.StringAttribute{Computed: true}, + "key_pair_ids": schema.ListAttribute{ + CustomType: fwtypes.ListOfStringType, + Computed: true, + ElementType: types.StringType, + }, + }, + }, + }, + }, + }, + }, + "active_trusted_signers": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[activeTrustedSignersModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + names.AttrEnabled: schema.BoolAttribute{Computed: true}, + }, + Blocks: map[string]schema.Block{ + "items": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[signerModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "aws_account_number": schema.StringAttribute{Computed: true}, + "key_pair_ids": schema.ListAttribute{ + CustomType: fwtypes.ListOfStringType, + Computed: true, + ElementType: types.StringType, + }, + }, + }, + }, + }, + }, + }, + "alias_icp_recordals": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[aliasICPRecordalModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "cname": schema.StringAttribute{Computed: true}, + "icp_recordal_status": schema.StringAttribute{Computed: true}, + }, + }, + }, + "custom_error_response": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[customErrorResponseModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "error_caching_min_ttl": schema.Int64Attribute{ + Optional: true, + }, + "error_code": schema.Int64Attribute{ + Required: true, + }, + "response_code": schema.Int64Attribute{ + Optional: true, + }, + "response_page_path": schema.StringAttribute{ + Optional: true, + }, + }, + }, + }, + "cache_behavior": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[cacheBehaviorModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "cache_policy_id": schema.StringAttribute{ + Optional: true, + }, + "compress": schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + "field_level_encryption_id": schema.StringAttribute{ + Optional: true, + }, + "origin_request_policy_id": schema.StringAttribute{ + Optional: true, + }, + "path_pattern": schema.StringAttribute{ + Required: true, + }, + "realtime_log_config_arn": schema.StringAttribute{ + Optional: true, + }, + "response_headers_policy_id": schema.StringAttribute{ + Optional: true, + }, + "target_origin_id": schema.StringAttribute{ + Required: true, + }, + "viewer_protocol_policy": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.ViewerProtocolPolicy](), + }, + }, + Blocks: map[string]schema.Block{ + "allowed_methods": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[allowedMethodsModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "items": schema.SetAttribute{ + Required: true, + CustomType: fwtypes.SetOfStringEnumType[awstypes.Method](), + }, + "cached_methods": schema.SetAttribute{ + Required: true, + CustomType: fwtypes.SetOfStringEnumType[awstypes.Method](), + }, + }, + }, + }, + "function_association": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[functionAssociationModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "event_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.EventType](), + }, + names.AttrFunctionARN: schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + "lambda_function_association": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[lambdaFunctionAssociationModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "event_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.EventType](), + }, + "include_body": schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + "lambda_arn": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + "trusted_key_groups": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[trustedKeyGroupsModel](ctx), + Validators: []validator.List{ + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "items": schema.ListAttribute{ + Optional: true, + CustomType: fwtypes.ListOfStringType, + }, + names.AttrEnabled: schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "default_cache_behavior": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[defaultCacheBehaviorModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "cache_policy_id": schema.StringAttribute{ + Optional: true, + }, + "compress": schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + "field_level_encryption_id": schema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "origin_request_policy_id": schema.StringAttribute{ + Optional: true, + }, + "realtime_log_config_arn": schema.StringAttribute{ + Optional: true, + }, + "response_headers_policy_id": schema.StringAttribute{ + Optional: true, + }, + "target_origin_id": schema.StringAttribute{ + Required: true, + }, + "viewer_protocol_policy": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.ViewerProtocolPolicy](), + }, + }, + Blocks: map[string]schema.Block{ + "allowed_methods": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[allowedMethodsModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "items": schema.SetAttribute{ + Required: true, + CustomType: fwtypes.SetOfStringEnumType[awstypes.Method](), + }, + "cached_methods": schema.SetAttribute{ + Required: true, + CustomType: fwtypes.SetOfStringEnumType[awstypes.Method](), + }, + }, + }, + }, + "function_association": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[functionAssociationModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "event_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.EventType](), + }, + names.AttrFunctionARN: schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + "lambda_function_association": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[lambdaFunctionAssociationModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "event_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.EventType](), + }, + "include_body": schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + "lambda_arn": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + "trusted_key_groups": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[trustedKeyGroupsModel](ctx), + Validators: []validator.List{ + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "items": schema.ListAttribute{ + Optional: true, + CustomType: fwtypes.ListOfStringType, + }, + names.AttrEnabled: schema.BoolAttribute{ + Optional: true, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "origin": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[originModel](ctx, fwtypes.WithSemanticEqualityFunc(originSemanticEquals)), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "connection_attempts": schema.Int32Attribute{ + Optional: true, + Computed: true, + Default: int32default.StaticInt32(defaultConnectionAttempts), + }, + "connection_timeout": schema.Int32Attribute{ + Optional: true, + Computed: true, + Default: int32default.StaticInt32(defaultConnectionTimeout), + }, + names.AttrDomainName: schema.StringAttribute{ + Required: true, + }, + names.AttrID: schema.StringAttribute{ + Required: true, + }, + "origin_access_control_id": schema.StringAttribute{ + Optional: true, + }, + "origin_path": schema.StringAttribute{ + Optional: true, + }, + "response_completion_timeout": schema.Int32Attribute{ + Optional: true, + Computed: true, + Default: int32default.StaticInt32(defaultResponseCompletionTimeout), + }, + }, + Blocks: map[string]schema.Block{ + "custom_header": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[customHeaderModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "header_name": schema.StringAttribute{ + Required: true, + }, + "header_value": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + "custom_origin_config": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[customOriginConfigModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "http_port": schema.Int32Attribute{ + Required: true, + }, + "https_port": schema.Int32Attribute{ + Required: true, + }, + names.AttrIPAddressType: schema.StringAttribute{ + Optional: true, + CustomType: fwtypes.StringEnumType[awstypes.IpAddressType](), + }, + "origin_keepalive_timeout": schema.Int32Attribute{ + Optional: true, + Computed: true, + Default: int32default.StaticInt32(defaultOriginKeepaliveTimeout), + }, + "origin_read_timeout": schema.Int32Attribute{ + Optional: true, + Computed: true, + Default: int32default.StaticInt32(defaultOriginReadTimeout), + }, + "origin_protocol_policy": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.OriginProtocolPolicy](), + }, + "origin_ssl_protocols": schema.SetAttribute{ + Required: true, + CustomType: fwtypes.SetOfStringEnumType[awstypes.SslProtocol](), + }, + }, + }, + }, + "origin_shield": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[originShieldModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + names.AttrEnabled: schema.BoolAttribute{ + Required: true, + }, + "origin_shield_region": schema.StringAttribute{ + Optional: true, + }, + }, + }, + }, + "s3_origin_config": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[s3OriginConfigModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "origin_access_identity": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + }, + }, + }, + "origin_group": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[originGroupModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "origin_id": schema.StringAttribute{ + Required: true, + }, + }, + Blocks: map[string]schema.Block{ + "failover_criteria": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[failoverCriteriaModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "status_codes": schema.SetAttribute{ + Required: true, + ElementType: types.Int64Type, + }, + }, + }, + }, + "member": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[memberModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtLeast(2), + listvalidator.SizeAtMost(2), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "origin_id": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + }, + }, + }, + "restrictions": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[restrictionsModel](ctx), + Validators: []validator.List{ + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Blocks: map[string]schema.Block{ + "geo_restriction": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[geoRestrictionModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "items": schema.SetAttribute{ + Optional: true, + CustomType: fwtypes.SetOfStringType, + }, + "restriction_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.GeoRestrictionType](), + }, + }, + }, + }, + }, + }, + }, + "tenant_config": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[tenantConfigModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Blocks: map[string]schema.Block{ + "parameter_definition": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[parameterDefinitionModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + names.AttrName: schema.StringAttribute{ + Required: true, + }, + }, + Blocks: map[string]schema.Block{ + "definition": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[parameterDefinitionSchemaModel](ctx), + NestedObject: schema.NestedBlockObject{ + Blocks: map[string]schema.Block{ + "string_schema": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[stringSchemaConfigModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "required": schema.BoolAttribute{ + Required: true, + }, + names.AttrComment: schema.StringAttribute{ + Optional: true, + }, + names.AttrDefaultValue: schema.StringAttribute{ + Optional: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + names.AttrTimeouts: timeouts.Block(ctx, timeouts.Opts{ + Create: true, + Delete: true, + Update: true, + }), + "viewer_certificate": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[viewerCertificateModel](ctx), + Validators: []validator.List{ + listvalidator.IsRequired(), + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "acm_certificate_arn": schema.StringAttribute{ + Optional: true, + }, + "cloudfront_default_certificate": schema.BoolAttribute{ + Optional: true, + }, + "minimum_protocol_version": schema.StringAttribute{ + Optional: true, + Computed: true, + CustomType: fwtypes.StringEnumType[awstypes.MinimumProtocolVersion](), + }, + "ssl_support_method": schema.StringAttribute{ + Optional: true, + Computed: true, + CustomType: fwtypes.StringEnumType[awstypes.SSLSupportMethod](), + }, + }, + }, + }, + }, + } +} + +func (r *multiTenantDistributionResource) Create(ctx context.Context, request resource.CreateRequest, response *resource.CreateResponse) { + var data multiTenantDistributionResourceModel + response.Diagnostics.Append(request.Plan.Get(ctx, &data)...) + if response.Diagnostics.HasError() { + return + } + + conn := r.Meta().CloudFrontClient(ctx) + + input := &cloudfront.CreateDistributionWithTagsInput{ + DistributionConfigWithTags: &awstypes.DistributionConfigWithTags{ + DistributionConfig: &awstypes.DistributionConfig{}, + Tags: &awstypes.Tags{Items: []awstypes.Tag{}}, + }, + } + response.Diagnostics.Append(fwflex.Expand(ctx, data, input.DistributionConfigWithTags.DistributionConfig)...) + if response.Diagnostics.HasError() { + return + } + + // Set required computed fields that AutoFlex can't handle + input.DistributionConfigWithTags.DistributionConfig.CallerReference = aws.String(id.UniqueId()) + + // Set ConnectionMode to "tenant-only" to create a multi-tenant distribution instead of standard distribution + // This is the key field that distinguishes multi-tenant from standard distributions + input.DistributionConfigWithTags.DistributionConfig.ConnectionMode = awstypes.ConnectionModeTenantOnly + + if tags := getTagsIn(ctx); len(tags) > 0 { + input.DistributionConfigWithTags.Tags.Items = tags + } + + output, err := conn.CreateDistributionWithTags(ctx, input) + if err != nil { + response.Diagnostics.AddError("creating CloudFront Multi-tenant Distribution", err.Error()) + return + } + + // Set ID immediately + data.ID = types.StringValue(aws.ToString(output.Distribution.Id)) + data.ARN = types.StringValue(aws.ToString(output.Distribution.ARN)) + + // Wait for distribution to be deployed + distro, err := waitDistributionDeployed(ctx, conn, data.ID.ValueString()) + if err != nil { + response.State.SetAttribute(ctx, path.Root(names.AttrID), data.ID) // Set 'id' so as to taint the resource. + response.Diagnostics.AddError(fmt.Sprintf("waiting for CloudFront Multi-tenant Distribution (%s) create", data.ID.ValueString()), err.Error()) + return + } + + // Read the distribution to get consistent state + data.ETag = fwflex.StringToFramework(ctx, distro.ETag) + response.Diagnostics.Append(fwflex.Flatten(ctx, distro.Distribution.DistributionConfig, &data)...) + if response.Diagnostics.HasError() { + return + } + + response.Diagnostics.Append(fwflex.Flatten(ctx, distro.Distribution, &data)...) + if response.Diagnostics.HasError() { + return + } + + response.Diagnostics.Append(response.State.Set(ctx, &data)...) +} + +func (r *multiTenantDistributionResource) Read(ctx context.Context, request resource.ReadRequest, response *resource.ReadResponse) { + var data multiTenantDistributionResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { + return + } + + conn := r.Meta().CloudFrontClient(ctx) + + output, err := findDistributionByID(ctx, conn, data.ID.ValueString()) + if retry.NotFound(err) { + response.Diagnostics.AddWarning( + "CloudFront Multi-tenant Distribution not found", + fmt.Sprintf("CloudFront Multi-tenant Distribution (%s) not found, removing from state", data.ID.ValueString()), + ) + response.State.RemoveResource(ctx) + return + } + if err != nil { + response.Diagnostics.AddError("reading CloudFront Multi-tenant Distribution", err.Error()) + return + } + + response.Diagnostics.Append(fwflex.Flatten(ctx, output.Distribution, &data)...) + if response.Diagnostics.HasError() { + return + } + + response.Diagnostics.Append(fwflex.Flatten(ctx, output.Distribution.DistributionConfig, &data)...) + if response.Diagnostics.HasError() { + return + } + + response.Diagnostics.Append(response.State.Set(ctx, &data)...) +} + +func (r *multiTenantDistributionResource) Update(ctx context.Context, request resource.UpdateRequest, response *resource.UpdateResponse) { + var old, new multiTenantDistributionResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &old)...) + response.Diagnostics.Append(request.Plan.Get(ctx, &new)...) + if response.Diagnostics.HasError() { + return + } + + // For now, just set the new state - updates can be implemented later + response.Diagnostics.Append(response.State.Set(ctx, new)...) +} + +func (r *multiTenantDistributionResource) Delete(ctx context.Context, request resource.DeleteRequest, response *resource.DeleteResponse) { + var data multiTenantDistributionResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { + return + } + + conn := r.Meta().CloudFrontClient(ctx) + + input := cloudfront.DeleteDistributionInput{ + Id: data.ID.ValueStringPointer(), + IfMatch: data.ETag.ValueStringPointer(), + } + _, err := conn.DeleteDistribution(ctx, &input) + + if errs.IsA[*awstypes.NoSuchDistribution](err) { + return + } + + if err != nil { + response.Diagnostics.AddError("deleting CloudFront Multi-tenant Distribution", err.Error()) + return + } + + if _, err := waitDistributionDeleted(ctx, conn, data.ID.ValueString()); err != nil { + response.Diagnostics.AddError(fmt.Sprintf("waiting for CloudFront Multi-tenant Distribution (%s) delete", data.ID.ValueString()), err.Error()) + + return + } +} + +type multiTenantDistributionResourceModel struct { + ActiveTrustedKeyGroups fwtypes.ListNestedObjectValueOf[activeTrustedKeyGroupsModel] `tfsdk:"active_trusted_key_groups" autoflex:",xmlwrapper=Items"` + ActiveTrustedSigners fwtypes.ListNestedObjectValueOf[activeTrustedSignersModel] `tfsdk:"active_trusted_signers" autoflex:",xmlwrapper=Items"` + AliasICPRecordals fwtypes.ListNestedObjectValueOf[aliasICPRecordalModel] `tfsdk:"alias_icp_recordals"` + ARN types.String `tfsdk:"arn"` + CacheBehavior fwtypes.ListNestedObjectValueOf[cacheBehaviorModel] `tfsdk:"cache_behavior" autoflex:",xmlwrapper=Items"` + CallerReference types.String `tfsdk:"caller_reference"` + Comment types.String `tfsdk:"comment"` + CustomErrorResponse fwtypes.SetNestedObjectValueOf[customErrorResponseModel] `tfsdk:"custom_error_response" autoflex:",xmlwrapper=Items"` + DefaultCacheBehavior fwtypes.ListNestedObjectValueOf[defaultCacheBehaviorModel] `tfsdk:"default_cache_behavior"` + DefaultRootObject types.String `tfsdk:"default_root_object" autoflex:",omitempty"` + DomainName types.String `tfsdk:"domain_name"` + Enabled types.Bool `tfsdk:"enabled"` + ETag types.String `tfsdk:"etag"` + HTTPVersion fwtypes.StringEnum[awstypes.HttpVersion] `tfsdk:"http_version"` + ID types.String `tfsdk:"id"` + InProgressInvalidationBatches types.Int32 `tfsdk:"in_progress_invalidation_batches"` + LastModifiedTime timetypes.RFC3339 `tfsdk:"last_modified_time"` + Origin fwtypes.SetNestedObjectValueOf[originModel] `tfsdk:"origin" autoflex:",xmlwrapper=Items"` + OriginGroup fwtypes.SetNestedObjectValueOf[originGroupModel] `tfsdk:"origin_group" autoflex:",xmlwrapper=Items"` + Restrictions fwtypes.ListNestedObjectValueOf[restrictionsModel] `tfsdk:"restrictions"` + Status types.String `tfsdk:"status"` + Tags tftags.Map `tfsdk:"tags"` + TagsAll tftags.Map `tfsdk:"tags_all"` + TenantConfig fwtypes.ListNestedObjectValueOf[tenantConfigModel] `tfsdk:"tenant_config"` + Timeouts timeouts.Value `tfsdk:"timeouts"` + ViewerCertificate fwtypes.ListNestedObjectValueOf[viewerCertificateModel] `tfsdk:"viewer_certificate"` + WebACLID types.String `tfsdk:"web_acl_id" autoflex:",omitempty"` +} + +type originModel struct { + ConnectionAttempts types.Int32 `tfsdk:"connection_attempts"` + ConnectionTimeout types.Int32 `tfsdk:"connection_timeout"` + CustomHeader fwtypes.SetNestedObjectValueOf[customHeaderModel] `tfsdk:"custom_header" autoflex:",xmlwrapper=Items"` + CustomOriginConfig fwtypes.ListNestedObjectValueOf[customOriginConfigModel] `tfsdk:"custom_origin_config"` + DomainName types.String `tfsdk:"domain_name"` + ID types.String `tfsdk:"id"` + OriginAccessControlID types.String `tfsdk:"origin_access_control_id"` + OriginPath types.String `tfsdk:"origin_path"` + OriginShield fwtypes.ListNestedObjectValueOf[originShieldModel] `tfsdk:"origin_shield"` + ResponseCompletionTimeout types.Int32 `tfsdk:"response_completion_timeout"` + S3OriginConfig fwtypes.ListNestedObjectValueOf[s3OriginConfigModel] `tfsdk:"s3_origin_config"` +} + +type customHeaderModel struct { + HeaderName types.String `tfsdk:"header_name"` + HeaderValue types.String `tfsdk:"header_value"` +} + +type customOriginConfigModel struct { + HTTPPort types.Int32 `tfsdk:"http_port"` + HTTPSPort types.Int32 `tfsdk:"https_port"` + IPAddressType fwtypes.StringEnum[awstypes.IpAddressType] `tfsdk:"ip_address_type"` + OriginKeepaliveTimeout types.Int32 `tfsdk:"origin_keepalive_timeout"` + OriginReadTimeout types.Int32 `tfsdk:"origin_read_timeout"` + OriginProtocolPolicy fwtypes.StringEnum[awstypes.OriginProtocolPolicy] `tfsdk:"origin_protocol_policy"` + OriginSSLProtocols fwtypes.SetValueOf[fwtypes.StringEnum[awstypes.SslProtocol]] `tfsdk:"origin_ssl_protocols"` +} + +type originShieldModel struct { + Enabled types.Bool `tfsdk:"enabled"` + OriginShieldRegion types.String `tfsdk:"origin_shield_region"` +} + +type s3OriginConfigModel struct { + OriginAccessIdentity types.String `tfsdk:"origin_access_identity"` +} + +type originGroupModel struct { + FailoverCriteria fwtypes.ListNestedObjectValueOf[failoverCriteriaModel] `tfsdk:"failover_criteria"` + Member fwtypes.ListNestedObjectValueOf[memberModel] `tfsdk:"member" autoflex:",xmlwrapper=Items"` + OriginID types.String `tfsdk:"origin_id"` +} + +type failoverCriteriaModel struct { + StatusCodes fwtypes.SetValueOf[types.Int64] `tfsdk:"status_codes"` +} + +type memberModel struct { + OriginID types.String `tfsdk:"origin_id"` +} + +type defaultCacheBehaviorModel struct { + AllowedMethods fwtypes.ListNestedObjectValueOf[allowedMethodsModel] `tfsdk:"allowed_methods"` + CachePolicyID types.String `tfsdk:"cache_policy_id"` + Compress types.Bool `tfsdk:"compress"` + FieldLevelEncryptionID types.String `tfsdk:"field_level_encryption_id" autoflex:",omitempty"` + FunctionAssociation fwtypes.SetNestedObjectValueOf[functionAssociationModel] `tfsdk:"function_association" autoflex:",xmlwrapper=Items"` + LambdaFunctionAssociation fwtypes.SetNestedObjectValueOf[lambdaFunctionAssociationModel] `tfsdk:"lambda_function_association" autoflex:",xmlwrapper=Items"` + OriginRequestPolicyID types.String `tfsdk:"origin_request_policy_id"` + RealtimeLogConfigARN types.String `tfsdk:"realtime_log_config_arn"` + ResponseHeadersPolicyID types.String `tfsdk:"response_headers_policy_id"` + TargetOriginID types.String `tfsdk:"target_origin_id"` + TrustedKeyGroups fwtypes.ListNestedObjectValueOf[trustedKeyGroupsModel] `tfsdk:"trusted_key_groups" autoflex:",xmlwrapper=Items"` + ViewerProtocolPolicy fwtypes.StringEnum[awstypes.ViewerProtocolPolicy] `tfsdk:"viewer_protocol_policy"` + // Note: SmoothStreaming and TrustedSigners removed - not supported for multi-tenant distributions +} + +type allowedMethodsModel struct { + Items fwtypes.SetValueOf[fwtypes.StringEnum[awstypes.Method]] `tfsdk:"items"` + CachedMethods fwtypes.SetValueOf[fwtypes.StringEnum[awstypes.Method]] `tfsdk:"cached_methods" autoflex:",xmlwrapper=Items"` +} + +type cacheBehaviorModel struct { + AllowedMethods fwtypes.ListNestedObjectValueOf[allowedMethodsModel] `tfsdk:"allowed_methods"` + CachePolicyID types.String `tfsdk:"cache_policy_id"` + Compress types.Bool `tfsdk:"compress"` + FieldLevelEncryptionID types.String `tfsdk:"field_level_encryption_id" autoflex:",omitempty"` + FunctionAssociation fwtypes.SetNestedObjectValueOf[functionAssociationModel] `tfsdk:"function_association" autoflex:",xmlwrapper=Items"` + LambdaFunctionAssociation fwtypes.SetNestedObjectValueOf[lambdaFunctionAssociationModel] `tfsdk:"lambda_function_association" autoflex:",xmlwrapper=Items"` + OriginRequestPolicyID types.String `tfsdk:"origin_request_policy_id"` + PathPattern types.String `tfsdk:"path_pattern"` + RealtimeLogConfigARN types.String `tfsdk:"realtime_log_config_arn"` + ResponseHeadersPolicyID types.String `tfsdk:"response_headers_policy_id"` + TargetOriginID types.String `tfsdk:"target_origin_id"` + TrustedKeyGroups fwtypes.ListNestedObjectValueOf[trustedKeyGroupsModel] `tfsdk:"trusted_key_groups" autoflex:",xmlwrapper=Items"` + ViewerProtocolPolicy fwtypes.StringEnum[awstypes.ViewerProtocolPolicy] `tfsdk:"viewer_protocol_policy"` + // Note: SmoothStreaming and TrustedSigners removed - not supported for multi-tenant distributions +} + +type customErrorResponseModel struct { + ErrorCachingMinTtl types.Int64 `tfsdk:"error_caching_min_ttl"` + ErrorCode types.Int64 `tfsdk:"error_code"` + ResponseCode types.Int64 `tfsdk:"response_code"` + ResponsePagePath types.String `tfsdk:"response_page_path"` +} + +type restrictionsModel struct { + GeoRestriction fwtypes.ListNestedObjectValueOf[geoRestrictionModel] `tfsdk:"geo_restriction"` +} + +type geoRestrictionModel struct { + Items fwtypes.SetValueOf[types.String] `tfsdk:"items"` + RestrictionType fwtypes.StringEnum[awstypes.GeoRestrictionType] `tfsdk:"restriction_type"` +} + +type viewerCertificateModel struct { + ACMCertificateARN types.String `tfsdk:"acm_certificate_arn"` + CloudfrontDefaultCertificate types.Bool `tfsdk:"cloudfront_default_certificate"` + MinimumProtocolVersion fwtypes.StringEnum[awstypes.MinimumProtocolVersion] `tfsdk:"minimum_protocol_version"` + SSLSupportMethod fwtypes.StringEnum[awstypes.SSLSupportMethod] `tfsdk:"ssl_support_method"` +} + +type functionAssociationModel struct { + EventType fwtypes.StringEnum[awstypes.EventType] `tfsdk:"event_type"` + FunctionARN types.String `tfsdk:"function_arn"` +} + +type lambdaFunctionAssociationModel struct { + EventType fwtypes.StringEnum[awstypes.EventType] `tfsdk:"event_type"` + IncludeBody types.Bool `tfsdk:"include_body"` + LambdaARN types.String `tfsdk:"lambda_arn"` +} + +type tenantConfigModel struct { + ParameterDefinition fwtypes.ListNestedObjectValueOf[parameterDefinitionModel] `tfsdk:"parameter_definition"` +} + +type parameterDefinitionModel struct { + Name types.String `tfsdk:"name"` + Definition fwtypes.ListNestedObjectValueOf[parameterDefinitionSchemaModel] `tfsdk:"definition"` +} + +type parameterDefinitionSchemaModel struct { + StringSchema fwtypes.ListNestedObjectValueOf[stringSchemaConfigModel] `tfsdk:"string_schema"` +} + +type stringSchemaConfigModel struct { + Required types.Bool `tfsdk:"required"` + Comment types.String `tfsdk:"comment"` + DefaultValue types.String `tfsdk:"default_value"` +} + +type trustedKeyGroupsModel struct { + Items fwtypes.ListValueOf[types.String] `tfsdk:"items"` + Enabled types.Bool `tfsdk:"enabled"` +} + +type activeTrustedKeyGroupsModel struct { + Enabled types.Bool `tfsdk:"enabled"` + Items fwtypes.ListNestedObjectValueOf[kgKeyPairIDsModel] `tfsdk:"items"` +} + +type kgKeyPairIDsModel struct { + KeyGroupID types.String `tfsdk:"key_group_id"` + KeyPairIDs fwtypes.ListValueOf[types.String] `tfsdk:"key_pair_ids" autoflex:",xmlwrapper=Items"` +} + +type activeTrustedSignersModel struct { + Enabled types.Bool `tfsdk:"enabled"` + Items fwtypes.ListNestedObjectValueOf[signerModel] `tfsdk:"items"` +} + +type signerModel struct { + AWSAccountNumber types.String `tfsdk:"aws_account_number"` + KeyPairIDs fwtypes.ListValueOf[types.String] `tfsdk:"key_pair_ids" autoflex:",xmlwrapper=Items"` +} + +type aliasICPRecordalModel struct { + CNAME types.String `tfsdk:"cname"` + ICPRecordalStatus types.String `tfsdk:"icp_recordal_status"` +} diff --git a/internal/service/cloudfront/multitenant_distribution_test.go b/internal/service/cloudfront/multitenant_distribution_test.go new file mode 100644 index 000000000000..b192f061be92 --- /dev/null +++ b/internal/service/cloudfront/multitenant_distribution_test.go @@ -0,0 +1,169 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package cloudfront_test + +import ( + "context" + "fmt" + "testing" + + awstypes "github.com/aws/aws-sdk-go-v2/service/cloudfront/types" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + tfcloudfront "github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestAccCloudFrontMultiTenantDistribution_basic(t *testing.T) { + t.Parallel() + + ctx := acctest.Context(t) + var distribution awstypes.Distribution + resourceName := "aws_cloudfront_multitenant_distribution.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, names.CloudFrontEndpointID) }, + ErrorCheck: acctest.ErrorCheck(t, names.CloudFrontServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckMultiTenantDistributionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccMultiTenantDistributionConfig_basic(), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiTenantDistributionExists(ctx, resourceName, &distribution), + resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, "tenant_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "tenant_config.0.parameter_definition.0.definition.0.string_schema.0.required", acctest.CtTrue), + ), + }, + }, + }) +} + +func TestAccCloudFrontMultiTenantDistribution_disappears(t *testing.T) { + ctx := acctest.Context(t) + var distribution awstypes.Distribution + resourceName := "aws_cloudfront_multitenant_distribution.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, names.CloudFrontEndpointID) }, + ErrorCheck: acctest.ErrorCheck(t, names.CloudFrontServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckMultiTenantDistributionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccMultiTenantDistributionConfig_basic(), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiTenantDistributionExists(ctx, resourceName, &distribution), + acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfcloudfront.ResourceMultiTenantDistribution, resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func testAccCheckMultiTenantDistributionDestroy(ctx context.Context) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := acctest.Provider.Meta().(*conns.AWSClient).CloudFrontClient(ctx) + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_cloudfront_multitenant_distribution" { + continue + } + + _, err := tfcloudfront.FindDistributionByID(ctx, conn, rs.Primary.ID) + + if tfresource.NotFound(err) { + continue + } + + if err != nil { + return err + } + + return fmt.Errorf("CloudFront Multi-tenant Distribution %s still exists", rs.Primary.ID) + } + + return nil + } +} + +func testAccCheckMultiTenantDistributionExists(ctx context.Context, n string, v *awstypes.Distribution) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + conn := acctest.Provider.Meta().(*conns.AWSClient).CloudFrontClient(ctx) + + output, err := tfcloudfront.FindDistributionByID(ctx, conn, rs.Primary.ID) + + if err != nil { + return err + } + + *v = *output.Distribution + + return nil + } +} + +func testAccMultiTenantDistributionConfig_basic() string { + return ` +resource "aws_cloudfront_multitenant_distribution" "test" { + enabled = false + comment = "Test multi-tenant distribution" + + origin { + domain_name = "example.com" + id = "example" + + custom_origin_config { + http_port = 80 + https_port = 443 + origin_protocol_policy = "https-only" + origin_ssl_protocols = ["TLSv1.2"] + } + } + + default_cache_behavior { + target_origin_id = "example" + viewer_protocol_policy = "redirect-to-https" + cache_policy_id = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad" # AWS Managed CachingDisabled policy + + allowed_methods { + items = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"] + cached_methods = ["GET", "HEAD", "OPTIONS"] + } + } + + viewer_certificate { + cloudfront_default_certificate = true + } + + restrictions { + geo_restriction { + restriction_type = "none" + } + } + + tenant_config { + parameter_definition { + name = "origin_domain" + definition { + string_schema { + required = true + comment = "Origin domain parameter for tenants" + } + } + } + } +} +` +} diff --git a/internal/service/cloudfront/service_package_gen.go b/internal/service/cloudfront/service_package_gen.go index 1db1f6705adc..264671b24a4a 100644 --- a/internal/service/cloudfront/service_package_gen.go +++ b/internal/service/cloudfront/service_package_gen.go @@ -57,6 +57,15 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*inttypes.Ser WrappedImport: true, }, }, + { + Factory: newMultiTenantDistributionResource, + TypeName: "aws_cloudfront_multitenant_distribution", + Name: "Multi-tenant Distribution", + Tags: unique.Make(inttypes.ServicePackageResourceTags{ + IdentifierAttribute: names.AttrARN, + }), + Region: unique.Make(inttypes.ResourceRegionDisabled()), + }, { Factory: newVPCOriginResource, TypeName: "aws_cloudfront_vpc_origin",