Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hashicorp/terraform-provider-azurer…
Browse files Browse the repository at this point in the history
…m into provisioned_cluster_instance
  • Loading branch information
teowa committed Nov 28, 2024
2 parents 76542d4 + c8a5ffb commit 6a27c24
Show file tree
Hide file tree
Showing 114 changed files with 986 additions and 153 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
## 4.12.0 (Unreleased)

FEATURES:

* **New Data Source**: `azurerm_mssql_managed_database` [GH-27026]

BUG FIXES:

* `azurerm_application_insights_api_key` - fix condition that nil checks the list of available API keys to prevent an indefinate loop when keys created outside of Terraform are present [GH-28037]
* `azurerm_data_factory_linked_service_azure_sql_database` - send `tenant_id` only if it has been specified [GH-28120]
* `azurerm_eventgrid_event_subscription` - fix crash when flattening `advanced_filter` [GH-28110]
* `azurerm_virtual_network_gateway` - fix crash issue when specifying `root_certificate ` or `revoked_certificate` [GH-28099]

ENHANCEMENTS:

* `containerapps` - update api version to `2024-03-01` [GH-28074]
* Data Source: `azurerm_logic_app_standard` - add support for the `public_network_access` property [GH-27913]
* Data Source: `azurerm_search_service` - add support for the `customer_managed_key_encryption_compliance_status` property [GH-27478]
* `azurerm_container_registry_task` - add validation on `cpu` as well as on `agent_pool_name`and `agent_setting` [GH-28098]
* `azurerm_databricks_workspace` - add support for the `enhanced_security_compliance` block [GH-26606]
* `azurerm_eventhub` - deprecate `namespace_name` and `resource_group_name` in favour of `namespace_id` [GH-28055]
* `azurerm_logic_app_standard` - add support for the `public_network_access` property [GH-27913]
* `azurerm_search_service` - add support for the `customer_managed_key_encryption_compliance_status` property [GH-27478]
* `azurerm_cosmosdb_account` - add support for value `EnableNoSQLFullTextSearch` in the `capabilities.name` property [GH-28114]

## 4.11.0 (November 22, 2024)

Expand Down
7 changes: 7 additions & 0 deletions examples/databricks/enhanced-security-compliance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Example: Databricks Workspace with Enhanced Security and Compliance

This example provisions a Databricks Workspace within Azure with Enhanced Security and Compliance settings enabled.

### Variables

* `prefix` - (Required) The prefix used for all resources in this example.
23 changes: 23 additions & 0 deletions examples/databricks/enhanced-security-compliance/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name = "${var.prefix}-databricks-esc"
location = "West Europe"
}

resource "azurerm_databricks_workspace" "example" {
name = "${var.prefix}-DBW"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "premium"
managed_resource_group_name = "${var.prefix}-DBW-managed-esc"

enhanced_security_compliance {
automatic_cluster_update_enabled = true
compliance_security_profile_enabled = true
compliance_security_profile_standards = ["HIPAA", "PCI_DSS"]
enhanced_security_monitoring_enabled = true
}
}
7 changes: 7 additions & 0 deletions examples/databricks/enhanced-security-compliance/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "prefix" {
description = "The Prefix used for all resources in this example"
}

