provider/aws: Prevent panic when setting AWS CodeBuild Source to state (#12915)

Fixes: #12914

this is just a simple guard clause to prevent the hash from including an
optional value by default
This commit is contained in:
Paul Stack 2017-03-21 15:33:32 +00:00 committed by GitHub
parent b7152c4405
commit f0e7bc942b
1 changed files with 4 additions and 4 deletions

View File

@ -592,11 +592,11 @@ func resourceAwsCodeBuildProjectSourceAuthHash(v interface{}) int {
var buf bytes.Buffer var buf bytes.Buffer
m := v.(map[string]interface{}) m := v.(map[string]interface{})
authType := m["type"].(string) buf.WriteString(fmt.Sprintf("%s-", m["type"].(string)))
authResource := m["resource"].(string)
buf.WriteString(fmt.Sprintf("%s-", authType)) if m["resource"] != nil {
buf.WriteString(fmt.Sprintf("%s-", authResource)) buf.WriteString(fmt.Sprintf("%s-", m["resource"].(string)))
}
return hashcode.String(buf.String()) return hashcode.String(buf.String())
} }