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

azurerm_sql_server TimeOut #7895

Closed bkarlen closed 4 years ago

bkarlen commented 4 years ago

My terraform Creation was working earlier in the week up until yesterday, and has just stopped working today. It is now spinning on the creation of the sql server for an hr and then timing out in Azure DevOps. I haven't changed anything in my Terraform.

image

amanpurwar1 commented 4 years ago

I have tried out its working fine with terraformVersion: '0.12.3' with provider "azurerm" 2.20.0 with Azure DevOps

/opt/hostedtoolcache/terraform/0.12.3/x64/terraform apply -auto-approve azurerm_resource_group.example: Creating... azurerm_resource_group.example: Creation complete after 2s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12] azurerm_storage_account.example: Creating... azurerm_storage_account.example: Still creating... [10s elapsed] azurerm_storage_account.example: Still creating... [20s elapsed] azurerm_storage_account.example: Still creating... [30s elapsed] azurerm_storage_account.example: Creation complete after 31s [id=/subscriptions/xxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Storage/storageAccounts/examplesa3456] azurerm_sql_server.example: Creating... azurerm_sql_server.example: Still creating... [10s elapsed] azurerm_sql_server.example: Still creating... [20s elapsed] azurerm_sql_server.example: Still creating... [30s elapsed] azurerm_sql_server.example: Still creating... [40s elapsed] azurerm_sql_server.example: Still creating... [50s elapsed] azurerm_sql_server.example: Creation complete after 57s [id=/subscriptions/xxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Sql/servers/mssqlserver123]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed. Finishing: TerraformTaskV1

bkarlen commented 4 years ago

I am using terraformVersion: '0.12.3' with provider "azurerm" 2.20.0 with Azure DevOps This is part of my terraform

data "azurerm_resource_group" "rg" { name = "${var.resource_group_name}-${var.environment}" }

resource "azurerm_storage_account" "sasql" { name = "sasqlsecurity${var.environment}" resource_group_name = data.azurerm_resource_group.rg.name location = data.azurerm_resource_group.rg.location account_tier = "Standard" account_replication_type = "LRS" tags = local.tags }

resource "azurerm_storage_container" "vulnerabilitycontainer" { name = "vulnerabilityscanscontainer" storage_account_name = azurerm_storage_account.sasql.name container_access_type = "private" }

resource "azurerm_log_analytics_workspace" "lawsql" { name = "lawsql-${var.environment}" location = data.azurerm_resource_group.rg.location resource_group_name = data.azurerm_resource_group.rg.name sku = "PerGB2018" retention_in_days = 91 }

resource "azurerm_log_analytics_solution" "lawsqlsolution" { solution_name = "SQLAssessment" location = data.azurerm_resource_group.rg.location resource_group_name = data.azurerm_resource_group.rg.name workspace_resource_id = azurerm_log_analytics_workspace.lawsql.id workspace_name = azurerm_log_analytics_workspace.lawsql.name

plan { publisher = "Microsoft" product = "OMSGallery/SQLAssessment" } }

resource "azurerm_sql_server" "SqlServer" { name = "sqlappserver-${var.environment}" resource_group_name = data.azurerm_resource_group.rg.name location = data.azurerm_resource_group.rg.location version = "12.0" administrator_login = var.login administrator_login_password = var.password extended_auditing_policy { storage_endpoint = azurerm_storage_account.sasql.primary_blob_endpoint storage_account_access_key = azurerm_storage_account.sasql.primary_access_key storage_account_access_key_is_secondary = true retention_in_days = 91 } tags = local.tags }

resource "azurerm_mssql_server_security_alert_policy" "fpplusalerts" { resource_group_name = data.azurerm_resource_group.rg.name server_name = azurerm_sql_server.SqlServer.name state = "Enabled" storage_endpoint = azurerm_storage_account.sasql.primary_blob_endpoint storage_account_access_key = azurerm_storage_account.sasql.primary_access_key email_account_admins = "true" email_addresses = ["emails@gmail.com"] retention_days = 91 }

resource "azurerm_mssql_server_vulnerability_assessment" "fpplusvulnerabilityassessments" { server_security_alert_policy_id = azurerm_mssql_server_security_alert_policy.fpplusalerts.id storage_container_path = "${azurerm_storage_account.sasql.primary_blob_endpoint}${azurerm_storage_container.vulnerabilitycontainer.name}/" storage_account_access_key = azurerm_storage_account.sasql.primary_access_key

recurring_scans { enabled = true email_subscription_admins = true emails = ["emails@gmail.com"] } }

It is still stalling out on creating the server.

bkarlen commented 4 years ago

I have removed all the tf other than creating the server and it is still stalling out.

amanpurwar1 commented 4 years ago

You’re trying to say that you have removed all tf modules now you’re are provisioning Sql server only and still it is stalling out ?

