Fix panic I see when upgrading to 0.6.6
Check if the policy is nil or not before type casting it
This commit is contained in:
parent
9e9d4b2c72
commit
87dd5c5bd0
|
@ -47,7 +47,10 @@ func resourceAwsSnsTopic() *schema.Resource {
|
||||||
ForceNew: false,
|
ForceNew: false,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
StateFunc: func(v interface{}) string {
|
StateFunc: func(v interface{}) string {
|
||||||
jsonb := []byte(v.(string))
|
jsonb := []byte{}
|
||||||
|
if v != nil {
|
||||||
|
jsonb = []byte(v.(string))
|
||||||
|
}
|
||||||
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