Skip to content

Commit

Permalink
Merge pull request #3777 from hashicorp/pr-3751
Browse files Browse the repository at this point in the history
provider/aws: fix panic with SNS topic policy if omitted
  • Loading branch information
catsby committed Nov 10, 2015
2 parents 22f0f5f + 15533dc commit 68764e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions builtin/providers/aws/resource_aws_sns_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ func resourceAwsSnsTopic() *schema.Resource {
"policy": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: false,
Computed: true,
StateFunc: func(v interface{}) string {
jsonb := []byte(v.(string))
s, ok := v.(string)
if !ok || s == "" {
return ""
}
jsonb := []byte(s)
buffer := new(bytes.Buffer)
if err := json.Compact(buffer, jsonb); err != nil {
log.Printf("[WARN] Error compacting JSON for Policy in SNS Topic")
Expand Down

0 comments on commit 68764e6

Please sign in to comment.