From eb4fef1ca1a59a93df29b507a54c5f3f78e9d599 Mon Sep 17 00:00:00 2001 From: Hector Rivas Gandara Date: Tue, 5 Apr 2016 21:56:45 +0100 Subject: [PATCH] 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. --- builtin/providers/aws/resource_aws_cloudwatch_event_rule.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_cloudwatch_event_rule.go b/builtin/providers/aws/resource_aws_cloudwatch_event_rule.go index 341b2a305..b56591e8f 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_event_rule.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_event_rule.go @@ -213,7 +213,7 @@ func buildPutRuleInputStruct(d *schema.ResourceData) *events.PutRuleInput { input.Description = aws.String(v.(string)) } 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 { input.RoleArn = aws.String(v.(string))