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

Use certificate name as primary identifier instead of ID #500

Merged
merged 14 commits into from Oct 13, 2020

Conversation

andrewsomething
Copy link
Member

@andrewsomething andrewsomething commented Oct 13, 2020

This builds on the work originally done by @snormore in #320 making name the primary identifier for a certificate. This is needed as when the certificate type is lets_encrypt, the certificate ID will change on renewal (after 3 months).

This goes further than that PR in a few ways:

  • It uses v0.12 Terraform SDK state migrations rather than the older v0.11 StateUpgrader.
  • It handles the changes needed in the digitalocean_cdn resource as well as the digitalocean_loadbalancer and digitalocean_certificate resources.
  • For digitalocean_cdn and digitalocean_loadbalancer, it deprecates the certificate_id attribute in favor of certificate_name for clarity.
$ make testacc TESTARGS="-run='TestAccDigitalOceanLoadbalancer|TestAccDigitalOceanCertificate|TestAccDigitalOceanCDN' -parallel=20 -count=1"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run='TestAccDigitalOceanLoadbalancer|TestAccDigitalOceanCertificate|TestAccDigitalOceanCDN' -parallel=20 -count=1 -timeout 120m
?       github.com/digitalocean/terraform-provider-digitalocean [no test files]
=== RUN   TestAccDigitalOceanCertificate_importBasic
--- PASS: TestAccDigitalOceanCertificate_importBasic (12.93s)
=== RUN   TestAccDigitalOceanCDN_Create
--- PASS: TestAccDigitalOceanCDN_Create (28.78s)
=== RUN   TestAccDigitalOceanCDN_Create_with_TTL
--- PASS: TestAccDigitalOceanCDN_Create_with_TTL (27.75s)
=== RUN   TestAccDigitalOceanCDN_Create_and_Update
--- PASS: TestAccDigitalOceanCDN_Create_and_Update (32.77s)
=== RUN   TestAccDigitalOceanCertificate_Basic
=== PAUSE TestAccDigitalOceanCertificate_Basic
=== RUN   TestAccDigitalOceanCertificate_ExpectedErrors
=== PAUSE TestAccDigitalOceanCertificate_ExpectedErrors
=== RUN   TestAccDigitalOceanLoadbalancer_Basic
=== PAUSE TestAccDigitalOceanLoadbalancer_Basic
=== RUN   TestAccDigitalOceanLoadbalancer_Updated
=== PAUSE TestAccDigitalOceanLoadbalancer_Updated
=== RUN   TestAccDigitalOceanLoadbalancer_dropletTag
=== PAUSE TestAccDigitalOceanLoadbalancer_dropletTag
=== RUN   TestAccDigitalOceanLoadbalancer_minimal
=== PAUSE TestAccDigitalOceanLoadbalancer_minimal
=== RUN   TestAccDigitalOceanLoadbalancer_stickySessions
=== PAUSE TestAccDigitalOceanLoadbalancer_stickySessions
=== RUN   TestAccDigitalOceanLoadbalancer_sslTermination
=== PAUSE TestAccDigitalOceanLoadbalancer_sslTermination
=== RUN   TestAccDigitalOceanLoadbalancer_sslCertByName
=== PAUSE TestAccDigitalOceanLoadbalancer_sslCertByName
=== RUN   TestAccDigitalOceanLoadbalancer_multipleRules
=== PAUSE TestAccDigitalOceanLoadbalancer_multipleRules
=== RUN   TestAccDigitalOceanLoadbalancer_WithVPC
=== PAUSE TestAccDigitalOceanLoadbalancer_WithVPC
=== CONT  TestAccDigitalOceanCertificate_Basic
=== CONT  TestAccDigitalOceanLoadbalancer_stickySessions
=== CONT  TestAccDigitalOceanLoadbalancer_multipleRules
=== CONT  TestAccDigitalOceanLoadbalancer_minimal
=== CONT  TestAccDigitalOceanLoadbalancer_Basic
=== CONT  TestAccDigitalOceanLoadbalancer_dropletTag
=== CONT  TestAccDigitalOceanCertificate_ExpectedErrors
=== CONT  TestAccDigitalOceanLoadbalancer_sslCertByName
=== CONT  TestAccDigitalOceanLoadbalancer_WithVPC
=== CONT  TestAccDigitalOceanLoadbalancer_sslTermination
=== CONT  TestAccDigitalOceanLoadbalancer_Updated
--- PASS: TestAccDigitalOceanCertificate_ExpectedErrors (0.16s)
--- PASS: TestAccDigitalOceanCertificate_Basic (12.62s)
--- PASS: TestAccDigitalOceanLoadbalancer_multipleRules (70.09s)
--- PASS: TestAccDigitalOceanLoadbalancer_sslTermination (83.53s)
--- PASS: TestAccDigitalOceanLoadbalancer_sslCertByName (103.48s)
--- PASS: TestAccDigitalOceanLoadbalancer_dropletTag (115.16s)
--- PASS: TestAccDigitalOceanLoadbalancer_minimal (134.06s)
--- PASS: TestAccDigitalOceanLoadbalancer_stickySessions (134.09s)
--- PASS: TestAccDigitalOceanLoadbalancer_Basic (134.34s)
--- PASS: TestAccDigitalOceanLoadbalancer_WithVPC (135.01s)
--- PASS: TestAccDigitalOceanLoadbalancer_Updated (160.71s)
PASS
ok      github.com/digitalocean/terraform-provider-digitalocean/digitalocean    263.117s
testing: warning: no tests to run
PASS
ok      github.com/digitalocean/terraform-provider-digitalocean/internal/datalist       0.006s [no tests to run]

Closes: #318

@andrewsomething andrewsomething requested a review from snormore Oct 13, 2020
Copy link
Contributor

@snormore snormore left a comment

👍

@andrewsomething andrewsomething merged commit c0a4d34 into master Oct 13, 2020
1 check passed
@andrewsomething andrewsomething deleted the cert-id-name branch Oct 13, 2020
olaven added a commit to olaven/paperpod that referenced this issue Jul 3, 2021
Digitalocean provider used to use loadbalancer is as primary identifier,
however, their API requires this to be different for it to be counted
as an update rather than duplicate - which throws errors.

Now using name, as per digitalocean/terraform-provider-digitalocean#500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants