terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
`azurerm_mssql_database` - read maintenance configuration only if database is not in elastic pool
Fix the case when DB is part of elastic pool - the subsequent terraform plan command shows false change of maintenance configuration name:
~ resource "azurerm_mssql_database" "example" {
id = "/subscriptions/xxx/resourceGroups/group/providers/Microsoft.Sql/servers/server/databases/example"
~ maintenance_configuration_name = "SQL_WestEurope_DB_2" -> "SQL_Default"
name = "example"
Thanks @richardfric - would it not make more sense to change the schema to be computed? as otherwise the state/resource would not watch what is in azure?
Value is computed only in case db is part of elastic pool. I'm not sure if this can be reflected in schema because the default value is not nil.
resource azurerm_mssql_database: maintenance_configuration_name: Default must be nil if computed
@richardfric - it might then be best to pull the default out of schema, mark it as computed, and then if it is not elastic set that default during Creat()
Thanks @richardfric - we have a test failure now howeveR:
------- Stdout: ------- === RUN TestAccMsSqlDatabaseExtendedAuditingPolicy_complete === PAUSE TestAccMsSqlDatabaseExtendedAuditingPolicy_complete === CONT TestAccMsSqlDatabaseExtendedAuditingPolicy_complete testcase.go:110: Step 1/2 error: Error running apply: exit status 1 Error: creating/updating Database: (Name "acctest-db-220927234016426462" / Server Name "acctest-sqlserver-220927234016426462" / Resource Group "acctestRG-mssql-220927234016426462"): sql.DatabasesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidResourceId" Message="Invalid resource identifier '/subscriptions/*******/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/'." with azurerm_mssql_database.test, on terraform_plugin_test.tf line 21, in resource "azurerm_mssql_database" "test": 21: resource "azurerm_mssql_database" "test" { --- FAIL: TestAccMsSqlDatabaseExtendedAuditingPolicy_complete (213.06s) FAILalso should we update the docs with the behaviour for elastic?
I wonder why all checks have passed when there was actually an error in tests. Problem with empty name should be now fixed and I've also added note to docs about conflict with elastic pool setting.
Would this address https://github.com/hashicorp/terraform-provider-azurerm/issues/18621 ?
Currently, not specifying the maintenance configuration when one is specified for the elastic pool gives the following error: "Specified public maintenance configuration 'SQL_Default' for the database 'my-db' conflicts with the maintenance configuration 'DB_1' of the elastic pool 'my-pool'."
Whereas specifying it gives the error referenced in the issue above.
Would this address #18621 ?
Currently, not specifying the maintenance configuration when one is specified for the elastic pool gives the following error: "Specified public maintenance configuration 'SQL_Default' for the database 'my-db' conflicts with the maintenance configuration 'DB_1' of the elastic pool 'my-pool'."
Whereas specifying it gives the error referenced in the issue above.
Seems so. This issue is currently blocking upgrade paths for us to newer versions of the provider, unfortunately.
This functionality has been released in v3.29.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!
Has this now become available in v3.29.0? I can't find it in the changelog
Any updates on this issue? It is an important issue for my company, SMBC group
Any updates on this issue? It is an important issue for my company, SMBC group
@bkatsnelson This PR is already merged, see #19083 for remaining problems.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.