Skip to content

Commit

Permalink
Merge pull request #32538 from GlennChia/f-aws_connect_queue-delete
Browse files Browse the repository at this point in the history
r/aws_connect_queue - support delete
  • Loading branch information
johnsonaj authored Jul 18, 2023
2 parents c2271cf + f357f93 commit 2ff432c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/32538.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_connect_queue: add delete function
```
25 changes: 22 additions & 3 deletions internal/service/connect/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func ResourceQueue() *schema.Resource {
CreateWithoutTimeout: resourceQueueCreate,
ReadWithoutTimeout: resourceQueueRead,
UpdateWithoutTimeout: resourceQueueUpdate,
// Queues do not support deletion today. NoOp the Delete method.
// Users can rename their queues manually if they want.
DeleteWithoutTimeout: schema.NoopContext,
DeleteWithoutTimeout: resourceQueueDelete,

Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
Expand Down Expand Up @@ -346,6 +344,27 @@ func resourceQueueUpdate(ctx context.Context, d *schema.ResourceData, meta inter
return resourceQueueRead(ctx, d, meta)
}

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

instanceID, queueID, err := QueueParseID(d.Id())

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

_, err = conn.DeleteQueueWithContext(ctx, &connect.DeleteQueueInput{
InstanceId: aws.String(instanceID),
QueueId: aws.String(queueID),
})

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

return nil
}

func expandOutboundCallerConfig(outboundCallerConfig []interface{}) *connect.OutboundCallerConfig {
if len(outboundCallerConfig) == 0 || outboundCallerConfig[0] == nil {
return nil
Expand Down
2 changes: 0 additions & 2 deletions internal/service/connect/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ func testAccQueue_basic(t *testing.T) {
}

func testAccQueue_disappears(t *testing.T) {
t.Skip("Queues do not support deletion today")

ctx := acctest.Context(t)

var v connect.DescribeQueueOutput
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/connect_queue.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ description: |-
Provides an Amazon Connect Queue resource. For more information see
[Amazon Connect: Getting Started](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-get-started.html)

~> **NOTE:** Due to The behaviour of Amazon Connect you cannot delete queues.

## Example Usage

### Basic
Expand Down

0 comments on commit 2ff432c

Please sign in to comment.