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 - Fix issue where minimum_tls_version is being returned as None instead of Disabled #22067

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions internal/services/mssql/mssql_server_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ func resourceMsSqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error
d.Set("version", props.Version)
d.Set("administrator_login", props.AdministratorLogin)
d.Set("fully_qualified_domain_name", props.FullyQualifiedDomainName)
if v := props.MinimalTLSVersion; v == nil {
// todo remove `|| *v == "None"` when https://github.com/Azure/azure-rest-api-specs/issues/24348 is addressed
if v := props.MinimalTLSVersion; v == nil || *v == "None" {
d.Set("minimum_tls_version", "Disabled")
} else {
d.Set("minimum_tls_version", props.MinimalTLSVersion)
Expand Down Expand Up @@ -737,7 +738,8 @@ func flattenSqlServerRestorableDatabases(resp sql.RestorableDroppedDatabaseListR

func msSqlMinimumTLSVersionDiff(ctx context.Context, d *pluginsdk.ResourceDiff, _ interface{}) (err error) {
old, new := d.GetChange("minimum_tls_version")
if old != "" && old != "Disabled" && new == "Disabled" {
// todo remove `old != "None"` when https://github.com/Azure/azure-rest-api-specs/issues/24348 is addressed
if old != "" && old != "None" && old != "Disabled" && new == "Disabled" {
err = fmt.Errorf("`minimum_tls_version` cannot be removed once set, please set a valid value for this property")
}
return
Expand Down