From 538327b61f0ea7852a9d3973430bb8bf324b51a1 Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczynski Date: Wed, 14 Sep 2016 12:33:52 +0100 Subject: [PATCH] Add JSON validation to the aws_sqs_queue resource. This commit adds support for new helper function which is used to normalise and validate JSON string. Signed-off-by: Krzysztof Wilczynski --- builtin/providers/aws/resource_aws_sqs_queue.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_sqs_queue.go b/builtin/providers/aws/resource_aws_sqs_queue.go index d40606883..22a1033e8 100644 --- a/builtin/providers/aws/resource_aws_sqs_queue.go +++ b/builtin/providers/aws/resource_aws_sqs_queue.go @@ -73,13 +73,18 @@ func resourceAwsSqsQueue() *schema.Resource { "policy": { Type: schema.TypeString, Optional: true, - DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, Computed: true, + ValidateFunc: validateJsonString, + DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "redrive_policy": { - Type: schema.TypeString, - Optional: true, - StateFunc: normalizeJson, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateJsonString, + StateFunc: func(v interface{}) string { + json, _ := normalizeJsonString(v) + return json + }, }, "arn": { Type: schema.TypeString,