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

New Resource & Data Source: azurerm_data_migration_service #5258

Merged
merged 19 commits into from
Mar 4, 2020

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Dec 26, 2019

Add new resource: data migration service.

This is the first resource under DataMigration resource provider.

There are more resources to come (which are not included in this PR):

  • data migration project
  • data migration task

I will implement those two resources after this PR is merged since they depends on data migration service.

Check feature request #5257 for more details.

@magodo
Copy link
Collaborator Author

magodo commented Dec 26, 2019

This PR depends on #5259

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @magodo, iv'e left some comments inline that need to be addressed before we merge this

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @magodo, iv'e left some comments inline that need to be addressed before we merge this

@ghost ghost added size/XXL dependencies and removed size/XL labels Dec 26, 2019
Mostly include:

- order schema
- add validation func for `name`, `sku_name`
- unexport `provisioning_state`
- unexport `delete_running_task`
- add nil check for `sku`
- add dedicated update acctest
- modify naming in acctest config
- modify document for r/d
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the revisions @magodo, i've left some more comments inline

@magodo magodo requested a review from katbyte December 29, 2019 02:26
Copy link
Contributor

@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 @magodo

Thanks for this PR :)

Taking a look through this is looking good to me - if we can remove the data source, fix up the pending comments (and the tests pass) then this should otherwise be good 👍

Thanks!

Changes include:

- remove `kind` property from resource
- `resource_group_name` schema case sensitive
- acctest always ended with a import test step
- document changes

TBD:

- Whether need to remove data source?
- Shall we show this resource on website sidebar?
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @magodo, in addition to my comments it looks like you have a test failure:

Test Failed

------- Stdout: -------
=== RUN   TestAccAzureRMDataMigrationService_complete

panic: Invalid address to set: []string{"id"}



goroutine 328 [running]:

github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*ResourceData).Set(0xc000a317a0, 0x4061c0c, 0x2, 0x39b0140, 0xc0013a0ea0, 0x0, 0xdf8475800)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource_data.go:193 +0x354

github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datamigration.resourceArmDataMigrationServiceRead(0xc000a317a0, 0x3aa3100, 0xc001122240, 0x0, 0x0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datamigration/resource_arm_data_migration_service.go:158 +0x5ba

github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datamigration.resourceArmDataMigrationServiceCreate(0xc000a317a0, 0x3aa3100, 0xc001122240, 0x0, 0x0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datamigration/resource_arm_data_migration_service.go:133 +0xa38

github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000bfb980, 0xc000796050, 0xc00162c2a0, 0x3aa3100, 0xc001122240, 0xc001630301, 0xc001984150, 0xc0016303d0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource.go:305 +0x365

github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00148e400, 0xc001039918, 0xc000796050, 0xc00162c2a0, 0xc0016303e0, 0xc0008b9160, 0x3a7eae0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0x99

github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0008b84b8, 0x47dcf00, 0xc001942cc0, 0xc0015e3680, 0xc0008b84b8, 0xc001942cc0, 0xc00255da80)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:885 +0x882

github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x3e50c60, 0xc0008b84b8, 0x47dcf00, 0xc001942cc0, 0xc0015e3620, 0x0, 0x47dcf00, 0xc001942cc0, 0xc001629180, 0x370)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217

google.golang.org/grpc.(*Server).processUnaryRPC(0xc002be5080, 0x482eee0, 0xc001252000, 0xc0015f9100, 0xc0013fc0c0, 0x71d1ae0, 0x0, 0x0, 0x0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/google.golang.org/[email protected]/server.go:995 +0x460

google.golang.org/grpc.(*Server).handleStream(0xc002be5080, 0x482eee0, 0xc001252000, 0xc0015f9100, 0x0)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/google.golang.org/[email protected]/server.go:1275 +0xd97

google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc001097ea0, 0xc002be5080, 0x482eee0, 0xc001252000, 0xc0015f9100)

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/google.golang.org/[email protected]/server.go:710 +0xbb

created by google.golang.org/grpc.(*Server).serveStreams.func1

	/opt/teamcity-agent/work/dbea4b84960ec72a/pkg/mod/google.golang.org/[email protected]/server.go:708 +0xa1

FAIL	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datamigration/tests	942.276s

@magodo
Copy link
Collaborator Author

magodo commented Jan 1, 2020

Hi Kat, I rerun the test locally after apply your review comment, it works as expected. Not sure the cause of the error attached above.

@ghost ghost removed the waiting-response label Jan 1, 2020
@magodo magodo requested a review from katbyte January 1, 2020 10:32
@katbyte
Copy link
Collaborator

katbyte commented Jan 2, 2020

@magodo, we run tests with TF_SCHEMA_PANIC_ON_ERROR="1" as it'll do more checks such as erroring when you try and set an invalid property

@magodo
Copy link
Collaborator Author

magodo commented Jan 2, 2020

@katbyte, I run the acc test via makefile of the project. I think it had already export TF_SCHEMA_PANIC_ON_ERROR beforehead. Would you please recheck? (maybe the error has something to do with the review comment you pointed previously, about set Id a second time?)

@katbyte
Copy link
Collaborator

katbyte commented Jan 9, 2020

Tests are passing for us now 🎉

@magodo magodo requested a review from katbyte January 10, 2020 01:32
@katbyte katbyte changed the title new resource: data migration service New Resource & Data Source: azurerm_data_migration_service Jan 25, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @magodo, LGTM 👍

@katbyte katbyte added this to the v1.42.0 milestone Jan 25, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

@magodo, looks like CI errors needs to be fixed up, but once they are thus should be gtg

@katbyte katbyte modified the milestones: v1.42.0, v1.43.0 Jan 27, 2020
@magodo magodo requested a review from katbyte January 29, 2020 05:52
@magodo
Copy link
Collaborator Author

magodo commented Feb 3, 2020

@katbyte
The remaining CI error is because that the list of allowed resource providers doesn't contain this new resource provider.

@ghost ghost removed the waiting-response label Feb 3, 2020
@tombuildsstuff tombuildsstuff removed this from the v1.43.0 milestone Feb 3, 2020
1. rename resource to "database_migration_service" to comply to the
   naming of azure official document.
2. introduce custom id parse function.
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the revisions @magodo,

I've left some more (mostly) minor comments inline that one addressed this should be good to merge!

@magodo magodo requested a review from katbyte March 4, 2020 08:49
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for those changes @magodo. LGTM now 👍

@katbyte katbyte merged commit a5267dd into hashicorp:master Mar 4, 2020
katbyte added a commit that referenced this pull request Mar 4, 2020
@ghost
Copy link

ghost commented Apr 4, 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 👉 [email protected]. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants