Skip to content

Commit 9a7d28b

Browse files
Added NestedQuery handling to PostCreateSetComputedFields (#13692) (#22387)
[upstream:53765df79fccbb2714c4593a4470af4e88480153] Signed-off-by: Modular Magician <[email protected]>
1 parent d678a9e commit 9a7d28b

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

google/services/bigqueryreservation/resource_bigquery_reservation_assignment.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,16 @@ func resourceBigqueryReservationReservationAssignmentFindNestedObjectInList(d *s
412412
}
413413
func resourceBigqueryReservationReservationAssignmentPostCreateSetComputedFields(d *schema.ResourceData, meta interface{}, res map[string]interface{}) error {
414414
config := meta.(*transport_tpg.Config)
415+
if _, ok := res["assignments"]; ok {
416+
res, err := flattenNestedBigqueryReservationReservationAssignment(d, meta, res)
417+
if err != nil {
418+
return fmt.Errorf("Error getting nested object from operation response: %s", err)
419+
}
420+
if res == nil {
421+
// Object isn't there any more - remove it from the state.
422+
return fmt.Errorf("Error decoding response from operation, could not find nested object")
423+
}
424+
}
415425
if err := d.Set("name", flattenNestedBigqueryReservationReservationAssignmentName(res["name"], d, config)); err != nil {
416426
return fmt.Errorf(`Error setting computed identity field "name": %s`, err)
417427
}

google/services/datacatalog/resource_data_catalog_tag.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,16 @@ func resourceDataCatalogTagFindNestedObjectInList(d *schema.ResourceData, meta i
695695
}
696696
func resourceDataCatalogTagPostCreateSetComputedFields(d *schema.ResourceData, meta interface{}, res map[string]interface{}) error {
697697
config := meta.(*transport_tpg.Config)
698+
if _, ok := res["tags"]; ok {
699+
res, err := flattenNestedDataCatalogTag(d, meta, res)
700+
if err != nil {
701+
return fmt.Errorf("Error getting nested object from operation response: %s", err)
702+
}
703+
if res == nil {
704+
// Object isn't there any more - remove it from the state.
705+
return fmt.Errorf("Error decoding response from operation, could not find nested object")
706+
}
707+
}
698708
if err := d.Set("name", flattenNestedDataCatalogTagName(res["name"], d, config)); err != nil {
699709
return fmt.Errorf(`Error setting computed identity field "name": %s`, err)
700710
}

google/services/resourcemanager/resource_resource_manager_lien.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,16 @@ func resourceResourceManagerLienPostCreateSetComputedFields(d *schema.ResourceDa
514514
if res == nil {
515515
return fmt.Errorf("decoding response, could not find object")
516516
}
517+
if _, ok := res["liens"]; ok {
518+
res, err := flattenNestedResourceManagerLien(d, meta, res)
519+
if err != nil {
520+
return fmt.Errorf("Error getting nested object from operation response: %s", err)
521+
}
522+
if res == nil {
523+
// Object isn't there any more - remove it from the state.
524+
return fmt.Errorf("Error decoding response from operation, could not find nested object")
525+
}
526+
}
517527
if err := d.Set("name", flattenNestedResourceManagerLienName(res["name"], d, config)); err != nil {
518528
return fmt.Errorf(`Error setting computed identity field "name": %s`, err)
519529
}

0 commit comments

Comments
 (0)