Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/terraform-provider-azurerm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9b2d738cccbd5cb859941465d6376d00630206b6
Choose a base ref
..
head repository: hashicorp/terraform-provider-azurerm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d9481509a9ee00cf36eee396eec45b5e40b64f3c
Choose a head ref
Showing with 15 additions and 52 deletions.
  1. +3 −3 internal/services/containers/client/client.go
  2. +5 −5 internal/services/containers/kubernetes_addons.go
  3. +7 −44 internal/services/storage/storage_account_resource.go
6 changes: 3 additions & 3 deletions internal/services/containers/client/client.go
Original file line number Diff line number Diff line change
@@ -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
}
10 changes: 5 additions & 5 deletions internal/services/containers/kubernetes_addons.go
Original file line number Diff line number Diff line change
@@ -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 {
51 changes: 7 additions & 44 deletions internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-sdk/resource-manager/storage/2023-01-01/storageaccounts"
"github.com/hashicorp/go-azure-sdk/sdk/environments"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
@@ -1304,7 +1303,6 @@ func resourceStorageAccount() *pluginsdk.Resource {
}

func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) error {
envName := meta.(*clients.Client).Account.Environment.Name
tenantId := meta.(*clients.Client).Account.TenantId
client := meta.(*clients.Client).Storage.AccountsClient
storageClient := meta.(*clients.Client).Storage
@@ -1669,7 +1667,6 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e
}

func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
envName := meta.(*clients.Client).Account.Environment.Name
tenantId := meta.(*clients.Client).Account.TenantId
client := meta.(*clients.Client).Storage.AccountsClient
keyVaultClient := meta.(*clients.Client).KeyVault
@@ -1814,35 +1811,11 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e
}

if d.HasChange("min_tls_version") {
minimumTLSVersion := d.Get("min_tls_version").(string)

// For all Clouds except Public, China, and USGovernmentCloud, don't specify "min_tls_version" in request body.
// https://github.com/hashicorp/terraform-provider-azurerm/issues/8083
// USGovernmentCloud "min_tls_version" allowed as of issue 9128
// https://github.com/hashicorp/terraform-provider-azurerm/issues/9128
if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud {
if minimumTLSVersion != string(storage.MinimumTLSVersionTLS10) {
return fmt.Errorf(`"min_tls_version" is not supported for a Storage Account located in %q`, envName)
}
} else {
props.MinimumTLSVersion = storage.MinimumTLSVersion(minimumTLSVersion)
}
props.MinimumTLSVersion = storage.MinimumTLSVersion(d.Get("min_tls_version").(string))
}

if d.HasChange("allow_nested_items_to_be_public") {
allowBlobPublicAccess := d.Get("allow_nested_items_to_be_public").(bool)

// For all Clouds except Public, China, and USGovernmentCloud, don't specify "allow_blob_public_access" in request body.
// https://github.com/hashicorp/terraform-provider-azurerm/issues/7812
// USGovernmentCloud "allow_blob_public_access" allowed as of issue 9128
// https://github.com/hashicorp/terraform-provider-azurerm/issues/9128
if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud {
if allowBlobPublicAccess {
return fmt.Errorf("allow_nested_items_to_be_public is not supported for a Storage Account located in %q", envName)
}
} else {
props.AllowBlobPublicAccess = pointer.To(allowBlobPublicAccess)
}
props.AllowBlobPublicAccess = pointer.To(d.Get("allow_nested_items_to_be_public").(bool))
}

if d.HasChange("public_network_access_enabled") {
@@ -2130,22 +2103,12 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err
// lintignore:R001
d.Set("allow_nested_items_to_be_public", allowBlobPublicAccess)

// For all Clouds except Public, China, and USGovernmentCloud, "min_tls_version" is not returned from Azure so always persist the default values for "min_tls_version".
// https://github.com/hashicorp/terraform-provider-azurerm/issues/7812
// https://github.com/hashicorp/terraform-provider-azurerm/issues/8083
// USGovernmentCloud "min_tls_version" allowed as of issue 9128
// https://github.com/hashicorp/terraform-provider-azurerm/issues/9128
envName := meta.(*clients.Client).Account.Environment.Name
if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud {
d.Set("min_tls_version", string(storage.MinimumTLSVersionTLS10))
} else {
// For storage account created using old API, the response of GET call will not return "min_tls_version", either.
minTlsVersion := string(storage.MinimumTLSVersionTLS10)
if props.MinimumTLSVersion != "" {
minTlsVersion = string(props.MinimumTLSVersion)
}
d.Set("min_tls_version", minTlsVersion)
// For storage account created using old API, the response of GET call will not return "min_tls_version"
minTlsVersion := string(storage.MinimumTLSVersionTLS10)
if props.MinimumTLSVersion != "" {
minTlsVersion = string(props.MinimumTLSVersion)
}
d.Set("min_tls_version", minTlsVersion)

if err := d.Set("custom_domain", flattenStorageAccountCustomDomain(props.CustomDomain)); err != nil {
return fmt.Errorf("setting `custom_domain`: %+v", err)