Use the project defined in the trigger_template when creating trigger (#1556)

When creating a trigger by using the project defined in the schema we
enforce that the repo must be in that same project. We should be looking
at the project defined in the trigger_template data and falling back to
that first project if not found.

Closes: #1555
This commit is contained in:
Jamie Lennox 2018-05-30 04:38:12 +10:00 committed by Vincent Roseberry
parent cdcda8384a
commit cd83bab7dc

View File

@ -191,7 +191,7 @@ func expandCloudbuildBuildTriggerTemplate(d *schema.ResourceData, project string
return nil
}
tmpl := &cloudbuild.RepoSource{}
if v, ok := d.GetOk("project"); ok {
if v, ok := d.GetOk("trigger_template.0.project"); ok {
tmpl.ProjectId = v.(string)
} else {
tmpl.ProjectId = project