Skip to content

Commit afef3aa

Browse files
committed
move nil check earlier
1 parent 75834ca commit afef3aa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

helper/resource/testing_new_import_state.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,11 @@ func appendImportBlockWithIdentity(config teststep.Config, resourceName string,
445445
resourceName))
446446

447447
for k, v := range identityValues {
448+
// It's valid for identity attributes to be null, we can just omit it from config
449+
if v == nil {
450+
continue
451+
}
452+
448453
switch v := v.(type) {
449454
case bool:
450455
configBuilder.WriteString(fmt.Sprintf(` %q = %t`+"\n", k, v))
@@ -463,11 +468,6 @@ func appendImportBlockWithIdentity(config teststep.Config, resourceName string,
463468
configBuilder.WriteString(fmt.Sprintf(` %q = %q`+"\n", k, v))
464469

465470
default:
466-
// It's valid for identity attributes to be null, we can just omit it from config
467-
if v == nil {
468-
break
469-
}
470-
471471
panic(fmt.Sprintf("unexpected type %T for identity value %q", v, k))
472472
}
473473
}

0 commit comments

Comments
 (0)