Skip to content

Commit

Permalink
Rename property, add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
favoretti committed Mar 14, 2024
1 parent 1b2db1a commit 41b1134
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
25 changes: 13 additions & 12 deletions internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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)
},
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/services/storage/storage_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/storage_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 41b1134

Please sign in to comment.