无法找到给定 ARN 的订阅

Unable to find subscription for given ARN

我正在使用 LocalStack 测试我的 AWS terraform 配置。最终目标是让队列听我的话题

我 运行ning Localstack 使用以下命令:

docker run --rm -it -p 4566:4566 localstack/localstack

在 运行 执行命令 terraform destroy 后,我收到错误消息:

aws_sns_topic_subscription.subscription: Destroying... [id=arn:aws:sns:us-east-1:000000000000:topic:a0d47652-3ae4-46df-9b63-3cb6e154cfcd]
╷
│ Error: error waiting for SNS topic subscription (arn:aws:sns:us-east-1:000000000000:topic:a0d47652-3ae4-46df-9b63-3cb6e154cfcd) deletion: InvalidParameter: Unable to find subscription for given ARN
│   status code: 400, request id: 2168e636
│
│
╵

我有 运行 针对真实 AWS 的代码没有问题。

这是 terraform 文件的代码

terraform {
  required_version = ">= 0.12.26"
}

provider "aws" {
  region                      = "us-east-1"
  s3_force_path_style         = true
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    sns            = "http://localhost:4566"
    sqs            = "http://localhost:4566"
  }
}

resource "aws_sqs_queue" "queue" {
  name = "queue"
}

resource "aws_sns_topic" "topic" {
  name = "topic"
}

resource "aws_sns_topic_subscription" "subscription" {
  endpoint = aws_sqs_queue.queue.arn
  protocol = "sqs"
  topic_arn = aws_sns_topic.topic.arn
}

遗憾的是,这是 AWS 的问题,您必须创建一个票证查看 here and

"When you delete a topic, subscriptions to the topic will not be "deleted" immediately, but become orphans. SNS will periodically clean these orphans, usually every 10 hours, but not guaranteed. If you create a new topic with the same topic name before these orphans are cleared up, the new topic will not inherit these orphans. So, no worry about them"

已解决以下问题:

https://github.com/localstack/localstack/issues/4022