Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_connect_routing_profile - support delete #32540

Merged
Merged
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
3 changes: 3 additions & 0 deletions .changelog/32540.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_connect_routing_profile: add delete function
```
34 changes: 16 additions & 18 deletions internal/service/connect/routing_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func ResourceRoutingProfile() *schema.Resource {
CreateWithoutTimeout: resourceRoutingProfileCreate,
ReadWithoutTimeout: resourceRoutingProfileRead,
UpdateWithoutTimeout: resourceRoutingProfileUpdate,
// Routing profiles do not support deletion today. NoOp the Delete method.
// Users can rename their routing profiles manually if they want.
DeleteWithoutTimeout: schema.NoopContext,
DeleteWithoutTimeout: resourceRoutingProfileDelete,

Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
Expand Down Expand Up @@ -373,26 +371,26 @@ func updateQueueConfigs(ctx context.Context, conn *connect.Connect, instanceID,
return nil
}

// func resourceRoutingProfileDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
// conn := meta.(*conns.AWSClient).ConnectConn(ctx)
func resourceRoutingProfileDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
conn := meta.(*conns.AWSClient).ConnectConn(ctx)

// instanceID, routingProfileID, err := RoutingProfileParseID(d.Id())
instanceID, routingProfileID, err := RoutingProfileParseID(d.Id())

// if err != nil {
// return diag.FromErr(err)
// }
if err != nil {
return diag.FromErr(err)
}

// _, err = conn.DeleteRoutingProfileWithContext(ctx, &connect.DeleteRoutingProfileInput{
// InstanceId: aws.String(instanceID),
// RoutingProfileId: aws.String(routingProfileID),
// })
_, err = conn.DeleteRoutingProfileWithContext(ctx, &connect.DeleteRoutingProfileInput{
InstanceId: aws.String(instanceID),
RoutingProfileId: aws.String(routingProfileID),
})

// if err != nil {
// return diag.Errorf("deleting RoutingProfile (%s): %s", d.Id(), err)
// }
if err != nil {
return diag.Errorf("deleting RoutingProfile (%s): %s", d.Id(), err)
}

// return nil
// }
return nil
}

func expandRoutingProfileMediaConcurrencies(mediaConcurrencies []interface{}) []*connect.MediaConcurrency {
if len(mediaConcurrencies) == 0 {
Expand Down
2 changes: 0 additions & 2 deletions internal/service/connect/routing_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func testAccRoutingProfile_basic(t *testing.T) {
}

func testAccRoutingProfile_disappears(t *testing.T) {
t.Skip("Routing Profiles do not support deletion today")

ctx := acctest.Context(t)

var v connect.DescribeRoutingProfileOutput
Expand Down