Skip to content

Commit

Permalink
Fix import for google_essential_contacts_contact (GoogleCloudPlatform…
Browse files Browse the repository at this point in the history
…#11995)

Co-authored-by: Tripti Tewari <[email protected]>
  • Loading branch information
2 people authored and varshatumburu committed Oct 19, 2024
1 parent 86f83c8 commit 8caaddf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions mmv1/products/essentialcontacts/Contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ timeouts:
update_minutes: 20
delete_minutes: 20
custom_code:
post_import: 'templates/terraform/post_import/essential_contacts_contact.go.tmpl'
examples:
- name: 'essential_contact'
primary_resource_id: 'contact'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Split resource name into tokens
nameTokens := strings.SplitAfterN(d.Id(), "/", 3)

if err := d.Set("parent", nameTokens[0]+strings.Trim(nameTokens[1], "/")); err != nil {
return nil, fmt.Errorf("error getting parent for the contact : %s", err)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ func TestAccEssentialContactsContact_update(t *testing.T) {
),
},
{
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccEssentialContactsContact_v2(context),
Expand All @@ -40,10 +39,9 @@ func TestAccEssentialContactsContact_update(t *testing.T) {
),
},
{
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
ResourceName: "google_essential_contacts_contact.contact",
ImportState: true,
ImportStateVerify: true,
},
},
})
Expand Down

0 comments on commit 8caaddf

Please sign in to comment.