terraform: ResourceConfig.Equal handles nil case

This commit is contained in:
Mitchell Hashimoto 2016-09-28 16:47:58 -07:00
parent f73dc844c7
commit 37f5c6ae26
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 5 additions and 0 deletions

View File

@ -115,6 +115,11 @@ func (c *ResourceConfig) DeepCopy() *ResourceConfig {
// Equal checks the equality of two resource configs. // Equal checks the equality of two resource configs.
func (c *ResourceConfig) Equal(c2 *ResourceConfig) bool { func (c *ResourceConfig) Equal(c2 *ResourceConfig) bool {
// If either are nil, then they're only equal if they're both nil
if c == nil || c2 == nil {
return c == c2
}
// Two resource configs if their exported properties are equal. // Two resource configs if their exported properties are equal.
// We don't compare "raw" because it is never used again after // We don't compare "raw" because it is never used again after
// initialization and for all intents and purposes they are equal // initialization and for all intents and purposes they are equal