amanpurwar1 commented 4 years ago

This tf conf. is working fine for me

resource "azurerm_resource_group" "example" { name = "database-rg12" location = "West US" }

resource "azurerm_storage_account" "example" { name = "examplesa3456" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location account_tier = "Standard" account_replication_type = "LRS" }

resource "azurerm_storage_container" "storage_container" { name = "container1159" storage_account_name = azurerm_storage_account.example.name container_access_type = "private" }

resource "azurerm_sql_server" "example" { name = "mssqlserver123" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location version = "12.0" administrator_login = "mradministrator" administrator_login_password = "thisIsDog11"

extended_auditing_policy { storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint storage_account_access_key = azurerm_storage_account.example.primary_access_key storage_account_access_key_is_secondary = true retention_in_days = 6 }

tags = { environment = "production" } }

resource "azurerm_mssql_server_security_alert_policy" "example" { resource_group_name = azurerm_resource_group.example.name server_name = azurerm_sql_server.example.name state = "Enabled" storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint storage_account_access_key = azurerm_storage_account.example.primary_access_key disabled_alerts = [ "Sql_Injection", "Data_Exfiltration" ] retention_days = 20 }

resource "azurerm_mssql_server_vulnerability_assessment" "example" { server_security_alert_policy_id = azurerm_mssql_server_security_alert_policy.example.id storage_container_path = "${azurerm_storage_account.example.primary_blob_endpoint}${azurerm_storage_container.storage_container.name}/" storage_account_access_key = azurerm_storage_account.example.primary_access_key

recurring_scans { enabled = true email_subscription_admins = true emails = [ "aman@gmail.com" ] } } resource "azurerm_log_analytics_workspace" "lawsql" { name = "lawsql" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name sku = "PerGB2018" retention_in_days = 91 }

resource "azurerm_log_analytics_solution" "lawsqlsolution" { solution_name = "SQLAssessment" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name workspace_resource_id = azurerm_log_analytics_workspace.lawsql.id workspace_name = azurerm_log_analytics_workspace.lawsql.name

plan { publisher = "Microsoft" product = "OMSGallery/SQLAssessment" } }

amanpurwar1 commented 4 years ago

Find the Build log


