Skip to content

Commit

Permalink
fix TestAccAdvisorRecommendationsDataSource_complete
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-zhenhua committed Jul 26, 2024
1 parent 2cd6497 commit b51a544
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
)

type AdvisorRecommendationsDataSourceTests struct{}
Expand Down Expand Up @@ -73,6 +74,11 @@ data "azurerm_advisor_recommendations" "test" {}`
// Please refer to the issue https://github.com/Azure/azure-rest-api-specs/issues/9284
// So here we get an empty list of recommendations
func (AdvisorRecommendationsDataSourceTests) completeConfig(data acceptance.TestData) string {
httpsTrafficOnlyConfig := ""
if !features.FourPointOhBeta() {
httpsTrafficOnlyConfig = "enable_https_traffic_only = false"
}

return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -84,19 +90,19 @@ resource "azurerm_resource_group" "test" {
}
resource "azurerm_storage_account" "test" {
name = "accteststr%s"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
enable_https_traffic_only = false
account_tier = "Standard"
account_replication_type = "LRS"
name = "accteststr%s"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
%s
account_tier = "Standard"
account_replication_type = "LRS"
}
data "azurerm_advisor_recommendations" "test" {
filter_by_category = ["Security"]
filter_by_resource_groups = [azurerm_resource_group.test.name]
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
`, data.RandomInteger, data.Locations.Primary, data.RandomString, httpsTrafficOnlyConfig)
}

func (AdvisorRecommendationsDataSourceTests) categoriesFilterConfig() string {
Expand Down

0 comments on commit b51a544

Please sign in to comment.