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

Terraform destroy fails on missing SQS queue #6497

Closed
joshgarnett opened this issue May 5, 2016 · 11 comments
Closed

Terraform destroy fails on missing SQS queue #6497

joshgarnett opened this issue May 5, 2016 · 11 comments

Comments

@joshgarnett
Copy link

When attempting to destroy an environment, I run into the following issue when an SQS queue is already missing. This does not appear to be an issue with other Amazon resources.

Terraform v0.6.15

Initialized blank state with remote state enabled!
Remote state configured and pulled.
...
Error refreshing state: 1 error(s) occurred:

* aws_sqs_queue.dead_letter: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
    status code: 400, request id: 9e8fc014-97e9-58f2-bf1d-8fb1d5a3c98d
ERROR [2016-05-05 08:44:00,050] - terraform destroy failed
@stack72
Copy link
Contributor

stack72 commented May 5, 2016

Hi @joshgarnett

apologies for the error here. Luckily, this has already been fixed in #6381 and will be released in 0.6.16

Thanks for the report

Paul

@jedi4ever
Copy link

hitting this again @stack72 with 0.7.0-rc3

Maybe it's because I had two sqs queues with the same "name =" attribute but different aws_sqs_queue ""

@stack72
Copy link
Contributor

stack72 commented Jul 26, 2016

Hi @jedi4ever

So I just tested this and didn't find the same issue:

resource "aws_sqs_queue" "queue-with-overrides" {
      name                       = "test-sqs-queue-with-overrides"
        delay_seconds              = 90
          max_message_size           = 2048
            message_retention_seconds  = 86400
              receive_wait_time_seconds  = 10
                visibility_timeout_seconds = 60

}

Terraform apply:

% terraform apply
provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value: us-west-2

aws_sqs_queue.queue-with-overrides: Creating...
  arn:                        "" => "<computed>"
  delay_seconds:              "" => "90"
  max_message_size:           "" => "2048"
  message_retention_seconds:  "" => "86400"
  name:                       "" => "test-sqs-queue-with-overrides"
  receive_wait_time_seconds:  "" => "10"
  visibility_timeout_seconds: "" => "60"
aws_sqs_queue.queue-with-overrides: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Deleted it from the console and then ran terraform destroy:

% terraform destroy
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value: us-west-2

aws_sqs_queue.queue-with-overrides: Refreshing state... (ID: https://sqs.us-west-2.amazonaws.com/187416307283/test-sqs-queue-with-overrides)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

As you can see, no error and it reported it didn't have to destroy anything. I am also using 0.7.0-RC3

I believe this may have been due to your specific scenario with 2 queues with the same name= attribute

Paul

@jedi4ever
Copy link

@stack72 thanks for testing. Isn't it useful TF would disable duplicate use of names in it's checks?

@stack72
Copy link
Contributor

stack72 commented Jul 26, 2016

@jedi4ever so the Delete step works as follows:

_, err := sqsconn.DeleteQueue(&sqs.DeleteQueueInput{
        QueueUrl: aws.String(d.Id()),
    })
    if err != nil {
        return err
    }
    return nil

The ID is a Queue URL e.g. https://REGION_ENDPOINT/queue.amazonaws.com/YOUR_ACCOUNT_NUMBER/YOUR_QUEUE_NAME

So, if there are 2 queues the same, then I think this is what the issue will be. When it tries to issue the delete, it sounds like it could be deleting 1 of 2 queues

P.

@jedi4ever
Copy link

@stack72 would you not consider this a bug ? or need to put a TF safe guard in place ?
and reopen this issue

@rpdelaney
Copy link

I'm having this issue when doing terraform destroy, also terraform refresh halts with the same output:

Error: Error refreshing state: 5 error(s) occurred:

* module.workers_sencha.data.aws_sqs_queue.workers: 1 error(s) occurred:

* module.workers_sencha.data.aws_sqs_queue.workers: data.aws_sqs_queue.workers: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: f5be323f-e207-5ccd-9d6b-66c707388e31
* module.workers_green.data.aws_sqs_queue.workers: 5 error(s) occurred:

* module.workers_green.data.aws_sqs_queue.workers[4]: data.aws_sqs_queue.workers.4: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: 64902e7c-58de-5ac4-b32a-7a84bde189e7
* module.workers_green.data.aws_sqs_queue.workers[2]: data.aws_sqs_queue.workers.2: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: cadce4cf-39e2-55e4-9998-b037dcdd3a28
* module.workers_green.data.aws_sqs_queue.workers[3]: data.aws_sqs_queue.workers.3: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: d2e9fb8f-068b-515b-bab0-af77e3b466eb
* module.workers_green.data.aws_sqs_queue.workers[0]: data.aws_sqs_queue.workers.0: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: 0cfb5a9e-ea67-572e-9630-0e660f588059
* module.workers_green.data.aws_sqs_queue.workers[1]: data.aws_sqs_queue.workers.1: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: 80c02ad6-a36e-51d6-84a9-7e2e46511dff
* module.workers_earlgrey.data.aws_sqs_queue.workers: 1 error(s) occurred:

* module.workers_earlgrey.data.aws_sqs_queue.workers: data.aws_sqs_queue.workers: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: 520fa7b4-05dd-5202-94f3-f34ce0e21620
* module.workers_rize.data.aws_sqs_queue.workers: 1 error(s) occurred:

* module.workers_rize.data.aws_sqs_queue.workers: data.aws_sqs_queue.workers: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: 61c3dba4-36de-5a9c-ac12-8f5cd3e1de07
* module.workers_yorkgold.data.aws_sqs_queue.workers: 1 error(s) occurred:

* module.workers_yorkgold.data.aws_sqs_queue.workers: data.aws_sqs_queue.workers: Error getting queue URL: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
        status code: 400, request id: f8a9521a-65e2-56e6-a497-06e280dd8714
$ terraform --version
Terraform v0.11.11
+ provider.archive v1.1.0
+ provider.aws v1.51.0
+ provider.null v1.0.0
+ provider.template v1.0.0

@rpdelaney
Copy link

rpdelaney commented Mar 6, 2019

I ended up creating the queues manually to get this unstuck. Still a bit confusing why I can't destroy because a resource is missing. Creating something so that I can destroy it with terraform seems... not right.

@mcayanan
Copy link

I'm running into this error as well when running Terraform destroy:

Error deleting SQS Queue policy: AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.
	status code: 400, request id: 02fc4a42-898c-5f83-b432-1cd06069a843

Interesting thing about this is that if I run Terraform destroy again, this error does not appear.

Does this issue need to be re-opened?

@rpdelaney
Copy link

@stack72

@ghost
Copy link

ghost commented Jan 11, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants