provider/aws: fix panic with SNS topic policy if omitted
This commit is contained in:
parent
87dd5c5bd0
commit
274781224e
|
@ -44,13 +44,12 @@ func resourceAwsSnsTopic() *schema.Resource {
|
||||||
"policy": &schema.Schema{
|
"policy": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: false,
|
|
||||||
Computed: true,
|
Computed: true,
|
||||||
StateFunc: func(v interface{}) string {
|
StateFunc: func(v interface{}) string {
|
||||||
jsonb := []byte{}
|
if v == nil {
|
||||||
if v != nil {
|
return ""
|
||||||
jsonb = []byte(v.(string))
|
|
||||||
}
|
}
|
||||||
|
jsonb := []byte{}
|
||||||
buffer := new(bytes.Buffer)
|
buffer := new(bytes.Buffer)
|
||||||
if err := json.Compact(buffer, jsonb); err != nil {
|
if err := json.Compact(buffer, jsonb); err != nil {
|
||||||
log.Printf("[WARN] Error compacting JSON for Policy in SNS Topic")
|
log.Printf("[WARN] Error compacting JSON for Policy in SNS Topic")
|
||||||
|
|
Loading…
Reference in New Issue