From d9481509a9ee00cf36eee396eec45b5e40b64f3c Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Wed, 10 Apr 2024 20:35:44 +0100 Subject: [PATCH] containers: update use of autorest `azure.Environment` to go-azure-sdk `environments.Environment` --- internal/services/containers/client/client.go | 6 +++--- internal/services/containers/kubernetes_addons.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index c8268a991911..bc47d9fd866c 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -6,7 +6,6 @@ package client import ( "fmt" - "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2023-05-01/containerinstance" containerregistry_v2019_06_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview" containerregistry_v2021_08_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2021-08-01-preview" @@ -20,6 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/extensions" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -37,7 +37,7 @@ type Client struct { MaintenanceConfigurationsClient *maintenanceconfigurations.MaintenanceConfigurationsClient ServicesClient *containerservices.ContainerServicesClient SnapshotClient *snapshots.SnapshotsClient - Environment azure.Environment + Environment environments.Environment } func NewContainersClient(o *common.ClientOptions) (*Client, error) { @@ -129,6 +129,6 @@ func NewContainersClient(o *common.ClientOptions) (*Client, error) { MaintenanceConfigurationsClient: maintenanceConfigurationsClient, ServicesClient: servicesClient, SnapshotClient: snapshotClient, - Environment: o.AzureEnvironment, + Environment: o.Environment, }, nil } diff --git a/internal/services/containers/kubernetes_addons.go b/internal/services/containers/kubernetes_addons.go index 40a7aebe2e94..1c553fbd97f8 100644 --- a/internal/services/containers/kubernetes_addons.go +++ b/internal/services/containers/kubernetes_addons.go @@ -7,11 +7,11 @@ import ( "fmt" "strings" - "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/go-azure-sdk/sdk/environments" commonValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" containerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" applicationGatewayValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" @@ -37,11 +37,11 @@ const ( // the list of unsupported addons in the defined region - e.g. by being // omitted from this list an addon/environment combination will be supported var unsupportedAddonsForEnvironment = map[string][]string{ - azure.ChinaCloud.Name: { + environments.AzureChinaCloud: { aciConnectorKey, // https://github.com/hashicorp/terraform-provider-azurerm/issues/5510 httpApplicationRoutingKey, // https://github.com/hashicorp/terraform-provider-azurerm/issues/5960 }, - azure.USGovernmentCloud.Name: { + environments.AzureUSGovernmentCloud: { httpApplicationRoutingKey, // https://github.com/hashicorp/terraform-provider-azurerm/issues/5960 }, } @@ -282,7 +282,7 @@ func schemaKubernetesAddOns() map[string]*pluginsdk.Schema { return out } -func expandKubernetesAddOns(d *pluginsdk.ResourceData, input map[string]interface{}, env azure.Environment) (*map[string]managedclusters.ManagedClusterAddonProfile, error) { +func expandKubernetesAddOns(d *pluginsdk.ResourceData, input map[string]interface{}, env environments.Environment) (*map[string]managedclusters.ManagedClusterAddonProfile, error) { disabled := managedclusters.ManagedClusterAddonProfile{ Enabled: false, } @@ -421,7 +421,7 @@ func expandKubernetesAddOns(d *pluginsdk.ResourceData, input map[string]interfac return filterUnsupportedKubernetesAddOns(addonProfiles, env) } -func filterUnsupportedKubernetesAddOns(input map[string]managedclusters.ManagedClusterAddonProfile, env azure.Environment) (*map[string]managedclusters.ManagedClusterAddonProfile, error) { +func filterUnsupportedKubernetesAddOns(input map[string]managedclusters.ManagedClusterAddonProfile, env environments.Environment) (*map[string]managedclusters.ManagedClusterAddonProfile, error) { filter := func(input map[string]managedclusters.ManagedClusterAddonProfile, key string) (map[string]managedclusters.ManagedClusterAddonProfile, error) { output := input if v, ok := output[key]; ok {