dnsimple / terraform-provider-dnsimple

Terraform DNSimple provider.
https://www.terraform.io/docs/providers/dnsimple/
Mozilla Public License 2.0
22 stars 20 forks source link

Migrates to the Terraform SDK v2 #37

Closed ecomba closed 3 years ago

ecomba commented 3 years ago

This PR makes sure our provider works with the v2 version of the Terraform Provider SDK.

weppos commented 3 years ago

It turns out we can drop vendor now. This is a conversation in the official Terraform channel.

Screenshot 2021-07-20 at 21 00 36 Screenshot 2021-07-20 at 21 01 14

Maybe it's worth doing it in the main branch in one shot, and then merge back the main branch here so that we have the most recent strategy. WDYT?

ecomba commented 3 years ago

Maybe it's worth doing it in the main branch in one shot, and then merge back the main branch here so that we have the most recent strategy. WDYT?

I think it would be way better if we could get rid of the /vendor . I agree that a good way of doing so is to do what you proposed (remove in main and merge back to this branch)!

ecomba commented 3 years ago

I believe the presence of the /vendor may somehow confuse the IDE. However, the point is I recall Terraform used to request to vendor all dependencies to prevent issues with dependency resolution. That's why you also see in this PR you deleted a bunch of files in vendor.

I don't know if this is still the case, if so we could remove the /vendor completely. If not, then we will have to continue vendor dependencies, which means this PR actually needs the new v2 module being vendored, I believe the command is go mod vendor.

It may be worth to check if vendoring is still required/recommended by HashiCorp after the switch to their Registry provisioning system. It was before, can't tell if still it is.

I deleted the /vendor directory in my local copy and ran all the tests. Everything works as expected. 👍🏼

ecomba commented 3 years ago

Good work 👏 . Tests passes.

➜  terraform-provider-dnsimple git:(update-terraform-sdk-to-v2) ✗ TF_ACC=1 DNSIMPLE_TOKEN=xxx DNSIMPLE_ACCOUNT=xx DNSIMPLE_DOMAIN=xxx DNSIMPLE_SANDBOX=true make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v  -timeout 120m
?     github.com/terraform-providers/terraform-provider-dnsimple  [no test files]
=== RUN   TestAccDnsimpleEmailForward_import
--- PASS: TestAccDnsimpleEmailForward_import (4.02s)
=== RUN   TestAccDnsimpleRecord_import
--- PASS: TestAccDnsimpleRecord_import (3.10s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_sandbox
--- PASS: TestProvider_sandbox (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccCheckDNSimpleEmailForwardConfig_Basic
--- PASS: TestAccCheckDNSimpleEmailForwardConfig_Basic (3.09s)
=== RUN   TestAccDNSimpleRecord_Basic
--- PASS: TestAccDNSimpleRecord_Basic (2.97s)
=== RUN   TestAccDNSimpleRecord_CreateMxWithPriority
--- PASS: TestAccDNSimpleRecord_CreateMxWithPriority (2.68s)
=== RUN   TestAccDNSimpleRecord_Updated
--- PASS: TestAccDNSimpleRecord_Updated (5.13s)
=== RUN   TestAccDNSimpleRecord_disappears
--- PASS: TestAccDNSimpleRecord_disappears (2.59s)
=== RUN   TestAccDNSimpleRecord_UpdatedMx
--- PASS: TestAccDNSimpleRecord_UpdatedMx (4.94s)
PASS
ok    github.com/terraform-providers/terraform-provider-dnsimple/dnsimple 28.911s

I commit a few code cleanup.

I saw that, thanks!