File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,24 @@ func TestAccItemDataSource_DetectManualChanges(t *testing.T) {
334334 }
335335 bcRemoved := checks .BuildItemChecks ("data.onepassword_item.test_item" , removedAttrs )
336336 removedFieldsReadChecks = append (removedFieldsReadChecks , bcRemoved ... )
337- // Verify that username does not exist when fields are removed
338- removedFieldsReadChecks = append (removedFieldsReadChecks , resource .TestCheckNoResourceAttr ("data.onepassword_item.test_item" , "username" ))
337+
338+ // Verify that username is either not present (SDK) or empty (Connect)
339+ removedFieldsReadChecks = append (removedFieldsReadChecks , resource .TestCheckFunc (func (s * terraform.State ) error {
340+ item , ok := s .RootModule ().Resources ["data.onepassword_item.test_item" ]
341+ if ! ok {
342+ return fmt .Errorf ("resource not found in state" )
343+ }
344+
345+ username , exists := item .Primary .Attributes ["username" ]
346+ if exists {
347+ // If username exists, it should be empty (Connect behavior)
348+ if username != "" {
349+ return fmt .Errorf ("expected username to be empty or not present, got %q" , username )
350+ }
351+ }
352+ // If username doesn't exist, that's also valid (SDK behavior)
353+ return nil
354+ }))
339355
340356 resource .Test (t , resource.TestCase {
341357 ProtoV6ProviderFactories : testAccProtoV6ProviderFactories ,
You can’t perform that action at this time.
0 commit comments