Reputation: 979
Goal: I want to trigger notification to slack on any phase change in codebuild. I have a lambda that does for me and it expects a request as follows:
{
"channel":"#XYZ",
"message":"TESTING <project_name> from <build-status> to <current-phase>"
}
So I try create a event from cloudwatch events and trigger my lambda:
So I try to use Input Transformer
In which the place holders are values of input path from cloudwatch
{
"project_name": "$.detail.project-name",
"current-phase": "$.detail.current-phase",
"build-status": "$.detail.build-status",
}
But on adding this i get the error
There was an error while saving rule input_transformer_test. Details: InputTemplate for target Id64936775145825 contains placeholder within quotes..
What am i doing wrong here ?
Upvotes: 3
Views: 6989
Reputation: 1
Since this is json, you dont need to put the values in quotes.
Only string notations needs to be put in quotes.
Upvotes: 0
Reputation: 346
<project_name>, <build-status>, <current-phase>
needed to be passed as separate values. You cannot use them for string interpolation. [doc]
You will need to modify you lambda input format and construct your message inside the lambda function.
{
"channel":"#XYZ",
"project_name": <project_name>,
"current-phase": <current-phase>,
"build-status": <build-status>
}
Upvotes: 4