From 41b1134774f2b62b03603502974d9b8c3526b635 Mon Sep 17 00:00:00 2001 From: Vladimir Lazarenko Date: Thu, 14 Mar 2024 19:01:40 +0100 Subject: [PATCH] Rename property, add docs --- .../storage/storage_account_resource.go | 25 ++++++++++--------- .../storage/storage_account_resource_test.go | 2 +- website/docs/r/storage_account.html.markdown | 2 ++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/internal/services/storage/storage_account_resource.go b/internal/services/storage/storage_account_resource.go index c17c0c72a120..b3eb5e6737bb 100644 --- a/internal/services/storage/storage_account_resource.go +++ b/internal/services/storage/storage_account_resource.go @@ -368,10 +368,14 @@ func resourceStorageAccount() *pluginsdk.Resource { Default: true, }, - "dns_endpoint_type_azure_enabled": { - Type: pluginsdk.TypeBool, + "dns_endpoint_type": { + Type: pluginsdk.TypeString, Optional: true, - Default: false, + ValidateFunc: validation.StringInSlice([]string{ + string(storage.DNSEndpointTypeStandard), + string(storage.DNSEndpointTypeAzureDNSZone), + }, false), + Default: string(storage.DNSEndpointTypeStandard), ForceNew: true, }, @@ -1243,11 +1247,6 @@ func resourceStorageAccount() *pluginsdk.Resource { Sensitive: true, }, - "azure_dns_zone_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "tags": { Type: pluginsdk.TypeMap, Optional: true, @@ -1346,10 +1345,7 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e if d.Get("public_network_access_enabled").(bool) { publicNetworkAccess = storage.PublicNetworkAccessEnabled } - dnsEndpointType := storage.DNSEndpointTypeStandard - if d.Get("dns_endpoint_type_azure_enabled").(bool) { - dnsEndpointType = storage.DNSEndpointTypeAzureDNSZone - } + dnsEndpointType := d.Get("dns_endpoint_type").(string) accountTier := d.Get("account_tier").(string) replicationType := d.Get("account_replication_type").(string) @@ -1374,11 +1370,15 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e AllowCrossTenantReplication: &crossTenantReplication, SasPolicy: expandStorageAccountSASPolicy(d.Get("sas_policy").([]interface{})), IsSftpEnabled: &isSftpEnabled, +<<<<<<< HEAD <<<<<<< HEAD IsLocalUserEnabled: pointer.To(d.Get("local_user_enabled").(bool)), ======= DNSEndpointType: dnsEndpointType, >>>>>>> 44760707ba (WIP: `azurerm_storage_account`: Add support for `AzureDNSZone`) +======= + DNSEndpointType: storage.DNSEndpointType(dnsEndpointType), +>>>>>>> 1b5e523f0c (Rename property, add docs) }, } @@ -2123,6 +2123,7 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err publicNetworkAccessEnabled = false } d.Set("public_network_access_enabled", publicNetworkAccessEnabled) + d.Set("dns_endpoint_type", props.DNSEndpointType) if crossTenantReplication := props.AllowCrossTenantReplication; crossTenantReplication != nil { d.Set("cross_tenant_replication_enabled", crossTenantReplication) diff --git a/internal/services/storage/storage_account_resource_test.go b/internal/services/storage/storage_account_resource_test.go index 5db567759e8a..647e038ba3c2 100644 --- a/internal/services/storage/storage_account_resource_test.go +++ b/internal/services/storage/storage_account_resource_test.go @@ -1789,7 +1789,7 @@ resource "azurerm_storage_account" "test" { account_tier = "Premium" account_replication_type = "LRS" - dns_endpoint_type_azure_enabled = true + dns_endpoint_type = "AzureDnsZone" allow_nested_items_to_be_public = false tags = { diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index 934a5087c448..91d9720be315 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -171,6 +171,8 @@ The following arguments are supported: * `sftp_enabled` - (Optional) Boolean, enable SFTP for the storage account +* `dns_endpoint_type` - (Optional) Which DNS endpoint type to use. Possible values are `Standard` and `AzureDnsZone`. Defailts to `Standard`. Changing this forces a new resource to be created. + -> **NOTE:** SFTP support requires `is_hns_enabled` set to `true`. [More information on SFTP support can be found here](https://learn.microsoft.com/azure/storage/blobs/secure-file-transfer-protocol-support). Defaults to `false` * `tags` - (Optional) A mapping of tags to assign to the resource.