From f85e0b72491037de1ae8dc6a134dfefed66f68c7 Mon Sep 17 00:00:00 2001 From: Masayuki Morita Date: Tue, 22 Nov 2016 20:35:15 +0900 Subject: [PATCH] Add JSON validation to the aws_iam_policy resource (#10239) Although the aws_iam_policy has a problem of normalization (refs #8350), I think it would be useful simply to add JSON syntax validation. I wasted a lot of time with JSON syntax errors. Validate the aws_iam_policy using the validateJsonString helper. --- builtin/providers/aws/resource_aws_iam_policy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_iam_policy.go b/builtin/providers/aws/resource_aws_iam_policy.go index 2a84d851a1d8..74a2fb71c61c 100644 --- a/builtin/providers/aws/resource_aws_iam_policy.go +++ b/builtin/providers/aws/resource_aws_iam_policy.go @@ -32,8 +32,9 @@ func resourceAwsIamPolicy() *schema.Resource { ForceNew: true, }, "policy": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateJsonString, }, "name": &schema.Schema{ Type: schema.TypeString,