在从 terraform 重新发布主题 aws iot core 中使用主题功能
Using topic function in republish topic aws iot core from terraform
我尝试使用 terraform 模块创建这样的物联网规则 https://github.com/QuiNovas/terraform-aws-iot-topic-rule
module "iot_rule_2" {
name = "xxx"
sql_query = "xxx"
source = "QuiNovas/iot-topic-rule/aws"
version = "1.0.4"
republish = [{topic = "$$aws/things/${topic(3)}/shadow/name/datamodel/update"}]
}
我得到了错误
Error: Call to unknown function
│
│ on main.tf line 52, in module "iot_rule_2":
│ 52: republish = [{topic = "$$aws/things/${topic(3)}/shadow/name/datamodel/update"}]
│
│ There is no function named "topic".
主题函数存在于 AWS https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html
好的,我找到了解决方案 - 我们应该在前面加上额外的 $.
module "iot_rule_2" {
name = "xxx"
sql_query = "xxx"
source = "QuiNovas/iot-topic-rule/aws"
version = "1.0.4"
republish = [{topic = "$$aws/things/$${topic(3)}/shadow/name/datamodel/update"}]
}
我尝试使用 terraform 模块创建这样的物联网规则 https://github.com/QuiNovas/terraform-aws-iot-topic-rule
module "iot_rule_2" {
name = "xxx"
sql_query = "xxx"
source = "QuiNovas/iot-topic-rule/aws"
version = "1.0.4"
republish = [{topic = "$$aws/things/${topic(3)}/shadow/name/datamodel/update"}]
}
我得到了错误
Error: Call to unknown function
│
│ on main.tf line 52, in module "iot_rule_2":
│ 52: republish = [{topic = "$$aws/things/${topic(3)}/shadow/name/datamodel/update"}]
│
│ There is no function named "topic".
主题函数存在于 AWS https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html
好的,我找到了解决方案 - 我们应该在前面加上额外的 $.
module "iot_rule_2" {
name = "xxx"
sql_query = "xxx"
source = "QuiNovas/iot-topic-rule/aws"
version = "1.0.4"
republish = [{topic = "$$aws/things/$${topic(3)}/shadow/name/datamodel/update"}]
}