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

[v0.10.2] refresh can't detect sql-server and sql database were removed #255

Closed
810123 opened this issue Aug 18, 2017 · 3 comments · Fixed by #289
Closed

[v0.10.2] refresh can't detect sql-server and sql database were removed #255

810123 opened this issue Aug 18, 2017 · 3 comments · Fixed by #289
Labels

Comments

@810123
Copy link

810123 commented Aug 18, 2017

Terraform Version

0.10.2

Affected Resource(s)

Please list the resources as a list, for example:
azurerm_sql_server.server
azurerm_sql_database.db

Terraform Configuration Files

resource "azurerm_resource_group" "rg" {
  name     = "${var.resource_group}"
  location = "${var.location}"
}

resource "azurerm_sql_database" "db" {
  name                             = "mysqldatabase"
  resource_group_name              = "${azurerm_resource_group.rg.name}"
  location                         = "${var.location}"
  edition                          = "Basic"
  collation                        = "SQL_Latin1_General_CP1_CI_AS"
  create_mode                      = "Default"
  requested_service_objective_name = "Basic"
  server_name                      = "${azurerm_sql_server.server.name}"
}

resource "azurerm_sql_server" "server" {
  name                         = "${var.resource_group}-sqlsvr"
  resource_group_name          = "${azurerm_resource_group.rg.name}"
  location                     = "${var.location}"
  version                      = "12.0"
  administrator_login          = "${var.sql_admin}"
  administrator_login_password = "${var.sql_password}"
}

resource "azurerm_sql_firewall_rule" "fw" {
  name                = "firewallrules"
  resource_group_name = "${azurerm_resource_group.rg.name}"
  server_name         = "${azurerm_sql_server.server.name}"
  start_ip_address    = "0.0.0.0"
  end_ip_address      = "0.0.0.0"
}

Debug Output

Manually delete sqldatabase and sqlserver from azure portal, then run terraform refresh command. It said the sources were not found.

azurerm_resource_group.production: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-a20de02f24d5/resourceGroups/production)
azurerm_resource_group.rg: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-a20de02f24d5/resourceGroups/deploy2)
azurerm_sql_server.server: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...s/Microsoft.Sql/servers/deploy2-sqlsvr)
azurerm_virtual_network.network: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...work/virtualNetworks/productionNetwork)
Error refreshing state: 1 error(s) occurred:

* azurerm_sql_server.server: 1 error(s) occurred:

* azurerm_sql_server.server: azurerm_sql_server.server: Error reading SQL Server: ResourceNotFound (404) - The Resource 'Microsoft.Sql/servers/deploy2-sqlsvr' under resource group 'deploy2' was not found.
azurerm_resource_group.production: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-a20de02f24d5/resourceGroups/production)
azurerm_resource_group.rg: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-a20de02f24d5/resourceGroups/deploy2)
azurerm_virtual_network.network: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...work/virtualNetworks/productionNetwork)
azurerm_sql_server.server: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...s/Microsoft.Sql/servers/deploy2-sqlsvr)
azurerm_sql_firewall_rule.fw: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...oy2-sqlsvr/firewallRules/firewallrules)
azurerm_sql_database.db: Refreshing state... (ID: /subscriptions/ac4f6769-2698-4179-b24d-...deploy2-sqlsvr/databases/mysqldatabase)
Error refreshing state: 1 error(s) occurred:

* azurerm_sql_database.db: 1 error(s) occurred:

* azurerm_sql_database.db: azurerm_sql_database.db: Error reading SQL Database: ResourceNotFound (404) - The Resource 'Microsoft.Sql/servers/deploy2-sqlsvr/databases/mysqldatabase' under resource group 'deploy2' was not found.

Expected Behavior

The removed service or resource should be detected.

@810123 810123 changed the title [v0.10.2] refresh can't detect sql-server and sql database are removed [v0.10.2] refresh can't detect sql-server and sql database were removed Aug 18, 2017
@dominik-lekse
Copy link
Contributor

I experienced the same issue. This will be fixed in #189, #190, and #191 .

@tombuildsstuff
Copy link
Contributor

This will be fixed in #289

@ghost
Copy link

ghost commented Apr 1, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants