@@ -479,3 +479,120 @@ func examplecloudResourceWithEveryIdentitySchemaType() testprovider.Resource {
479479 },
480480 }
481481}
482+
483+ func examplecloudResourceWithNullIdentityAttr () testprovider.Resource {
484+ return testprovider.Resource {
485+ CreateResponse : & resource.CreateResponse {
486+ NewState : tftypes .NewValue (
487+ tftypes.Object {
488+ AttributeTypes : map [string ]tftypes.Type {
489+ "id" : tftypes .String ,
490+ "location" : tftypes .String ,
491+ "name" : tftypes .String ,
492+ },
493+ },
494+ map [string ]tftypes.Value {
495+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
496+ "location" : tftypes .NewValue (tftypes .String , "westeurope" ),
497+ "name" : tftypes .NewValue (tftypes .String , "somevalue" ),
498+ },
499+ ),
500+ NewIdentity : teststep .Pointer (tftypes .NewValue (
501+ tftypes.Object {
502+ AttributeTypes : map [string ]tftypes.Type {
503+ "id" : tftypes .String ,
504+ "value_we_dont_always_need" : tftypes .String ,
505+ },
506+ },
507+ map [string ]tftypes.Value {
508+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
509+ "value_we_dont_always_need" : tftypes .NewValue (tftypes .String , nil ),
510+ },
511+ )),
512+ },
513+ ReadResponse : & resource.ReadResponse {
514+ NewState : tftypes .NewValue (
515+ tftypes.Object {
516+ AttributeTypes : map [string ]tftypes.Type {
517+ "id" : tftypes .String ,
518+ "location" : tftypes .String ,
519+ "name" : tftypes .String ,
520+ },
521+ },
522+ map [string ]tftypes.Value {
523+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
524+ "location" : tftypes .NewValue (tftypes .String , "westeurope" ),
525+ "name" : tftypes .NewValue (tftypes .String , "somevalue" ),
526+ },
527+ ),
528+ NewIdentity : teststep .Pointer (tftypes .NewValue (
529+ tftypes.Object {
530+ AttributeTypes : map [string ]tftypes.Type {
531+ "id" : tftypes .String ,
532+ "value_we_dont_always_need" : tftypes .String ,
533+ },
534+ },
535+ map [string ]tftypes.Value {
536+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
537+ "value_we_dont_always_need" : tftypes .NewValue (tftypes .String , nil ),
538+ },
539+ )),
540+ },
541+ ImportStateResponse : & resource.ImportStateResponse {
542+ State : tftypes .NewValue (
543+ tftypes.Object {
544+ AttributeTypes : map [string ]tftypes.Type {
545+ "id" : tftypes .String ,
546+ "location" : tftypes .String ,
547+ "name" : tftypes .String ,
548+ },
549+ },
550+ map [string ]tftypes.Value {
551+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
552+ "location" : tftypes .NewValue (tftypes .String , "westeurope" ),
553+ "name" : tftypes .NewValue (tftypes .String , "somevalue" ),
554+ },
555+ ),
556+ Identity : teststep .Pointer (tftypes .NewValue (
557+ tftypes.Object {
558+ AttributeTypes : map [string ]tftypes.Type {
559+ "id" : tftypes .String ,
560+ "value_we_dont_always_need" : tftypes .String ,
561+ },
562+ },
563+ map [string ]tftypes.Value {
564+ "id" : tftypes .NewValue (tftypes .String , "westeurope/somevalue" ),
565+ "value_we_dont_always_need" : tftypes .NewValue (tftypes .String , nil ),
566+ },
567+ )),
568+ },
569+ SchemaResponse : & resource.SchemaResponse {
570+ Schema : & tfprotov6.Schema {
571+ Block : & tfprotov6.SchemaBlock {
572+ Attributes : []* tfprotov6.SchemaAttribute {
573+ ComputedStringAttribute ("id" ),
574+ RequiredStringAttribute ("location" ),
575+ RequiredStringAttribute ("name" ),
576+ },
577+ },
578+ },
579+ },
580+ IdentitySchemaResponse : & resource.IdentitySchemaResponse {
581+ Schema : & tfprotov6.ResourceIdentitySchema {
582+ Version : 1 ,
583+ IdentityAttributes : []* tfprotov6.ResourceIdentitySchemaAttribute {
584+ {
585+ Name : "id" ,
586+ Type : tftypes .String ,
587+ RequiredForImport : true ,
588+ },
589+ {
590+ Name : "value_we_dont_always_need" ,
591+ Type : tftypes .String ,
592+ OptionalForImport : true ,
593+ },
594+ },
595+ },
596+ },
597+ }
598+ }
0 commit comments