Merge pull request #3777 from hashicorp/pr-3751
provider/aws: fix panic with SNS topic policy if omitted
This commit is contained in:
commit
68764e6def
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue