gpt4 book ai didi

azure - 如何将map(list(string)和map(string)定义为单个变量 block 中的变量类型?

转载 作者:行者123 更新时间:2023-12-03 03:28:10 26 4
gpt4 key购买 nike

对于 azure cdn,我希望添加规则引擎/交付规则,因此在名为 request_scheme_condition 的 block 之一中包含两个参数:ma​​tch_value & 运算符这里的match_value需要字符串列表,而运算符只需要字符串。

variable "delivery_rules" {
default = {
name = "test"
order = 1
request_scheme_condition = {
match_value = ["HTTP"]

operator = "Equal"
}
}

type = object(
{
name = string
order = number
request_scheme_condition = map(list(string))

}
)

}
error: 
│ Error: Invalid default value for variable

│ on variables.tf line 92, in variable "delivery_rules":
│ 92: default = {
│ 93: name = "test"
│ 94: order = 1
│ 95: request_scheme_condition = {
│ 96: match_value = "HTTP"
│ 97:
│ 98: operator = "Equal"
│ 99: }
│ 100: }

│ This default value is not compatible with the variable's type constraint: attribute "request_scheme_condition": element "

最佳答案

您再次需要对象,而不是map(list(string)):

variable "delivery_rules" {
default = {
name = "test"
order = 1
request_scheme_condition = {
match_value = ["HTTP"]
operator = "Equal"
}
}

type = object(
{
name = string
order = number
request_scheme_condition = object({
match_value = list(string)
operator = string
})
})
}

关于azure - 如何将map(list(string)和map(string)定义为单个变量 block 中的变量类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75281077/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com