diff --git a/mmv1/products/essentialcontacts/Contact.yaml b/mmv1/products/essentialcontacts/Contact.yaml index 18bf18644c9f..db57147cd9de 100644 --- a/mmv1/products/essentialcontacts/Contact.yaml +++ b/mmv1/products/essentialcontacts/Contact.yaml @@ -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' diff --git a/mmv1/templates/terraform/post_import/essential_contacts_contact.go.tmpl b/mmv1/templates/terraform/post_import/essential_contacts_contact.go.tmpl new file mode 100644 index 000000000000..a328ba4d4f56 --- /dev/null +++ b/mmv1/templates/terraform/post_import/essential_contacts_contact.go.tmpl @@ -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) +} \ No newline at end of file