提问人:user3683706 提问时间:10/31/2023 更新时间:10/31/2023 访问量:30
Terraform 销毁在删除依赖资源之前删除提供程序
Terraform destroy removes provider before removing dependent resource
问:
背景: 我正在努力销毁 AWS 中包含跨域依赖项的功能分支(us-west-2 部署依赖项对 us-east-1 资源)该项目依赖于本地区域 SQS 队列的 SNS 主题订阅,因此我添加了一个 us-east-1 提供程序以允许部署完成而不会出错。
问题: 当不再需要功能分支时,我想对创建的 AWS 资源(lambda、queue 和 east-1 主题订阅)执行 terraform 销毁,但 tf 错误并出现以下错误:
│ Error: Provider configuration not present
│
│ To work with aws_sns_topic_subscription.els_event_subscription (orphan) its
│ original provider configuration at
│ provider["registry.terraform.io/hashicorp/aws"].sns2sqs is required, but it
│ has been removed. This occurs when a provider configuration is removed
│ while objects created by that provider still exist in the state. Re-add the
│ provider configuration to destroy
│ aws_sns_topic_subscription.els_event_subscription (orphan), after which you
│ can remove the provider configuration again.
terraform 代码
provider "aws" {
alias = "sns2sqs"
region = "us-east-1"
default_tags {
tags = {
"<some-tags>" = ""
}
}
ignore_tags {
key_prefixes = ["<some_prefix>"]
}
}
# The failing topic subscription
resource "aws_sns_topic_subscription" "els_event_subscription" {
provider = aws.sns2sqs
topic_arn = "${var.environment}" == "prod" ? "${var.els_sns_topics["prod"]}" : "${var.els_sns_topics["dev"]}"
protocol = "sqs"
endpoint = "${some-endpoint.arn}"
endpoint_auto_confirms = true
filter_policy = jsonencode(var.event_filter_policy)
}
答: 暂无答案
评论
terraform destroy
provider
provider
terraform destroy