Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_mssql_server - minimum_tls_version no longer accepts Disabled, 1.0 and 1.1 as a value in 5.0. #28230

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions internal/services/mssql/mssql_server_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
keyVaultParser "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse"
keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/custompollers"
Expand All @@ -37,7 +38,7 @@ import (
)

func resourceMsSqlServer() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceMsSqlServerCreate,
Read: resourceMsSqlServerRead,
Update: resourceMsSqlServerUpdate,
Expand Down Expand Up @@ -161,10 +162,7 @@ func resourceMsSqlServer() *pluginsdk.Resource {
Optional: true,
Default: "1.2",
ValidateFunc: validation.StringInSlice([]string{
"1.0",
"1.1",
"1.2",
"Disabled",
}, false),
},

Expand Down Expand Up @@ -202,6 +200,22 @@ func resourceMsSqlServer() *pluginsdk.Resource {
pluginsdk.CustomizeDiffShim(msSqlPasswordChangeWhenAADAuthOnly),
),
}

if !features.FivePointOhBeta() {
resource.Schema["minimum_tls_version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Default: "1.2",
ValidateFunc: validation.StringInSlice([]string{
"1.0",
"1.1",
"1.2",
"Disabled",
}, false),
}
}

return resource
}

func resourceMsSqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
11 changes: 8 additions & 3 deletions internal/services/mssql/mssql_server_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
Expand Down Expand Up @@ -52,6 +53,9 @@ func TestAccMsSqlServer_complete(t *testing.T) {
}

func TestAccMsSqlServer_minimumTLSVersionDisabled(t *testing.T) {
if features.FivePointOhBeta() {
t.Skipf("The service require minimum TLS version to be 1.2+, skip the `disabled` testing.")
}
data := acceptance.BuildTestData(t, "azurerm_mssql_server", "test")
r := MsSqlServerResource{}

Expand Down Expand Up @@ -389,7 +393,7 @@ resource "azurerm_mssql_server" "test" {
version = "12.0"
administrator_login = "missadministrator"
administrator_login_password = "thisIsKat11"
minimum_tls_version = "1.1"
minimum_tls_version = "1.2"

identity {
type = "SystemAssigned"
Expand Down Expand Up @@ -564,7 +568,7 @@ resource "azurerm_mssql_server" "test" {
version = "12.0"
administrator_login = "missadministrator"
administrator_login_password = "thisIsKat11"
minimum_tls_version = "1.0"
minimum_tls_version = "1.2"

public_network_access_enabled = false
primary_user_assigned_identity_id = azurerm_user_assigned_identity.test.id
Expand All @@ -575,7 +579,8 @@ resource "azurerm_mssql_server" "test" {
}

tags = {
DB = "NotProd"
update = "true"
DB = "NotProd"
}
}

Expand Down
4 changes: 4 additions & 0 deletions website/docs/5.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ Please follow the format in the example below for listing breaking changes in re

* The properties `weekly_retention`, `monthly_retention` and `yearly_retention` now default to `PT0S`.

### `azurerm_mssql_server`

* The property `minimum_tls_version` no longer accepts `Disabled`, `1.0` or `1.1` as a value.

## `azurerm_network_watcher_flow_log`

* The deprecated `network_security_group_id` property has been removed in favour of the `target_resource_id` property.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/mssql_server.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ The following arguments are supported:

~> **NOTE:** The `minimum_tls_version` is set to `Disabled` means all TLS versions are allowed. After you enforce a version of `minimum_tls_version`, it's not possible to revert to `Disabled`.

~> **NOTE:** Azure Services will require TLS 1.2+ by August 2025, please see this [announcement](https://azure.microsoft.com/en-us/updates/v2/update-retirement-tls1-0-tls1-1-versions-azure-services/) for more.

* `public_network_access_enabled` - (Optional) Whether public network access is allowed for this server. Defaults to `true`.

* `outbound_network_restriction_enabled` - (Optional) Whether outbound network traffic is restricted for this server. Defaults to `false`.
Expand Down
Loading