Skip to content

Commit

Permalink
testAccCheckCustomModelDestroy: Check for deleted custom model.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Feb 1, 2024
1 parent e8b5f39 commit f5c1165
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/service/bedrock/custom_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func testAccCheckCustomModelDestroy(ctx context.Context) resource.TestCheckFunc
continue
}

_, err := tfbedrock.FindModelCustomizationJobByID(ctx, conn, rs.Primary.ID)
output, err := tfbedrock.FindModelCustomizationJobByID(ctx, conn, rs.Primary.ID)

if tfresource.NotFound(err) {
continue
Expand All @@ -311,6 +311,19 @@ func testAccCheckCustomModelDestroy(ctx context.Context) resource.TestCheckFunc
return err
}

// Check the custom model.
if modelARN := aws.ToString(output.OutputModelArn); modelARN != "" {
_, err := tfbedrock.FindCustomModelByID(ctx, conn, modelARN)

if tfresource.NotFound(err) {
continue
}

if err != nil {
return err
}
}

return fmt.Errorf("Bedrock Custom Model %s still exists", rs.Primary.ID)
}

Expand Down
1 change: 1 addition & 0 deletions internal/service/bedrock/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var (
ResourceCustomModel = newCustomModelResource
ResourceModelInvocationLoggingConfiguration = newResourceModelInvocationLoggingConfiguration

FindCustomModelByID = findCustomModelByID
FindModelCustomizationJobByID = findModelCustomizationJobByID
WaitModelCustomizationJobCompleted = waitModelCustomizationJobCompleted
)

0 comments on commit f5c1165

Please sign in to comment.