2 changes: 1 addition & 1 deletion internal/services/containerapps/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/certificates"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerappsrevisions"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/daprcomponents"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-02-02-preview/jobs"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/managedenvironments"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/managedenvironments"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/helpers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/managedenvironments"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/helpers"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down
2 changes: 1 addition & 1 deletion internal/services/containerapps/container_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/managedenvironments"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/helpers"
Expand Down
57 changes: 52 additions & 5 deletions internal/services/containerapps/container_app_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -68,24 +68,23 @@ func TestAccContainerAppResource_smallerGranularityCPUMemoryCombinations(t *test
func TestAccContainerAppResource_workloadProfileUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_container_app", "test")
r := ContainerAppResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Config: r.withMultipleWorkloadProfiles(data, 0),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.withWorkloadProfile(data),
Config: r.withMultipleWorkloadProfiles(data, 1),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.basic(data),
Config: r.withMultipleWorkloadProfiles(data, 0),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -1470,6 +1469,50 @@ resource "azurerm_container_app" "test" {
`, r.templateWorkloadProfile(data), data.RandomInteger)
}

func (r ContainerAppResource) withMultipleWorkloadProfiles(data acceptance.TestData, workloadProfileIndex int) string {
return fmt.Sprintf(`
%s
locals {
workload_profiles = tolist(azurerm_container_app_environment.test.workload_profile)
}
resource "azurerm_container_app" "test" {
name = "acctest-capp-%[2]d"
resource_group_name = azurerm_resource_group.test.name
container_app_environment_id = azurerm_container_app_environment.test.id
revision_mode = "Single"
workload_profile_name = local.workload_profiles.%[3]d.name
template {
container {
name = "acctest-cont-%[2]d"
image = "jackofallops/azure-containerapps-python-acctest:v0.0.1"
cpu = 0.25
memory = "0.5Gi"
}
}
ingress {
allow_insecure_connections = true
external_enabled = true
target_port = 5000
transport = "http"
traffic_weight {
latest_revision = true
percentage = 100
}
}
tags = {
foo = "Bar"
accTest = "1"
}
}
`, r.templateMultipleWorkloadProfiles(data), data.RandomInteger, workloadProfileIndex)
}

func (r ContainerAppResource) withSmallerGranularityCPUMemoryCombinations(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
Expand Down Expand Up @@ -2658,6 +2701,10 @@ func (ContainerAppResource) templateWorkloadProfile(data acceptance.TestData) st
return ContainerAppEnvironmentResource{}.complete(data)
}

func (ContainerAppResource) templateMultipleWorkloadProfiles(data acceptance.TestData) string {
return ContainerAppEnvironmentResource{}.completeMultipleWorkloadProfiles(data)
}

func (ContainerAppResource) templateWithVnet(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
Expand Down
2 changes: 1 addition & 1 deletion internal/services/containerapps/helpers/container_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2023-05-01/daprcomponents"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/containerapps"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2024-03-01/managedenvironments"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate"
Expand Down
13 changes: 8 additions & 5 deletions internal/services/containers/container_registry_task_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,19 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema
Elem: &pluginsdk.Resource{
Schema: map[string]*schema.Schema{
"cpu": {
Type: pluginsdk.TypeInt,
Required: true,
Type: pluginsdk.TypeInt,
Required: true,
ValidateFunc: validation.IntInSlice([]int{2}),
},
},
},
ConflictsWith: []string{"agent_pool_name"},
},
"agent_pool_name": {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
ConflictsWith: []string{"agent_setting"},
},
"enabled": {
Type: pluginsdk.TypeBool,
Expand Down
3 changes: 3 additions & 0 deletions internal/services/cosmos/cosmosdb_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const (
databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl databaseAccountCapabilities = "EnableMongoRoleBasedAccessControl"
databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs databaseAccountCapabilities = "EnableUniqueCompoundNestedDocs"
databaseAccountCapabilitiesEnableNoSqlVectorSearch databaseAccountCapabilities = "EnableNoSQLVectorSearch"
databaseAccountCapabilitiesEnableNoSqlFullTextSearch databaseAccountCapabilities = "EnableNoSQLFullTextSearch"
databaseAccountCapabilitiesEnableTtlOnCustomPath databaseAccountCapabilities = "EnableTtlOnCustomPath"
databaseAccountCapabilitiesEnablePartialUniqueIndex databaseAccountCapabilities = "EnablePartialUniqueIndex"
)
Expand Down Expand Up @@ -103,6 +104,7 @@ var capabilitiesToKindMap = map[string]interface{}{
strings.ToLower(string(databaseAccountCapabilitiesEnableTtlOnCustomPath)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindMongoDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnablePartialUniqueIndex)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindMongoDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableNoSqlVectorSearch)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableNoSqlFullTextSearch)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableCassandra)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
strings.ToLower(string(databaseAccountCapabilitiesEnableGremlin)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
strings.ToLower(string(databaseAccountCapabilitiesEnableTable)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
Expand Down Expand Up @@ -443,6 +445,7 @@ func resourceCosmosDbAccount() *pluginsdk.Resource {
string(databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl),
string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs),
string(databaseAccountCapabilitiesEnableNoSqlVectorSearch),
string(databaseAccountCapabilitiesEnableNoSqlFullTextSearch),
string(databaseAccountCapabilitiesEnableTtlOnCustomPath),
string(databaseAccountCapabilitiesEnablePartialUniqueIndex),
}, false),
Expand Down
4 changes: 4 additions & 0 deletions internal/services/cosmos/cosmosdb_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ func TestAccCosmosDBAccount_capabilities_EnableNoSQLVectorSearch(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindGlobalDocumentDB, []string{"EnableNoSQLVectorSearch"})
}

func TestAccCosmosDBAccount_capabilities_EnableNoSQLFullTextSearch(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindGlobalDocumentDB, []string{"EnableNoSQLFullTextSearch"})
}

func TestAccCosmosDBAccount_capabilities_EnableMongo(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindMongoDB, []string{"EnableMongo"})
}
Expand Down
31 changes: 31 additions & 0 deletions internal/services/databricks/databricks_workspace_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,34 @@ func dataSourceDatabricksWorkspace() *pluginsdk.Resource {
},
},

"enhanced_security_compliance": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"automatic_cluster_update_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
},
"compliance_security_profile_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
},
"compliance_security_profile_standards": {
Type: pluginsdk.TypeSet,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},
"enhanced_security_monitoring_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
},
},
},
},

"tags": commonschema.Tags(),
},
}
Expand Down Expand Up @@ -138,6 +166,9 @@ func dataSourceDatabricksWorkspaceRead(d *pluginsdk.ResourceData, meta interface
}
d.Set("workspace_url", model.Properties.WorkspaceURL)
d.Set("location", model.Location)
if err := d.Set("enhanced_security_compliance", flattenWorkspaceEnhancedSecurity(model.Properties.EnhancedSecurityCompliance)); err != nil {
return fmt.Errorf("setting `enhanced_security_compliance`: %+v", err)
}

return tags.FlattenAndSet(d, model.Tags)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ func TestAccDatabricksWorkspaceDataSource_storageAccountIdentity(t *testing.T) {
})
}

func TestAccDatabricksWorkspaceDataSource_enhancedComplianceSecurity(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_databricks_workspace", "test")
r := DatabricksWorkspaceDataSource{}

data.DataSourceTest(t, []acceptance.TestStep{
{
Config: r.enhancedSecurityCompliance(data),
Check: acceptance.ComposeTestCheckFunc(
acceptance.TestMatchResourceAttr(data.ResourceName, "workspace_url", regexp.MustCompile("azuredatabricks.net")),
check.That(data.ResourceName).Key("workspace_id").Exists(),
check.That(data.ResourceName).Key("location").Exists(),
check.That(data.ResourceName).Key("enhanced_security_compliance.#").HasValue("1"),
check.That(data.ResourceName).Key("enhanced_security_compliance.0.automatic_cluster_update_enabled").HasValue("true"),
check.That(data.ResourceName).Key("enhanced_security_compliance.0.compliance_security_profile_enabled").HasValue("true"),
check.That(data.ResourceName).Key("enhanced_security_compliance.0.compliance_security_profile_standards.#").HasValue("2"),
check.That(data.ResourceName).Key("enhanced_security_compliance.0.enhanced_security_monitoring_enabled").HasValue("true"),
),
},
})
}

func (DatabricksWorkspaceDataSource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down Expand Up @@ -195,3 +216,35 @@ resource "azurerm_key_vault_access_policy" "databricks" {
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString, getDatabricksPrincipalId(data.Client().SubscriptionID))
}

func (DatabricksWorkspaceDataSource) enhancedSecurityCompliance(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-databricks-%d"
location = "%s"
}
resource "azurerm_databricks_workspace" "test" {
name = "acctestDBW-%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
sku = "premium"
enhanced_security_compliance {
automatic_cluster_update_enabled = true
compliance_security_profile_enabled = true
compliance_security_profile_standards = ["PCI_DSS", "HIPAA"]
enhanced_security_monitoring_enabled = true
}
}
data "azurerm_databricks_workspace" "test" {
name = azurerm_databricks_workspace.test.name
resource_group_name = azurerm_resource_group.test.name
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}
Loading

0 comments on commit 6a27c24

Please sign in to comment.