@@ -438,36 +438,33 @@ func convertV1ResourceToEntity(resource *v1.Resource) (*entity.Resource, error)
438
438
if providerInfo , ok := resource .Extensions ["provider" ].(string ); ok {
439
439
resourceProvider = providerInfo
440
440
}
441
+ // idParts = [providerNamespace, providerName, resourceType, resourceName]
442
+ resourceType = idParts [2 ]
443
+ resourceName = idParts [3 ]
441
444
// Look at second element of the id to determine the resource plane
442
445
switch idParts [1 ] {
443
446
case constant .AWSProviderType :
444
447
resourcePlane = constant .AWSProviderType
445
- resourceType = idParts [2 ]
446
- resourceName = idParts [3 ]
447
448
if arn , ok := resource .Attributes ["arn" ].(string ); ok {
448
449
cloudResourceID = arn
449
450
}
450
451
case constant .AzureProviderType :
451
452
resourcePlane = constant .AzureProviderType
452
- resourceType = idParts [2 ]
453
- resourceName = idParts [3 ]
454
453
if resID , ok := resource .Attributes ["id" ].(string ); ok {
455
454
cloudResourceID = resID
456
455
}
457
456
case constant .GoogleProviderType :
458
457
resourcePlane = constant .GoogleProviderType
459
- resourceType = idParts [2 ]
460
- resourceName = idParts [3 ]
461
458
if resID , ok := resource .Attributes ["id" ].(string ); ok {
462
459
cloudResourceID = resID
463
460
}
464
461
case constant .AliCloudProviderType :
465
462
resourcePlane = constant .AliCloudProviderType
466
- resourceType = idParts [2 ]
467
- resourceName = idParts [3 ]
468
463
if resID , ok := resource .Attributes ["id" ].(string ); ok {
469
464
cloudResourceID = resID
470
465
}
466
+ case constant .HashicorpProviderType :
467
+ resourcePlane = constant .HashicorpProviderType
471
468
default :
472
469
if _ , ok := resource .Extensions ["provider" ]; ok {
473
470
resourcePlane = constant .CustomProviderType
0 commit comments