From 274781224ee8cb1b4b8c9f6dffa299201680fcc8 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 5 Nov 2015 15:25:04 -0600 Subject: [PATCH] provider/aws: fix panic with SNS topic policy if omitted --- builtin/providers/aws/resource_aws_sns_topic.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_sns_topic.go b/builtin/providers/aws/resource_aws_sns_topic.go index 26e98a9b1..b0d6fecf5 100644 --- a/builtin/providers/aws/resource_aws_sns_topic.go +++ b/builtin/providers/aws/resource_aws_sns_topic.go @@ -44,13 +44,12 @@ func resourceAwsSnsTopic() *schema.Resource { "policy": &schema.Schema{ Type: schema.TypeString, Optional: true, - ForceNew: false, Computed: true, StateFunc: func(v interface{}) string { - jsonb := []byte{} - if v != nil { - jsonb = []byte(v.(string)) + if v == nil { + return "" } + jsonb := []byte{} buffer := new(bytes.Buffer) if err := json.Compact(buffer, jsonb); err != nil { log.Printf("[WARN] Error compacting JSON for Policy in SNS Topic")