Open shnmorimoto opened 1 year ago
Thanks for raising this issue. Before creating the PITR resource, suggest to wait at least 15 minutes until all related components are ready.
Thanks for suggestion!
It works well for my case.
I have the same issue. where do we wait for 15 minutes?
In my case, the only dependency is the azurerm_mssql_elasticpool
. Therefore, the following is currently working well. (3.5m works fine too.)
And, you may need the time provider.
https://registry.terraform.io/providers/hashicorp/time/latest/docs
resource "azurerm_mssql_elasticpool" "main" {
name = "sample"
resource_group_name = "<resource group>"
location = "japanwest"
server_name = "<server name>"
max_size_gb = 1024
sku {
name = "StandardPool"
tier = "Standard"
capacity = 200
}
per_database_settings {
min_capacity = 0
max_capacity = 200
}
}
resource "time_sleep" "main" {
create_duration = "3.5m"
triggers = {
peer = azurerm_mssql_elasticpool.main.id
}
}
resource "azurerm_mssql_database" "main" {
name = "sample"
server_id = "<server id>"
create_mode = "PointInTimeRestore"
creation_source_database_id = "<database id>"
restore_point_in_time = timeadd(timestamp(), "-5h")
collation = "Japanese_CI_AS"
elastic_pool_id = "<elastic pool id>"
depends_on = [
time_sleep.main
]
}
I do not have any dependency except the existing server.
All resources are pre-created and running.
module "PITR-SQL-DB-LGRI-ALPS" {
source = "./TerraModules/18.SqlDbModule" #"../00.TerraformModules/18.SqlDbModule"
location = var.location
sqldb_name = "${var.sqldb_name_base}-${lower(random_string.random_str.result)}"
sqldb_server_id = data.azurerm_mssql_server.sql_server.id
sqldb_sku_name = "S2"
sqldb_max_size_gb = 500
sqldb_collation = "SQL_LATIN1_GENERAL_CP1_CS_AS"
sqldb_readscale = false
st_account_type = "Local"
zone_redundant = false
sqldb_retention_days = 35
sqldb_create_mode = "PointInTimeRestore"
sqldb_restore_point_in_time = var.src_pitr
sqldb_creation_source_database_id = var.src_db_id
tags_common = local.tags_sql
}
We at @swisspost miss the possibility to use TDE reliably, without having to include an delay after sql server creation.
are there any news on this ?
Still happening here. Only setting up a mssql_server and a mssql_database. No other dependencies.
Any progress?
Is there an existing issue for this?
Community Note
Terraform Version
1.4.6
AzureRM Provider Version
3.63.0
Affected Resource(s)/Data Source(s)
azurerm_mssql_database
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Successful creation with no errors
Actual Behaviour
Sometimes, azure api returns error when applying TDE. see Debug Output/Panic Output. On terraform, an error occurs, but the DB is created successfully. However, there is a difference on the state file. It seems to happen especially between 1 am and 5 am UTC.
Steps to Reproduce
terraform apply
Important Factoids
No response
References
No response