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

Fix #196 creating a database with create_mode PointInTimeRestore fails #197

Merged
merged 3 commits into from Jul 31, 2017

Conversation

oguzkilcan
Copy link
Contributor

No description provided.

@grubernaut grubernaut added the bug label Jul 26, 2017
@sebastus
Copy link
Contributor

This one conflicts with PR #191. @ouzklcn what are the details of your test? I'll test similarly with my updated sql db provider.

@oguzkilcan
Copy link
Contributor Author

@sebastus You can use below resource template for testing. If you like I can fork your code fix it and open a PR to your branch as well.

resource "azurerm_sql_database" "sql_db" {
  name                  = "test-restore"
  resource_group_name   = "testdb-rg"
  location              = "West Europe"
  server_name           = "testdb-server"
  create_mode           = "PointInTimeRestore"
  source_database_id    = "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testdb-rg/providers/Microsoft.Sql/servers/testdb-server/databases/testdb"
  restore_point_in_time = "2017-07-28T08:24:37.467Z"
}

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ouzklcn

Thanks for this PR - apologies for the delay in reviewing this!

This change LGTM - would it be possible to add an acceptance test for this change so we can verify it's functioning as intended? Here's an example from the azurerm_sql_database resource.

Thanks!

@oguzkilcan
Copy link
Contributor Author

Hey @tombuildsstuff

I added a test. You can find it's output below.

~/go/src/github.com/ouzklcn/terraform-provider-azurerm/azurerm$ TF_ACC=1 go test -v -run TestAccAzureRMSqlDatabase_restorePointInTime  -timeout 30m
=== RUN   TestAccAzureRMSqlDatabase_restorePointInTime
--- PASS: TestAccAzureRMSqlDatabase_restorePointInTime (1377.12s)
PASS
ok  	github.com/ouzklcn/terraform-provider-azurerm/azurerm	1377.138s

Unfortunately, as you can see from the output, it takes a lot time complete. Azure does not immediately creates a restorable backup once it creates a database. It takes around 10 minutes. Because of that I need to set the test to sleep for a reasonable time to wait Azure.

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ouzklcn

Thanks for pushing those changes - I've taken another look and this LGTM :)

Tests pass:

$ TF_ACC=1 envchain azurerm go test ./azurerm -v -timeout 120m -run TestAccAzureRMSqlDatabase_

=== RUN   TestAccAzureRMSqlDatabase_basic
--- PASS: TestAccAzureRMSqlDatabase_basic (170.06s)
=== RUN   TestAccAzureRMSqlDatabase_elasticPool
--- PASS: TestAccAzureRMSqlDatabase_elasticPool (265.52s)
=== RUN   TestAccAzureRMSqlDatabase_withTags
--- PASS: TestAccAzureRMSqlDatabase_withTags (301.37s)
=== RUN   TestAccAzureRMSqlDatabase_datawarehouse
--- PASS: TestAccAzureRMSqlDatabase_datawarehouse (296.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1033.369s

Thanks!

@tombuildsstuff tombuildsstuff merged commit 6669b4b into hashicorp:master Jul 31, 2017
tombuildsstuff added a commit that referenced this pull request Jul 31, 2017
@oguzkilcan oguzkilcan deleted the resource_arm_sql_database branch September 28, 2017 09:35
@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!

@hashicorp hashicorp 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 this pull request may close these issues.

None yet

4 participants