Commit Graph

9 Commits

Author SHA1 Message Date
Paul Stack 655147c103 Upgrade to terraform-plugin-sdk (#321)
* Upgrade to terraform-plugin-sdk

After following the [guide](https://www.terraform.io/docs/extend/plugin-sdk.html#using-tf-sdk-migrator)

Check

```
▶ GO111MODULE=on tf-sdk-migrator check
Checking Go runtime version ...
Go version 1.12.10: OK.
Checking whether provider uses Go modules...
Go modules in use: OK.
Checking version of github.com/hashicorp/terraform-plugin-sdk to determine if provider was already migrated...
Checking version of github.com/hashicorp/terraform used in provider...
Terraform version 0.12.8: OK.
Checking whether provider uses deprecated SDK packages or identifiers...
No imports of deprecated SDK packages or identifiers: OK.

All constraints satisfied. Provider can be migrated to the new SDK.
```

Migrate

```
▶ GO111MODULE=on tf-sdk-migrator migrate
Checking Go runtime version ...
Go version 1.12.10: OK.
Checking whether provider uses Go modules...
Go modules in use: OK.
Checking version of github.com/hashicorp/terraform-plugin-sdk to determine if provider was already migrated...
Checking version of github.com/hashicorp/terraform used in provider...
Terraform version 0.12.8: OK.
Checking whether provider uses deprecated SDK packages or identifiers...
No imports of deprecated SDK packages or identifiers: OK.

All constraints satisfied. Provider can be migrated to the new SDK.

Rewriting provider go.mod file...
Rewriting SDK package imports...
Running `go mod tidy`...
Success! Provider is migrated to github.com/hashicorp/terraform-plugin-sdk v1.1.0.

It looks like this provider vendors dependencies. Don't forget to run `go mod vendor`.
Make sure to review all changes and run all tests.
```

* Fix build under go 1.13.x.
2019-10-22 17:44:03 -04:00
Andrew Starr-Bochicchio dfe37acbc0 Certificates: Move attribute validation from CustomizeDiff to Create (Fixes: #163).
When CustomizeDiff is run for a new resource, it does not have access to the
current state. In the digitalocean_certificate resource, we are using a
CustomizeDiff function to validate that certain attributes are used together
depending on the certificate type. When the value for one of those attributes
is interpolated, as in the case of generating a cert using the acme provider,
the validation fails since it depends on reading the value from state. As state
is not present, the value is interpreted as empty.

From the CustomizeDiff doc string:

> // The phases Terraform runs this in, and the state available via functions
> // like Get and GetChange, are as follows:
> //
> //  * New resource: One run with no state

https://godoc.org/github.com/hashicorp/terraform/helper/schema#Resource

This PR moves the validation from the CustomizeDiff function into the
Create function as well as adding acceptance tests:

```
$ make testacc TESTARGS='-run=TestAccDigitalOceanCertificate_ExpectedErrors'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDigitalOceanCertificate_ExpectedE$
?       github.com/terraform-providers/terraform-provider-digitalocean  [no test files]
=== RUN   TestAccDigitalOceanCertificate_ExpectedErrors
--- PASS: TestAccDigitalOceanCertificate_ExpectedErrors (0.10s)
PASS
ok      github.com/terraform-providers/terraform-provider-digitalocean/digitalocean     (cached)
```
2019-03-28 14:13:22 -04:00
Andrew Starr-Bochicchio baf11ca2cc Update all resources and datasources to use new method of accessing the godo client. 2019-01-07 18:48:17 -05:00
Andrew Starr-Bochicchio 9be11e1e5c Add explanitory comment. 2018-10-04 14:26:28 -04:00
Andrew Starr-Bochicchio bc91bcb4f6 Suppress diff for dns names on custom certificate resources (Fixes: #146). 2018-10-04 11:41:55 -04:00
Tilen Faganel c2e8f204f0
Fixed a debug message typo 2018-09-04 20:02:05 +01:00
Tilen Faganel b0da0f9bb3
Added support for LetsEncrypt issued certificates 2018-08-30 15:43:32 +01:00
Andrew Starr-Bochicchio 1a5c46a1ac
Add importability for Load Balancers and Certificate. (#104)
* Added importability for load balancer

* Added importability, go fmt'ed

* Added importability for DNS records

* added importability for certificates

* Added import notes for DNS records and load balancers

* Added import tests

* Added random int for test configs

* Added certificates for the test to import

* Fixed docs, added certificate importability on docs

* Make TestAccDigitalOceanCertificate_importBasic pass by reusing certificate generation from resource_digitalocean_certificate_test.go

* Fix importablity of Load Balancer Droplet droplet_ids.

* Revert "Added importability for DNS records"

This reverts commit 94b1f69fe756c862125d0b899d49eca74f7bd591.

* Remove mention of record imports in docs.

* Remove digitalocean/import_digitalocean_record_test.go
2018-06-25 19:38:10 -04:00
Jake Champlin ddd64aa789
Transfer digitalocean provider 2017-06-06 11:45:13 -04:00
Renamed from resource_digitalocean_certificate.go (Browse further)