2020-07-26T07:44:23.9101467Z [command]/opt/hostedtoolcache/terraform/0.12.3/x64/terraform providers 2020-07-26T07:44:23.9397461Z . 2020-07-26T07:44:23.9398275Z └── provider.azurerm ~>2.0 2020-07-26T07:44:23.9398423Z 2020-07-26T07:44:23.9400649Z [command]/opt/hostedtoolcache/terraform/0.12.3/x64/terraform validate 2020-07-26T07:44:25.0122978Z Success! The configuration is valid. 2020-07-26T07:44:25.0124057Z  2020-07-26T07:44:25.0226101Z [command]/opt/hostedtoolcache/terraform/0.12.3/x64/terraform apply -auto-approve 2020-07-26T07:44:32.2691571Z azurerm_resource_group.example: Creating... 2020-07-26T07:44:34.4453752Z azurerm_resource_group.example: Creation complete after 2s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12] 2020-07-26T07:44:34.4622740Z azurerm_log_analytics_workspace.lawsql: Creating... 2020-07-26T07:44:34.4705276Z azurerm_storage_account.example: Creating... 2020-07-26T07:44:44.4627649Z azurerm_log_analytics_workspace.lawsql: Still creating... [10s elapsed] 2020-07-26T07:44:44.4664240Z azurerm_storage_account.example: Still creating... [10s elapsed] 2020-07-26T07:44:47.2261546Z azurerm_log_analytics_workspace.lawsql: Creation complete after 13s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourcegroups/database-rg12/providers/microsoft.operationalinsights/workspaces/lawsql] 2020-07-26T07:44:47.2311486Z azurerm_log_analytics_solution.lawsqlsolution: Creating... 2020-07-26T07:44:54.4669810Z azurerm_storage_account.example: Still creating... [20s elapsed] 2020-07-26T07:44:57.2316070Z azurerm_log_analytics_solution.lawsqlsolution: Still creating... [10s elapsed] 2020-07-26T07:44:59.1850907Z azurerm_log_analytics_solution.lawsqlsolution: Creation complete after 12s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourcegroups/database-rg12/providers/Microsoft.OperationsManagement/solutions/SQLAssessment(lawsql)] 2020-07-26T07:45:04.4672679Z azurerm_storage_account.example: Still creating... [30s elapsed] 2020-07-26T07:45:07.1629765Z azurerm_storage_account.example: Creation complete after 33s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Storage/storageAccounts/examplesa3456] 2020-07-26T07:45:07.1679252Z azurerm_storage_container.storage_container: Creating... 2020-07-26T07:45:07.1739841Z azurerm_sql_server.example: Creating... 2020-07-26T07:45:09.0046546Z azurerm_storage_container.storage_container: Creation complete after 2s [id=https://examplesa3456.blob.core.windows.net/container1159] 2020-07-26T07:45:17.1737304Z azurerm_sql_server.example: Still creating... [10s elapsed] 2020-07-26T07:45:27.1740608Z azurerm_sql_server.example: Still creating... [20s elapsed] 2020-07-26T07:45:37.1739192Z azurerm_sql_server.example: Still creating... [30s elapsed] 2020-07-26T07:45:47.1742957Z azurerm_sql_server.example: Still creating... [40s elapsed] 2020-07-26T07:45:57.1744888Z azurerm_sql_server.example: Still creating... [50s elapsed] 2020-07-26T07:46:03.8176197Z azurerm_sql_server.example: Creation complete after 57s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Sql/servers/mssqlserver123] 2020-07-26T07:46:03.8254205Z azurerm_mssql_server_security_alert_policy.example: Creating... 2020-07-26T07:46:13.8249215Z azurerm_mssql_server_security_alert_policy.example: Still creating... [10s elapsed] 2020-07-26T07:46:23.8245141Z azurerm_mssql_server_security_alert_policy.example: Still creating... [20s elapsed] 2020-07-26T07:46:33.8247216Z azurerm_mssql_server_security_alert_policy.example: Still creating... [30s elapsed] 2020-07-26T07:46:43.8252019Z azurerm_mssql_server_security_alert_policy.example: Still creating... [40s elapsed] 2020-07-26T07:46:53.8253996Z azurerm_mssql_server_security_alert_policy.example: Still creating... [50s elapsed] 2020-07-26T07:47:03.8255929Z azurerm_mssql_server_security_alert_policy.example: Still creating... [1m0s elapsed] 2020-07-26T07:47:06.9531018Z azurerm_mssql_server_security_alert_policy.example: Creation complete after 1m3s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Sql/servers/mssqlserver123/securityAlertPolicies/Default] 2020-07-26T07:47:06.9532257Z azurerm_mssql_server_vulnerability_assessment.example: Creating... 2020-07-26T07:47:10.4996445Z azurerm_mssql_server_vulnerability_assessment.example: Creation complete after 3s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/database-rg12/providers/Microsoft.Sql/servers/mssqlserver123/vulnerabilityAssessments/Default] 2020-07-26T07:47:10.5064805Z  2020-07-26T07:47:10.5065408Z Apply complete! Resources: 8 added, 0 changed, 0 destroyed. 2020-07-26T07:47:10.5492407Z ##[section]Finishing: TerraformTaskV1

bkarlen commented 4 years ago

data.azurerm_resource_group.rg: Refreshing state... azurerm_log_analytics_workspace.lawsql: Creating... azurerm_storage_account.sasql: Creating... azurerm_log_analytics_workspace.lawsql: Creation complete after 4s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourcegroups/rg-data-staging/providers/microsoft.operationalinsights/workspaces/lawsql-staging] azurerm_storage_account.sasql: Still creating... [10s elapsed] azurerm_storage_account.sasql: Creation complete after 20s [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/rg-data-staging/providers/Microsoft.Storage/storageAccounts/sasqlsecuritystaging] azurerm_storage_container.vulnerabilitycontainer: Creating... azurerm_sql_server.FINPACKPlusServer: Creating... azurerm_storage_container.vulnerabilitycontainer: Creation complete after 0s [id=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx.blob.core.windows.net/vulnerabilityscanscontainer] azurerm_sql_server.FINPACKPlusServer: Still creating... [10s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [20s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [30s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [40s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [50s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m0s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m10s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m20s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m30s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m40s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [1m50s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m0s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m10s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m20s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m30s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m40s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [2m50s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [3m0s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [3m10s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [3m20s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [3m30s elapsed] azurerm_sql_server.FINPACKPlusServer: Still creating... [3m40s elapsed] ... It just continues until the build agent cancels the job.

amanpurwar1 commented 4 years ago

Tf configuration is fine or else check with your pipeline steps

bkarlen commented 4 years ago

this is just one step, the Tf validate and apply provided by microsoft. I will open an issue on their github.

bkarlen commented 4 years ago

An ongoing logical server request is already in progress, please try your request again later. (Server Name: FINPACKPlusServer.... there was a problem with there being a cached request and it wasn't clearing

tombuildsstuff commented 4 years ago

hi @bkarlen

Thanks for opening this issue.

This forum is intended to be used for feature enhancements and bugs in the Azure Provider - so that we can keep this forum focused on that we instead ask that broader questions are raised using one of the Community Resources. As such I'm going to close this issue for the moment, but I believe you should be able to get an answer for this using one of the Community Resources.

Thanks!

ghost commented 4 years 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!