@@ -402,6 +402,8 @@ type ResourceDatum struct {
402402 overrideIdentifierAttribute string
403403 OverrideResourceType string
404404 tests.CommonArgs
405+ isARNIdentity bool
406+ identityAttribute string
405407}
406408
407409func (d ResourceDatum ) ProviderPackage () string {
@@ -578,6 +580,17 @@ func (v *visitor) processFuncDecl(funcDecl *ast.FuncDecl) {
578580 case "NoImport" :
579581 d .NoImport = true
580582
583+ case "ArnIdentity" :
584+ d .isARNIdentity = true
585+ args := common .ParseArgs (m [3 ])
586+ if len (args .Positional ) == 0 {
587+ d .identityAttribute = "arn"
588+ } else {
589+ d .identityAttribute = args .Positional [0 ]
590+ }
591+
592+ populateInherentRegionIdentity (& d , args )
593+
581594 case "Testing" :
582595 args := common .ParseArgs (m [3 ])
583596
@@ -762,3 +775,19 @@ func count[T any](s iter.Seq[T], f func(T) bool) (c int) {
762775 }
763776 return c
764777}
778+
779+ func populateInherentRegionIdentity (d * ResourceDatum , args common.Args ) {
780+ var attrs []string
781+ if attr , ok := args .Keyword ["identityDuplicateAttributes" ]; ok {
782+ attrs = strings .Split (attr , ";" )
783+ }
784+ if d .Implementation == tests .ImplementationSDK {
785+ attrs = append (attrs , "id" )
786+ } else {
787+ if ! slices .Contains (attrs , "id" ) {
788+ d .SetImportStateIDAttribute (d .identityAttribute )
789+ }
790+ }
791+ slices .Sort (attrs )
792+ attrs = slices .Compact (attrs )
793+ }
0 commit comments