Skip to content

Commit

Permalink
Adding support for overrides containing an entire product
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
slevenick authored and modular-magician committed Jul 12, 2019
1 parent 6f80f68 commit 159cceb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions google/resource_compute_instance_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,7 @@ func resourceComputeInstanceTemplateSourceImageCustomizeDiff(diff *schema.Resour
for i := 0; i < numDisks; i++ {
key := fmt.Sprintf("disk.%d.source_image", i)
if diff.HasChange(key) {
// project must be retrieved once we know there is a diff to resolve, otherwise it will
// attempt to retrieve project during `plan` before all calculated fields are ready
// see https://github.com/terraform-providers/terraform-provider-google/issues/2878
project, err := getProjectFromDiff(diff, config)
if err != nil {
return err
}
var err error
old, new := diff.GetChange(key)
if old == "" || new == "" {
// no sense in resolving empty strings
Expand All @@ -499,6 +493,13 @@ func resourceComputeInstanceTemplateSourceImageCustomizeDiff(diff *schema.Resour
}
continue
}
// project must be retrieved once we know there is a diff to resolve, otherwise it will
// attempt to retrieve project during `plan` before all calculated fields are ready
// see https://github.com/terraform-providers/terraform-provider-google/issues/2878
project, err := getProjectFromDiff(diff, config)
if err != nil {
return err
}
oldResolved, err := resolveImage(config, project, old.(string))
if err != nil {
return err
Expand Down

0 comments on commit 159cceb

Please sign in to comment.