Error while saving rule with Input Transformer: Invalid InputTemplate

1

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?
ma
asked 7 years ago3211 views
2 Answers
1
Accepted Answer

Hi Ma,

You were seeing this error message because CWE rule only allows users to use a String (with double quotes)

"Build failed <project>"

or a JSON in the input template.

{
  "Build failed": <project>
}

Edited by: yongataws on Aug 8, 2017 10:25 AM

AWS
answered 7 years ago
0

Thank you, I've added the double quotes and it works now!

ma
answered 7 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions