Skip to content

Commit

Permalink
azurerm_storage_account - Fix acctest `TestAccAzureRMStorageAccount…
Browse files Browse the repository at this point in the history
…_routing` (hashicorp#24924)
  • Loading branch information
magodo authored and rizkybiz committed Feb 21, 2024
1 parent 63b6b44 commit 0b200ca
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3898,6 +3898,22 @@ func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *pluginsdk.ResourceDat
if err := setEndpointAndHost(d, "primary", primary.InternetEndpoints.Web, "web_internet"); err != nil {
return err
}
} else {
if err := setEndpointAndHost(d, "primary", nil, "blob_internet"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "dfs_internet"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "file_internet"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "web_internet"); err != nil {
return err
}
}

if routingInputs != nil && routingInputs.PublishMicrosoftEndpoints != nil && *routingInputs.PublishMicrosoftEndpoints {
Expand All @@ -3924,6 +3940,30 @@ func flattenAndSetAzureRmStorageAccountPrimaryEndpoints(d *pluginsdk.ResourceDat
if err := setEndpointAndHost(d, "primary", primary.MicrosoftEndpoints.Queue, "queue_microsoft"); err != nil {
return err
}
} else {
if err := setEndpointAndHost(d, "primary", nil, "blob_microsoft"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "dfs_microsoft"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "file_microsoft"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "web_microsoft"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "table_microsoft"); err != nil {
return err
}

if err := setEndpointAndHost(d, "primary", nil, "queue_microsoft"); err != nil {
return err
}
}

return nil
Expand Down
8 changes: 8 additions & 0 deletions internal/services/storage/storage_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,14 @@ func TestAccAzureRMStorageAccount_routing(t *testing.T) {
),
},
data.ImportStep(),
{
Config: r.routing(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("primary_blob_microsoft_endpoint").IsNotEmpty(),
),
},
data.ImportStep(),
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
Expand Down

0 comments on commit 0b200ca

Please sign in to comment.