I have an Event Streams instance called myKafka
(with an appropriate topic called myTopic
) and an IBM Cloud Function action called myAction
. I want to trigger the myAction
when a message arrived on myKafka
's topic. I have to write this relation in terrafrom. I have checked this documentation but it only shows examples for alarm trigger and not based on Event Streams. So my question is how to create it with terrafom?
I am trying with the following:
resource "ibm_function_trigger" "myTrigger" {
name = "myTrigger"
namespace = "myNameSpace"
feed {
name = "???"
parameters = <<EOF
[
{
"key":"???",
"value":"???"
},
{
"key":"???",
"value":"???"
}
]
EOF
}
}
I don't really know what should I put into the question marks' place. I expect the myKafka
instance and myTopic
should be passed with the myAction
but could not determine the feed's name and keys with appropriate values.
I finally made it with this configuration:
resource "ibm_function_trigger" "myTrigger" {
name = "myTrigger"
namespace = "myNameSpace"
feed {
name = "/whisk.system/messaging/messageHubFeed"
parameters = <<EOF
[
{
"key":"kafka_brokers_sasl",
"value":<MY_KAFKA_BROKERS_SASL>
},
{
"key":"user",
"value":"<MY_USERNAME>"
},
{
"key":"password",
"value":"<MY_PASSWORD>"
},
{
"key":"topic",
"value":"myTopic"
},
{
"key":"kafka_admin_url",
"value":"<MY_KAFKA_ADMIN_URL>"
}
]
EOF
}
}
The keys and /whisk.system/messaging/messageHubFeed
are important.