为什么当Terraform在文档中是有效的论点时,Terraform抱怨该论点没有被期望?
我试图将我的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的模块变量.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.