Commit Graph

340 Commits

Author SHA1 Message Date
Tom Dyas f50c276f6e
upgrade provider to use terraform-plugin-sdk v2 (#492)
* upgrade terraform-plugin-sdk and `go mod vendor`

* Update digitalocean/datasource_digitalocean_image_test.go

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update digitalocean/datasource_digitalocean_kubernetes_cluster_test.go

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update digitalocean/datasource_digitalocean_vpc_test.go

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update digitalocean/datasource_digitalocean_vpc_test.go

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* go fmt

* fix droplet_id to be of the right type

* fix digitalocean_project resource

* fix creation order in digitalocean_certificate test

* fix digitalocean_container_registry data source tes

* Port new changes to v2.

* Port all tests to resource.ParallelTest

* Fix KubernetesProviderInteroperability test.

* Fix TestAccDigitalOceanKubernetesCluster_UpgradeVersion

* Fix firewall panic s/create_at/created_at/

* Fix TestAccDigitalOceanDroplet_Basic: Droplets now have private networking by default.

* Fix TestAccDataSourceDigitalOceanDomain_Basic

* Fix TestAccDataSourceDigitalOceanDropletSnapshot tests.

* Fix TestAccDataSourceDigitalOceanSSHKey_Basic

* Fix TestAccDataSourceDigitalOceanVolumeSnapshot tests.

* Fix TestAccDataSourceDigitalOceanVolume tests.

* Fix TestAccDataSourceDigitalOceanRecord_Basic

* Fix TestAccDataSourceDigitalOceanProject_NonDefaultProject

* Fix TestAccDigitalOceanImage_PublicSlug

* Fix TestAccDataSourceDigitalOceanImages_Basic via bug in imageSchema()

* go mod tidy

* Fix TestAccDataSourceDigitalOceanDroplet tests.

* Fix TestAccDataSourceDigitalOceanVPC_ByName

* Fix TestAccDataSourceDigitalOceanTag_Basic

* Fix TestAccDataSourceDigitalOceanTags_Basic

* Ensure versions are set in DBaaS tests.

* Fix TestAccDataSourceDigitalOceanApp_Basic

* Fix non-set related issues with TestAccDataSourceDigitalOceanLoadBalancer tests.

* Fix TestAccDataSourceDigitalOceanKubernetesCluster_Basic

* Remove testAccDigitalOceanKubernetesConfigWithEmptyNodePool: Empty node pools are no longer supported.

* Fix TestAccDigitalOceanProject_WithManyResources.

* Fix TestAccDigitalOceanProject_UpdateFromDropletToSpacesResource

* vendor set helpers from AWS provider

* Fix TestAccDigitalOceanFloatingIP_Droplet.

* Fix CDN panic.

* fix TestAccDigitalOceanSpacesBucket_LifecycleBasic using setutil helpers

* vendor set helpers from AWS provider

* fix TestAccDigitalOceanSpacesBucket_LifecycleBasic using setutil helpers

* Fix load balancer tests using setutil helpers.

* Fix K8s tests using setutil helpers.

* Fix TestAccDigitalOceanApp_Envs using setutil helpers.

* Fix TestAccDigitalOceanSpacesBucket_LifecycleExpireMarkerOnly using setutil helpers.

* Fix TestAccDigitalOceanFloatingIPAssignment_createBeforeDestroy

* fix remaining TypeSet tests using setutil

* Registry test can not run in parallel. One per account.

* Fix TestAccDigitalOceanProject_UpdateWithDropletResource

* Fix replica tests.

* go mod tidy

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-10-16 15:50:20 -04:00
Andrew Starr-Bochicchio c0a4d34366
Use certificate name as primary identifier instead of ID (#500)
* Use certificate name as primary identifier instead of ID
When the certificate type is lets_encrypt, the certificate ID will change when
it's renewed, so we have to rely on the certificate name as the primary
identifier instead.

* Support running LB and cert tests in parallel

* Add state migration for Certificate resource

* Add state migration for LoadBalancer resource

* Use resource.ParallelTest for tests.

* Use a v0.12-style StateUpgrader.

* loadbalancer: Fix panic in buildLoadBalancerRequest

* Add fallback to flattenForwardingRules to prevent error state when a hardcoded UUID is used.

* Fix typo in findCertificateByName.

* Deprecate forwarding_rule.certificate_id in favor of forwarding_rule.certificate_name

* Use a v0.12-style StateUpgrader for load balancer migration.

* Handle cert ID change in CDN resource.

* Clean up structure.

* Update documentation.

Co-authored-by: Steven Normore <snormore@digitalocean.com>
2020-10-13 15:45:34 -04:00
Andrew Starr-Bochicchio 99f86f4aaa
Add support for App Platform (#497)
* Bump godo version.

* Initial support for app service spec.

* Update godo

* Add support for static sites.

* Refactor to share appSpecComponentBase

* Add support for workers.

* Fix expandAppDomainSpec

* Add database support.

* Add first set of acceptance tests.

* Add test excercising envs.

* Add worker test.

* Add import test.

* Add sweeper.

* Add App data source.

* Add documentation for the resource.

* Add data source docs.

* Update health_check attributes.

* Use basic plan in acceptance tests.

* Test upgrading an app from basic to professional.

* Update waitForAppDeployment method.

* Fix env docs.

* Update digitalocean/datasource_digitalocean_app_test.go

Co-authored-by: Cesar Garza <scotch.neat@live.com>

* Simplify expand methods.

* Fix typo in sweeper log message.

Co-authored-by: Cesar Garza <scotch.neat@live.com>
2020-10-13 10:16:53 -04:00
Andrew Starr-Bochicchio 4c6b74bb0d
Fix and extend acceptance test sweeper. (#458)
* Fix sweeper.

* Sweep Kubernetes clusters.

* Sweep database clusters.

* Set defaults as the sweeper does not have access to the provider DefaultFunc

* Add warning to makefile target.
2020-10-13 09:56:22 -04:00
Tom Dyas b9f79b959d
add digitalocean_domains data source (#484)
* add digitalocean_domains data source

* add docs

* rebase - remove FilterKeys/SortKeys
2020-09-22 11:36:51 -04:00
Tom Dyas d221ecbe2f
infer the filter and sort keys for list data sources (#481)
* infer filter keys and sort keys from the record schema

* remove FilterKeys and SortKeys fields from data sources
2020-08-24 17:03:09 -04:00
CJ Harries d01eec6f7a Add created to SortKeys 2020-08-14 13:32:37 -05:00
Andrew Starr-Bochicchio 6d6236ea5b
Allow for SRV records with port 0. Fixes: #475 (#476)
* Import godo v1.42.1

* Allow for SRV records with port 0. Fixes: #475
2020-08-07 15:31:41 -04:00
Andrew Starr-Bochicchio a975f65832 Enable auto_upgrade on Kubernetes clusters (#457).
Squashed commit of the following:

commit 99a3619c0b0ab64522eeaff07d7c2284320c5439
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
Date:   Wed Jul 22 13:03:51 2020 -0400

    Clean up vendor directory.

commit 3eb854036619eff58b0c41679f5b314481292e70
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
Date:   Wed Jul 22 11:10:17 2020 -0400

    Re-run make fmt

commit e1fb81809e7e9580d5a34aa5cddacf90fd1de11a
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
Date:   Wed Jul 22 11:09:58 2020 -0400

    Convert bool to pointer.

commit aa32252028723bbbc29eeac85c38e8d68ba71a23
Author: Luke Farnell <lfarnell@outlook.com>
Date:   Tue Jul 21 23:13:56 2020 -0400

    Added documentation for using the data source.

commit 1ff5d0a92521ae16df0266d87438be16c6be1854
Author: Luke Farnell <lfarnell@outlook.com>
Date:   Tue Jul 21 22:32:05 2020 -0400

    Ran go mod vendor.

commit 22e0fb0a9940cb3fd7b080380f71f5e2a8dc0c13
Author: Luke Farnell <lfarnell@outlook.com>
Date:   Sun Jul 5 17:25:01 2020 -0400

    Add auto_upgrade docs.

commit 06d3aa84957341561c48c944abb6e8f5d00817bc
Author: Luke Farnell <lfarnell@outlook.com>
Date:   Sun Jul 5 17:00:45 2020 -0400

    Adding auto_upgrade.

Co-authored-by: Luke Farnell <lfarnell@outlook.com>
2020-07-22 13:16:35 -04:00
Andrew Starr-Bochicchio 11296f12ab
registry credentials: Update default expiry and don't ignore error (#467)
* Add test using the default expiry.

* Don't ignore error when calling updateExpiredDockerCredentials.

* Set default to the new max allowed by the API.
2020-07-21 15:35:19 -04:00
Varsha Varadarajan 1f18243ebc
kubernetes - add support for surge upgrades (#465)
* vendor: go get -d github.com/digitalocean/godo@v1.41.0

* kubernetes - add support for surge upgrades

* kubernetes - fix acceptance tests, add docs
2020-07-21 14:20:20 -04:00
Andrew Starr-Bochicchio affdc546ab
Update module and import paths for repository transfer. (#463) 2020-07-20 15:13:25 -04:00
George Cox 289c96e90b
digitalocean_loadbalancer - Adds 'https' to healthcheck protocols; (#460) 2020-07-14 15:57:41 -04:00
Andrew Starr-Bochicchio a2481529a5
Increase timeout on VPC deletion retry. (#455) 2020-07-08 09:49:15 -04:00
Andrew Starr-Bochicchio 068fc8affe
Add datasource_digitalocean_tags and expose resource counts. (#451) 2020-06-15 12:00:14 -04:00
Andrew Starr-Bochicchio aac799017a
Set ID in flattenDigitalOceanDroplet. (#450) 2020-06-15 10:25:58 -04:00
Mason Egger 9ea6d36b0e
adding Container Registry support (#383)
* adding Container Registry support

* adding endpoint and docker_credentials as attributes to datasource

* updating documentation on how to use the endpoint attribute

* adding a server_url attribute

* adding tests, exporting attributes from resources, fixing go.sum, updating docs

* adding update function and splitting out generateDockerCreds into a separate function

* updating acceptance tests and docs

* Update website/docs/d/container_registry.html.md

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update website/docs/d/container_registry.html.md

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update website/docs/d/container_registry.html.md

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* adding kubernetes example

* adding note about container registry beta

* removing TODOs

* partial push

* almost done, odd error in import test and waiting for final default value

* setting default for expiry_seconds and creating custom importer

* creating new resource for docker credentials

* fixed tiny bug in testing

* Update website/docs/r/container_registry_docker_credentials.html.markdown

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update website/docs/r/container_registry_docker_credentials.html.markdown

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Final tweaks as requested

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
2020-06-03 16:30:15 -05:00
Andrew Starr-Bochicchio cd6a218fd1
dbaas: Add support for specifying a VPC for read-only replicas. (#440) 2020-06-03 17:22:30 -04:00
Kaden Nelson fd9e7b8b81
Add forcenew to vpc_uuid field of kubernetes cluster resource (#444) 2020-05-30 14:24:46 -04:00
Andrew Starr-Bochicchio b069a9949d
kubernetes: Re-work tests to no longer rely on hard-coded versions. (#438) 2020-05-13 17:35:26 -04:00
Andrew Starr-Bochicchio ae4578c0e5
kubernetes: Fail faster on cluster create error (fixes: #434). (#435)
* kubernetes: Fail faster on cluster create error (fixes: #434).

* Bump k8s test version slugs.
2020-05-13 17:08:17 -04:00
Jose Diaz-Gonzalez f4ae42123d
fix: correct spelling (#439) 2020-05-12 08:52:32 -04:00
Paul Stack d19034e916
Making SpacesAPI Endpoint optional (#431) 2020-05-05 13:19:45 -04:00
Andrew Starr-Bochicchio add3c5f29b
load balancers: Add support for backend keepalive (Fixes: #427). (#428)
* load balancers: Add support for backend keepalive (Fixes: #427).

* Fix typo.
2020-05-04 12:59:05 -04:00
Tom Dyas 64674c727c
remove extra debug logging statement (#429) 2020-05-02 11:06:54 -04:00
Tom Dyas f21cc9106f
add digitalocean_spaces_bucket_object(s) data sources adapted from S3 (#423)
* import S3 data sources

* change names to DO, strip out most unsupported features

* use spaces client; now compiles

* tests use spaces client

* initial rename of attributes in tests

* add region attribute to digitalocean_spaces_bucket_objects

* validation on region and bucket attributes

* rename files to match file naming conventions

* first attempt at working tests

* more work on tests

* remove unsupported tags attribute

* just check if version_id exists, doesn't match AWS impl

* update test resources for test of digitalocean_spaces_bucket_objects

* add force_destroy to bucket

* docs as is from AWS provider

* first pass at adapting the docs

* adjust example to be a Droplet not a EC2 instance

* more S3 -> Spaces in docs

* conform encoding test to Spaces output

* Spaces does not support ListObjectsV2 API, switch away

* update docs

* Update docs.

Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-04-28 16:39:17 -04:00
Andrew Starr-Bochicchio cf867ea6b9
load balancers: Fix support for multiple forwarding rules (fixes: #414). (#419)
* load balancers: Fix support for multiple forwarding rules (fixes: #414).

* Remove debug statement.

* Also add multi-rule test case to the data source.
2020-04-28 15:25:57 -04:00
Andrew Starr-Bochicchio d8c7d2ed7b
Fix handling of CAA records with iodef tag (fixes: #421). (#422) 2020-04-24 11:06:22 -04:00
Tom Dyas 11fd5a433a
add digitalocean_droplets data source (#418)
* add digitalocean_droplets data source

* add docs

* Update website/docs/d/droplets.html.md

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update website/docs/d/droplets.html.md

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Update digitalocean/droplets.go

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* Import strconv

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-04-22 17:09:18 -04:00
Tom Dyas 0fea588f83
digitalocean_spaces_buckets/datasource: comment why spaces regions are hard-coded (#420) 2020-04-22 11:38:57 -04:00
Tom Dyas b9e0615705
add preliminary data sources for Spaces buckets (#416)
* checkpoint

* fix digitalocean_spaces_bucket datasource + test

* do not try to delete empty IDs

* add comment about race condition

* fix import ordering

* add digitalocean_spaces_buckets data source

* switch to use flattenSpacesBucket in data source

* update docs

* Fix sort example for data.digitalocean_spaces_buckets

Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-04-22 11:15:42 -04:00
Andrew Starr-Bochicchio e5212e4069
spaces_bucket: Region attribute should be ForceNew. (#413) 2020-04-14 10:28:32 -04:00
Tom Dyas 61c7bea9cb
digitalocean_spaces_bucket: add lifecycle_rule support (#411)
* adapt lifecycle_rule code from aws_s3_bucket

commented out tags code

* copy in acceptance tests w/ minimal adapation

* fix rebasing conflict

* more renaming and removal of unsupported features

* remove tags from tests

* remove more storage classes

* import did not work since default region not set during import

* remove storage class related attributes

* add warning about keys starting with /

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* remove duplicate definition of isAWSError due to merge conflict

* add abort_incomplete_multipart_upload_days test plus some cleanups

* refactor setup of S3 client in tests

* another region fix

* document lifecycle_rule

* remove debugging logs statements

* remove moot method (since transitions were removed)

* remove TestAccDigitalOceanSpacesBucket_LifecycleRule_Expiration_EmptyConfigurationBlockw

* add AtleastOneOf config for expiration arguments

* Revert "add AtleastOneOf config for expiration arguments"

This reverts commit c70557be53de67ec9a4063e4fa858e375c9fe5a5.

Doesn't seem to work in sub-arguments

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
2020-04-14 10:17:52 -04:00
Andrew Starr-Bochicchio a80ab4b5f9
Add support for VPC. (#410)
* Initial work on VPC supprt.

* Add VPC data source.

* Additional test cases.

* Droplet updates for VPC support.

* Kubernetes updates for VPC support.

* Load balancer updates for VPC support.

* Retry on 403 errors in delete method to prevent race condition with database cluster deletion.

* DBaaS updates for VPC support.

* Add docs on VPC resource and data source.

* Update docs for related resources.

* Clean up.

* Bump godo to v1.34.0.

* Update with ip_range and description fields.

* Update re: private_networking atribute.

* Update vpc docs to say smaller than /24 not supported.
2020-04-13 18:09:44 -04:00
Andrew Starr-Bochicchio 7842bfdc65 Remove unused keys from spaces_bucket_object. 2020-04-09 09:50:49 -04:00
Andrew Starr-Bochicchio e5d71d79c7
Remove storage_class attribute from spaces_bucket_object. (#412) 2020-04-09 09:45:09 -04:00
Tom Dyas 5cd9aaf6dd
add digitalocean_spaces_bucket_object resource (#408)
* add from AWS provider

* rename functions for digitalocean use

* strip out features not supported by DigitalOcean

* import test file from AWS provider

* get acceptance tests to compile

* remove test sweeper since digitalocean provider is not setup for it

* use digitalocean_spaces_bucket.name (.bucket is what aws uses)

* switch back to earlier version of isAWSErr which works on earlier Go

* add docs for the resource

* remove moot comment

* rename S3 -> Spaces in log messages

* rename more methods from AWS S3 naming

* use constant for test region

* handle buckets not being removed

* get tests to compile again, remove most storage class tests

* fix resource name in test

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* remove terraform-provider-aws as a dependency

* fix typo

* fix bucket name

* remove checks for object lock attributes

* set force_destroy on all digitalocean_spaces_bucket resources in tests

* remove unused functions

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
2020-04-08 14:48:02 -04:00
Tom Dyas d7f2efda35
digitalocean_spaces_bucket: support bucket versioning (#409)
* digitalocean_spaces_bucket: support bucket versioning

* document versioning argument

* remove debugging code

* Update digitalocean/resource_digitalocean_spaces_bucket.go

Co-Authored-By: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>

* test that removing the versioning block will disable versionin

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
2020-04-07 11:53:32 -04:00
Matteo Valentini 132f587f34
Remove the validation on volume name (#406)
Let terraform check only if name exist and let the DigitalOCean APIs
validate the composition of the name.

Reverts: https://github.com/terraform-providers/terraform-provider-digitalocean/pull/386
2020-04-07 10:14:57 -04:00
Tom Dyas f25c98d80c
add spaces_endpoint config to provider (#407)
* add spaces_endpoint config to provider

* docs for spaces_endpoint

* fix message
2020-04-06 12:38:09 -04:00
Brian Hicks d5a228360e
support volumes created before name rules changed (#404)
* support volumes created before name rules changed

In 2019, DigitalOcean accepted volumes created with underscores in the name. In 2020, this is no longer the case but it leaves us without a way to work with volumes created in the old rules.

* Add comment on why regexp does not match message.

Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-03-31 09:45:07 -04:00
Tommy Brunn 12af297769
Validate connection pool name (#403)
* Validate length of database connection pool name

DO currently returns a 500 if the database connection pool name is longer than 60 characters, and their
documentation states that it should be between 3 and 63 characters long.

* Sort imports

* Fix typo
2020-03-23 10:50:32 -04:00
Andrew Starr-Bochicchio 921a5435f5
Allow running KubernetesProviderInteroperability test locally. (#402)
When running the acceptance tests for https://github.com/terraform-providers/terraform-provider-digitalocean/pull/401,
I noticed failures due to my local kubeconfig file being used. This sets
`load_config_file = false` in the test.
2020-03-19 14:14:58 -04:00
Andrew Starr-Bochicchio e972ddff2c
Do not error out if terraform:default-node-pool tag is missing when reading k8s cluster. (#401)
In https://github.com/terraform-providers/terraform-provider-digitalocean/pull/365, a
check was added to the `digitaloceanKubernetesClusterRead` method for the
`terraform:default-node-pool` tag in order to support importing. A latter commit in
that PR added a separate `resourceDigitalOceanKubernetesClusterImportState` method
that enforces this. The Kubernetes cluster data source also uses the
`digitaloceanKubernetesClusterRead` method and should support accessing cluster
information even if a node pool is not tagged. This PR changes the errors into
warning as it is still useful for debugging.

Fixes: https://github.com/terraform-providers/terraform-provider-digitalocean/issues/399
2020-03-19 14:13:55 -04:00
Tommy Brunn aa45e68626
Fix volume name validation (#400)
PR #386 introduced validation of volume names that disallows dashes,
which is allowed according to DigitalOcean's API documentation: https://developers.digitalocean.com/documentation/v2/#block-storage
2020-03-19 10:14:44 -04:00
Tom Dyas 3a3c374c3f
add digitalocean_project_resources to bind resources to externally-managed projects (#396)
* add digitalocean_project_resource

* update docs for digitalocean_project_resource

* allow `resources` on digitalocean_project to be computed

* rename digitalocean_project -> digitalocean_projects

* switch to managing multiple resources

* update docs for the changes to the resource

* use Id in read function

* Simplify read method further.

Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-03-18 15:58:19 -04:00
Andrew Starr-Bochicchio 083c9cbfcd
Make DBaaS version required due to DigitalOcean API changes. (#382)
* Fix DBaaS version handling due to DigitalOcean API changes.

* Add versions to Redis and MySQL examples.

* Fix comment typo.

* Rework to make required with a custom error message.

* Add comments and reorganize.

* Add TODO comment.
2020-03-17 16:46:05 -04:00
Andrew Starr-Bochicchio 62dfa05f65
Add support for MySQL user authentication management (#393)
* Add support for MySQL user auth plugin managment.

* Add docs for mysql_auth_plugin

* Update godo to 1.32.0
2020-03-17 16:44:25 -04:00
Tom Dyas 3854777ee4
default digitalocean_image to user images (#395)
* default digitialocean_image to user images source

* fix typo in keyword in docs
2020-03-10 15:31:29 -04:00
Tom Dyas 3db49fd4e2
add digitalocean_images datasource (#394)
* add digitalocean_images datasource and support code

* update digitalocean_image to use the common code

* add `id` as lookup attribute on digitalocean_image

and expand `name` to all images, set `private = true` to search only user images

* update documentation

* fix missing return statement

* use flattenTags function

* update digitalocean_image datasource, test, and docs
2020-03-10 11:33:09 -04:00