Skip to content

Commit f49497f

Browse files
committed
debug logs when identity is nil
1 parent 9af6e6d commit f49497f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mmv1/templates/terraform/resource.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ func resource{{ $.ResourceName -}}Read(d *schema.ResourceData, meta interface{})
722722
{{ $.CustomTemplate $.CustomCode.CustomIdentityRead true -}}
723723
{{- else }}
724724
identity, err := d.Identity()
725-
if identity != nil {
725+
if err != nil && identity != nil {
726726
{{- range $p := $.IdentityProperties }}
727727
if v, ok := identity.GetOk("{{ underscore $p.Name}}"); ok && v != "" {
728728
err = identity.Set("{{ underscore $p.Name}}", d.Get("{{ underscore $p.Name}}").(string))

mmv1/third_party/terraform/tpgresource/import.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ func ParseImportId(idRegexes []string, d TerraformResourceData, config *transpor
2525
log.Printf("[DEBUG] Could not compile %s.", idFormat)
2626
return fmt.Errorf("Import is not supported. Invalid regex formats.")
2727
}
28-
identity, _ := d.Identity()
28+
identity, err := d.Identity()
29+
if identity == nil {
30+
fmt.Printf("[DEBUG] identity not set: %s", err)
31+
}
2932
if fieldValues := re.FindStringSubmatch(d.Id()); fieldValues != nil {
3033
log.Printf("[DEBUG] matching ID %s to regex %s.", d.Id(), idFormat)
3134
// Starting at index 1, the first match is the full string.

0 commit comments

Comments
 (0)