为什么当Terraform在文档中是有效的论点时,Terraform抱怨该论点没有被期望?

发布于 2025-02-03 07:22:59 字数 2217 浏览 4 评论 0原文

我试图将我的Azurerm提供商从2.9.9升级到3.5.0。我看到错误:

在这里不期望一个名为“ nesmenpace_id”的参数。

我的定义块是这样的:

module "example-module" {
  source = "../../../../modules/azure-topic"

  name                = "blabla"
  resourcegroup_name  = module.rg-infrastructure.name
  servicebus_name     = module.servicebus.servicebus_name
  namespace_id        = module.servicebus.id
  enable_partitioning = false
}

我正在使用自定义模块来创建此主题。在Azurerm的文档中,我看到namespace_id是必需的参数。我要做的是从2.9.9升级到3.5.0。 namespace_id始终需要,所以我不知道为什么我以前从未看过这个错误 - 只有当我实际升级Azurerm提供商时才出现。

我的主题模块如下:

main.tf

resource "azurerm_servicebus_topic" "example_topic" {
  count                     = var.count_value
  name                      = var.name
  namespace_id              = var.namespace_id
  namespace_name            = var.servicebus_name
  enable_partitioning       = var.enable_partitioning
  enable_batched_operations = var.enable_batched_operations
}

output.tf

output "subscription_name" {
  value = azurerm_servicebus_subscription.service_bus_subscription.name
}

output "subscription_id" {
  value = azurerm_servicebus_subscription.service_bus_subscription.id
}

variables.tf

variable "name" {
  type        = string
  description = "Subscription name"
}

variable "servicebus_name" {
  type        = string
  description = "Servicebus name"
}

variable "topic_name" {
  type        = string
  description = "Topic name"
}

variable "max_delivery_count" {
  type        = number
  description = "Maximum delivery count of the messages"
  default     = 3
}

variable "message_ttl" {
  type        = string
  description = "How long will the message live in the subscrption"
  default     = "P14D"
}

variable "message_lock_duration" {
  type        = string
  description = "Topic name"
  default     = "PT5M"
}

variable "enable_batched_operations" {
  type    = bool
  default = false
}

variable "topic_id" {
  type        = string
  description = "Topic id"
}

I am trying to upgrade my azurerm provider to 3.5.0 from 2.9.9. I am seeing the error:

An argument named "namespace_id" is not expected here.

My definition block is like this:

module "example-module" {
  source = "../../../../modules/azure-topic"

  name                = "blabla"
  resourcegroup_name  = module.rg-infrastructure.name
  servicebus_name     = module.servicebus.servicebus_name
  namespace_id        = module.servicebus.id
  enable_partitioning = false
}

I am using a custom module to create this topic. In the documentation for azurerm I see that namespace_id is a required argument. What I'm trying to do is upgrade from 2.9.9 to 3.5.0. The namespace_id has always been required so I don't know why I haven't seen this error before - it is only appearing when I actually upgrade the azurerm provider.

My topic module is as follows:

main.tf

resource "azurerm_servicebus_topic" "example_topic" {
  count                     = var.count_value
  name                      = var.name
  namespace_id              = var.namespace_id
  namespace_name            = var.servicebus_name
  enable_partitioning       = var.enable_partitioning
  enable_batched_operations = var.enable_batched_operations
}

output.tf

output "subscription_name" {
  value = azurerm_servicebus_subscription.service_bus_subscription.name
}

output "subscription_id" {
  value = azurerm_servicebus_subscription.service_bus_subscription.id
}

variables.tf

variable "name" {
  type        = string
  description = "Subscription name"
}

variable "servicebus_name" {
  type        = string
  description = "Servicebus name"
}

variable "topic_name" {
  type        = string
  description = "Topic name"
}

variable "max_delivery_count" {
  type        = number
  description = "Maximum delivery count of the messages"
  default     = 3
}

variable "message_ttl" {
  type        = string
  description = "How long will the message live in the subscrption"
  default     = "P14D"
}

variable "message_lock_duration" {
  type        = string
  description = "Topic name"
  default     = "PT5M"
}

variable "enable_batched_operations" {
  type    = bool
  default = false
}

variable "topic_id" {
  type        = string
  description = "Topic id"
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

︶ ̄淡然 2025-02-10 07:22:59

您的模块变量.tf文件未指定namesp_id作为输入变量,但是您在模块实例化中提供了一个。

Your module variables.tf file does not specify namespace_id as an input variable, but you are providing one on your module instantiation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文