terraform-provider-awsaws-iot

AWS IoT built-in functions with Terraform


Quick question regarding IoT rules and Terraform :

I'm trying to create "aws_iot_topic_rule" resource, how can I interact with IoT built-in functions like topic ?

topic() docs - https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html#iot-function-topic

Something like :

resource "aws_iot_topic_rule" "rule" {
 ...

 kafka {
    ...
    key = "${sha1(topic(3))}"
  }
}

When trying something like that I get a Terraform error saying There is no function named "topic".

Thanks !


Solution

  • Apparently, having key as "$${sha1(topic(3))}" did the trick 🙂

    (terraform strings interpolation)