I have set up CloudWatch rule that would post a message to SNS on CloudBuild project failure.
I wanted to use new Input Transformer feature to craft an email message based on JSON event data.
Here is a sample event:
{
"version": "0",
"id": "1cb6e284-2c0a-4b4d-95f2-7dc042733d11",
"detail-type": "CodeBuild Build State Change",
"source": "aws.codebuild",
"account": "123456789012",
"time": "2017-07-12T00:42:28Z",
"region": "us-east-1",
"resources": [
"arn:aws:codebuild:us-east-1:123456789012:build/SampleProjectName:a68ca311-846f-4ca4-b606-ae36de59542b"
],
"detail": {
"build-status": "FAILED",
"project-name": "SampleProjectName",
"build-id": "arn:aws:codebuild:us-east-1:123456789012:build/SampleProjectName:a68ca311-846f-4ca4-b606-ae36de59542b",
"current-phase": "COMPLETED",
"current-phase-context": "[]",
"version": "1"
}
}
Here is my input path
{
"project": "$.detail.project-name"
}
and input template
Build failed <project
>```
I'm getting the following error upon saving the rule
-----
There was an error while saving rule **failed-build**.
Details: **Invalid InputTemplate for target Id38459876381764 : \\[Source: Build failed null; line: 1, column: 6\]..**
Could you please share your events and templates and/or pinpoint an error in mine?