Terraform中Snowflake通知集成资源被标记需替换[已解决]
问题:Terraform计划中Snowflake通知集成资源被强制替换且出现无关云厂商属性
- 未修改任何Terraform文件,执行
terraform plan时发现4个snowflake_notification_integration资源被标记为需要替换,所有资源均出现以下变更模式:
- direction = "INBOUND" -> null # forces replacement
- 每个资源还显示应用后会新增一批AWS/GCP相关属性:
aws_sns_external_id aws_sns_iam_user_arn aws_sqs_external_id aws_sqs_iam_user_arn gcp_pubsub_service_account
- 核心矛盾:我们仅使用Azure,完全未涉及AWS/GCP,且从主分支拉取全新分支后问题依旧,排除本地配置变更导致的问题。
计划输出示例
# module.integrations.snowflake_notification_integration.integration_1 must be replaced -/+ resource "snowflake_notification_integration" "integration_1" { + aws_sns_external_id = (known after apply) + aws_sns_iam_user_arn = (known after apply) + aws_sqs_external_id = (known after apply) + aws_sqs_iam_user_arn = (known after apply) ~ created_on = "2024-12-03T04:47:36.774-08:00" -> (known after apply) - direction = "INBOUND" -> null # forces replacement + gcp_pubsub_service_account = (known after apply) ~ id = "INTEGRATION_1DEV" -> (known after apply) name = "INTEGRATION_1DEV" # (6 unchanged attributes hidden) }
问题解决与更新
经排查,问题根源是资源定义中缺少必要参数——Snowflake Terraform Provider的部分原可选参数已变为必填项。
只需在资源定义中补全所有缺失参数即可彻底解决问题,示例配置如下:
resource "snowflake_notification_integration" "notification_integration1" { provider = snowflake.integrationmanager name = "NOTIFICATION_INTEGRATION1${local.env_suffix}" type = "QUEUE" direction = "INBOUND" # 之前计划中该属性被标记为移除 enabled = true notification_provider = "AZURE_STORAGE_QUEUE" # 显式指定Azure作为通知提供商 azure_storage_queue_primary_uri = local.internal_azure_storage_queue_primary_uri[local.env_lower] azure_tenant_id = local.azure_tenant_id comment = "a generic notification to cover multiple queues for internal data" }
目前暂未明确计划中出现AWS/GCP相关属性的具体原因,但显式配置所有必填参数后,问题已完全解决。
内容的提问来源于stack exchange,提问作者Knut M
相关产品推荐
相关产品推荐

