diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index 2db1752d114..e0ba5134dac 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -835,7 +835,12 @@ func resourceAwsCodeBuildProjectEnvironmentHash(v interface{}) int { for _, e := range environmentVariables { if e != nil { // Old statefiles might have nil values in them ev := e.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s:%s:%s-", ev["name"].(string), ev["type"].(string), ev["value"].(string))) + buf.WriteString(fmt.Sprintf("%s:", ev["name"].(string))) + // type is sometimes not returned by the API + if v, ok := ev["type"]; ok { + buf.WriteString(fmt.Sprintf("%s:", v.(string))) + } + buf.WriteString(fmt.Sprintf("%s-", ev["value"].(string))) } }