hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

"context deadline exceeded" when refreshing state for azurerm_sql_server #10364

Closed ghost closed 1 year ago

ghost commented 3 years ago

This issue was originally opened by @kulpreetm as hashicorp/terraform#27616. It was migrated here as a result of the provider split. The original body of the issue is below.


Below is the error i am getting: sql.ServersClient#Get: Failure sending request: StatusCode=504 -- Original Error: context deadline exceeded

Below is the code: resource "azurerm_sql_server" "mssql_server_primary" { name = "${var.app_name}-${var.sql_server_name}-${var.environment}" resource_group_name = azurerm_resource_group.resource_group.name location = azurerm_resource_group.resource_group.location version = "12.0" // version for the server administrator_login = "${var.sql_server_admin_login_name}" administrator_login_password = "${var.sql_server_admin_login_password}"

Applying server level Extended Auditing policy.

extended_auditing_policy {
storage_endpoint                        = azurerm_storage_account.storage_account.primary_blob_endpoint
storage_account_access_key              = azurerm_storage_account.storage_account.primary_access_key
storage_account_access_key_is_secondary = true
retention_in_days                       = "${var.Audit_logs_retention}"

} tags = { environment = "${var.environment}" } }

Create SQL Elastic pool

resource "azurerm_mssql_elasticpool" "mssql_elasticpool" { name = "${var.app_name}-${var.elasticpool_name}-${var.environment}" resource_group_name = azurerm_resource_group.resource_group.name location = azurerm_resource_group.resource_group.location server_name = azurerm_sql_server.mssql_server_primary.name license_type = "LicenseIncluded" max_size_gb = 32

sku { name = "GP_Gen5" tier = "GeneralPurpose" family = "Gen5" capacity = 2 }

per_database_settings { min_capacity = 0 max_capacity = 1 } }

resource "azurerm_mssql_database" "mssql_database" { name = "${var.sql_database_name}-${var.environment}" server_id = azurerm_sql_server.mssql_server_primary.id create_mode = "Default" //Needs to be updated license_type = "LicenseIncluded" max_size_gb = 32 // storage size

sku_name = "GP_Gen5_2" zone_redundant = false

Applying Database level Extended Auditing policy.

extended_auditing_policy {
storage_endpoint                        = azurerm_storage_account.storage_account.primary_blob_endpoint
storage_account_access_key              = azurerm_storage_account.storage_account.primary_access_key
storage_account_access_key_is_secondary = true
retention_in_days                       = "${var.Audit_logs_retention}"

}

tags = { environment = "${var.environment}" }

}

rcskosir commented 1 year ago

Thanks for opening this issue. This was a problem in the 2.x version of the provider which is no longer actively maintained. If this is still an issue with the 3.x version of the provider please do let us know by opening a new issue, thanks!

github-actions[bot] commented 6 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.