0

我尝试使用 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

4

1 回答 1

0

好的,我找到了解决方案 - 我们应该在前面加上额外的 $。

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"}]
}
于 2021-05-27T13:37:23.727 回答