Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changelog/45540.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:bug
resource/aws_verifiedpermissions_identity_source: Fixes error when updating resource
```

```release-note:bug
resource/aws_verifiedpermissions_identity_source: Removes AutoFlex error log messages
```

```release-note:bug
resource/aws_verifiedpermissions_identity_source: Prevents eventual consistency error with associated Policy Store
```
16 changes: 12 additions & 4 deletions internal/framework/flex/autoflex_flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,10 +1245,8 @@ func (flattener autoFlattener) interfaceToNestedObject(ctx context.Context, vFro

vTo.Set(reflect.ValueOf(val))

tflog.SubsystemError(ctx, subsystemName, "AutoFlex Flatten; incompatible types", map[string]any{
"from": vFrom.Kind(),
"to": tTo,
})
tflog.SubsystemError(ctx, subsystemName, "Source does not implement flex.Flattener")
// diags.Append(diagFlatteningTargetDoesNotImplementFlexFlattener(reflect.TypeOf(vTo.Interface())))
return diags
}

Expand Down Expand Up @@ -2025,6 +2023,16 @@ func diagFlatteningTargetDoesNotImplementAttrValue(targetType reflect.Type) diag
)
}

// func diagFlatteningTargetDoesNotImplementFlexFlattener(targetType reflect.Type) diag.ErrorDiagnostic {
// return diag.NewErrorDiagnostic(
// "Incompatible Types",
// "An unexpected error occurred while flattening configuration. "+
// "This is always an error in the provider. "+
// "Please report the following to the provider developer:\n\n"+
// fmt.Sprintf("Target type %q does not implement flex.Flattener", fullTypeName(targetType)),
// )
// }

func diagFlatteningNoMapBlockKey(sourceType reflect.Type) diag.ErrorDiagnostic {
return diag.NewErrorDiagnostic(
"Incompatible Types",
Expand Down
11 changes: 4 additions & 7 deletions internal/framework/flex/autoflex_golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package flex
// go test -v -update-golden .

import (
"bytes"
"encoding/json"
"flag"
"fmt"
Expand All @@ -25,6 +24,7 @@ import (
"testing"

"github.com/YakDriver/regexache"
"github.com/google/go-cmp/cmp"
)

var updateGolden = flag.Bool("update-golden", false, "update golden files")
Expand Down Expand Up @@ -106,13 +106,10 @@ func compareWithGolden(t *testing.T, goldenPath string, got any) {

// Read and compare with existing golden file
want := readGolden(t, goldenPath)
if bytes.Equal(bytes.TrimSpace(want), bytes.TrimSpace(data)) {
return // Files match, test passes
}

// Files differ, fail the test with detailed output
t.Fatalf("comparison failed for golden file %s\nExpected content from: %s\nActual content:\n%s",
goldenPath, goldenPath, string(data))
if diff := cmp.Diff(data, want); diff != "" {
t.Fatalf("comparison failed for golden file %s\n%s", goldenPath, diff)
}
}

// autoGenerateGoldenPath creates a golden file path from test name and case description.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,11 @@
},
{
"@level": "error",
"@message": "AutoFlex Flatten; incompatible types",
"@message": "Source does not implement flex.Flattener",
"@module": "provider.autoflex",
"autoflex.source.path": "Field1",
"autoflex.source.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/flex.awsInterfaceInterface",
"autoflex.target.path": "Field1",
"autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]",
"from": 20,
"to": {
"ElemType": {
"AttrTypes": {
"field1": {}
}
}
}
"autoflex.target.type": "github.com/hashicorp/terraform-provider-aws/internal/framework/types.ListNestedObjectValueOf[github.com/hashicorp/terraform-provider-aws/internal/framework/flex.tfSingleStringField]"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@
"element_count": 2,
"element_type": "ObjectTypeOf[flex.FunctionAssociationTF]"
}
]
]
Loading
Loading