Previously, the global logger is defined as a custom logger interface and we set a hclog.Logger to it. This works fine except that it is less conventional now that slog is provided by the standard library.
This PR changes the global logger's type to slog.Logger. Another benefit of this change is that users of the aztfexport as a depending module can intuitively do OpenTelemetry logging as the logger interface provided by OTEL is also a slog.Logger.
This PR also updated the dependency of azlist to introduce its change for its logger type to be slog.Logger.
Result
BEFORE
2024-06-14T10:39:40.268+0800 [INFO] aztfexport: aztfexport starts with config: config.Config{CommonConfig:config.CommonConfig{SubscriptionId:"****", AzureSDKCredential:(*azidentity.DefaultAzureCredential)(0xc003a40bc0), AzureSDKClientOption:policy.ClientOptions{ClientOptions:policy.ClientOptions{APIVersion:"", Cloud:cloud.Configuration{ActiveDirectoryAuthorityHost:"https://login.microsoftonline.com/", Services:map[cloud.ServiceName]cloud.ServiceConfiguration{"resourceManager":cloud.ServiceConfiguration{Audience:"https://management.core.windows.net/", Endpoint:"https://management.azure.com"}}}, Logging:policy.LogOptions{IncludeBody:true, AllowedHeaders:[]string(nil), AllowedQueryParams:[]string(nil)}, Retry:policy.RetryOptions{MaxRetries:0, TryTimeout:0, RetryDelay:0, MaxRetryDelay:0, StatusCodes:[]int(nil), ShouldRetry:(func(*http.Response, error) bool)(nil)}, Telemetry:policy.TelemetryOptions{ApplicationID:"aztfexport(azurerm)", Disabled:false}, TracingProvider:tracing.Provider{newTracerFn:(func(string, string) tracing.Tracer)(nil)}, Transport:exported.Transporter(nil), PerCallPolicies:[]exported.Policy(nil), PerRetryPolicies:[]exported.Policy(nil)}, AuxiliaryTenants:[]string(nil), DisableRPRegistration:false}, OutputDir:"/tmp/test", OutputFileNames:config.OutputFileNames{TerraformFileName:"", ProviderFileName:"", MainFileName:"", ImportBlockFileName:""}, ProviderVersion:"", DevProvider:true, ProviderName:"azurerm", ContinueOnError:false, BackendType:"local", BackendConfig:[]string(nil), ProviderConfig:map[string]cty.Value(nil), FullConfig:false, Parallelism:10, ModulePath:"", HCLOnly:false, TFClient:tfclient.Client(nil), TelemetryClient:telemetry.AppInsightClient{TelemetryClient:(*appinsights.telemetryClient)(0xc001d2dae0), subscriptionId:"****", installId:"fdc4c1a4-ecda-11ea-8e42-00155df0777c", sessionId:"b9b0d701-5416-4a56-bee4-9a6e9703103a"}, GenerateImportBlock:false}, ResourceId:"", ResourceGroupName:"zhwen-domain", ARGPredicate:"", MappingFile:"", ResourceNamePattern:"res-", RecursiveQuery:true, TFResourceName:"", TFResourceType:"", IncludeRoleAssignment:false, IncludeResourceGroup:false}
2024-06-14T10:39:40.268+0800 [INFO] aztfexport: New resource group meta
2024-06-14T10:39:40.271+0800 [INFO] aztfexport: Init Terraform
2024-06-14T10:39:40.307+0800 [INFO] aztfexport: Find terraform binary at /home/magodo/.local/bin/terraform
2024-06-14T10:39:40.307+0800 [INFO] aztfexport: Init provider
2024-06-14T10:39:40.307+0800 [INFO] aztfexport: Output directory doesn't contain provider setting, create one then
2024-06-14T10:39:40.307+0800 [INFO] aztfexport: Output directory doesn't contain terraform block, create one then
2024-06-14T10:39:41.803+0800 [INFO] aztfexport: List for subscription **** via predicate resourceGroup =~ "zhwen-domain" (parallelism: 10 | recursive true | include managed false)
2024-06-14T10:39:41.803+0800 [INFO] aztfexport: New Client
2024-06-14T10:39:41.803+0800 [INFO] aztfexport: Listing tracked resources
2024-06-14T10:39:43.898+0800 [INFO] aztfexport: Build ARM schema tree
2024-06-14T10:39:43.904+0800 [INFO] aztfexport: Listing child resources
2024-06-14T10:39:45.107+0800 [INFO] aztfexport: 4 resources are listed
2024-06-14T10:39:45.113+0800 [WARN] aztfexport: No query result for resource type and TF id for /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.DomainRegistration/domains/emoranran.com
2024-06-14T10:39:45.113+0800 [WARN] aztfexport: No query result for resource type and TF id for /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.Network/dnszones/emoranran.com/SOA/@
2024-06-14T10:39:45.299+0800 [INFO] aztfexport: Skipping /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.DomainRegistration/domains/emoranran.com
2024-06-14T10:39:45.299+0800 [INFO] aztfexport: Importing /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.Network/dnsZones/emoranran.com as azurerm_dns_zone.res-2
2024-06-14T10:39:45.299+0800 [INFO] aztfexport: Skipping /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.Network/dnszones/emoranran.com/SOA/@
2024-06-14T10:39:45.299+0800 [INFO] aztfexport: Importing /subscriptions/****/resourceGroups/zhwen-domain as azurerm_resource_group.res-0
2024-06-14T10:39:45.299+0800 [INFO] aztfexport: Importing /subscriptions/****/resourceGroups/zhwen-domain/providers/Microsoft.Network/dnsZones/emoranran.com/NS/@ as azurerm_dns_ns_record.res-3
2024-06-14T10:39:50.834+0800 [INFO] aztfexport: aztfexport ends
Previously, the global logger is defined as a custom logger interface and we set a
hclog.Logger
to it. This works fine except that it is less conventional now thatslog
is provided by the standard library.This PR changes the global logger's type to
slog.Logger
. Another benefit of this change is that users of theaztfexport
as a depending module can intuitively do OpenTelemetry logging as the logger interface provided by OTEL is also aslog.Logger
.This PR also updated the dependency of
azlist
to introduce its change for its logger type to beslog.Logger
.Result
BEFORE
AFTER