provider/aws: fix panic when user_data receives nil from StateFunc
This commit is contained in:
parent
0317120866
commit
e530eea226
|
@ -88,8 +88,13 @@ func resourceAwsInstance() *schema.Resource {
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
StateFunc: func(v interface{}) string {
|
StateFunc: func(v interface{}) string {
|
||||||
hash := sha1.Sum([]byte(v.(string)))
|
switch v.(type) {
|
||||||
return hex.EncodeToString(hash[:])
|
case string:
|
||||||
|
hash := sha1.Sum([]byte(v.(string)))
|
||||||
|
return hex.EncodeToString(hash[:])
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue