diff --git a/internal/meta/meta_rg.go b/internal/meta/meta_rg.go index 7d90e23..5d4c910 100644 --- a/internal/meta/meta_rg.go +++ b/internal/meta/meta_rg.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/aztfexport/internal/tfaddr" "github.com/Azure/aztfexport/pkg/config" "github.com/Azure/aztfexport/pkg/log" + "github.com/magodo/armid" "github.com/magodo/azlist/azlist" ) @@ -97,7 +98,7 @@ func (meta MetaResourceGroup) queryResourceSet(ctx context.Context, rg string) ( ClientOpt: meta.azureSDKClientOpt, Parallelism: meta.parallelism, Recursive: true, - IncludeResourceGroup: true, + IncludeResourceGroup: false, ExtensionResourceTypes: extBuilder{includeRoleAssignment: meta.includeRoleAssignment}.Build(), }) if err != nil { @@ -113,5 +114,13 @@ func (meta MetaResourceGroup) queryResourceSet(ctx context.Context, rg string) ( rl = append(rl, res) } + // Especially, adding the resoruce group itself to the resource set + rl = append(rl, + resourceset.AzureResource{Id: &armid.ResourceGroup{ + SubscriptionId: meta.subscriptionId, + Name: meta.resourceGroup, + }}, + ) + return &resourceset.AzureResourceSet{Resources: rl}, nil }