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
m := v.(map[string]interface{})
authType := m["type"].(string)
authResource := m["resource"].(string)
buf.WriteString(fmt.Sprintf("%s-", m["type"].(string)))
buf.WriteString(fmt.Sprintf("%s-", authType))
buf.WriteString(fmt.Sprintf("%s-", authResource))
if m["resource"] != nil {
buf.WriteString(fmt.Sprintf("%s-", m["resource"].(string)))
}
return hashcode.String(buf.String())
}