aws provider: normalize json of cloudwatch event_pattern

Normalise the event_pattern of the aws_cloudwatch_event_rule resource

before uploading it to AWS.



AWS seems to accept a event_pattern with a JSON with new lines, but then

the rule does not seem to work. Creating the rule in the AWS console works,

but will setup the pattern  as a json without newlines or spaces, and

display a formatted JSON.
This commit is contained in:
Hector Rivas Gandara 2016-04-05 21:56:45 +01:00 committed by Paul Stack
parent 05d44fa8e0
commit eb4fef1ca1
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ func buildPutRuleInputStruct(d *schema.ResourceData) *events.PutRuleInput {
input.Description = aws.String(v.(string)) input.Description = aws.String(v.(string))
} }
if v, ok := d.GetOk("event_pattern"); ok { if v, ok := d.GetOk("event_pattern"); ok {
input.EventPattern = aws.String(v.(string)) input.EventPattern = aws.String(normalizeJson(v.(string)))
} }
if v, ok := d.GetOk("role_arn"); ok { if v, ok := d.GetOk("role_arn"); ok {
input.RoleArn = aws.String(v.(string)) input.RoleArn = aws.String(v.(string))