Commit Graph

25 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 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
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
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 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
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 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
Tom Dyas 60deafc960
add labels support to Kubernetes node pools (#379)
* upgrade godo to v1.30.0

* add labels attribute to node pool resources

* add support for labels in the k8s cluster datasource

* fix bug in creating default node pools with labels plus tests

* update docs for labels support

* Add label example to the node pool docs.

* add link to Kubernetes documentation about how labels are exposed

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
2020-02-18 17:26:36 -05:00
Tom Dyas 3215efad39
add import support for digitalocean_kubernetes_cluster and digitalocean_kubernetes_node_pool resources (#365)
* add import support for digitalocean_kubernetes_cluster resource

* document importing digitalocean_kubernetes_cluster resources

* node pool import improvements

- Importing a cluster will infer the node pool to add the terraform:default-node-pool tag
- Add node pool import test (currently broken)

* fix typo in the name of the node pool being imported in the test

* rename test file to reflect naming scheme used elsewhere in package

* add a ImportStateCheck function in an attempt to get test to pass

* update to use latest kubernetes version

* do not import non-default node pools multiple times

There are several automatic tags added to node pools. As written, the original
code added a ResourceData for each tag associated with a node pool, instead of
just once for the node pool.

* remove default tag from node pool (and configure test to expect that situation)

* fix test of importing multiple node pools

* get kubernetes import test working

* fix comment

* update docs to reflect auto-tagging in import

* add support to import only node pool resources

and move the test of importing non-default node pools into the
cluster import test since it was actually testing cluster imports

* update docs for importing node pools

* add test that tries to import an invalid node pool ID
2020-02-11 13:40:42 -05:00
aqche 6b8f9970a4 digitalocean_kubernetes_cluster version changes (#333)
* DO cluster ver change will make an upgrade request instead of force new

* add custom diff to force new if kubernetes version is decreased

* run go mod vendor; go mod tidy

* check NoZeroValues for kubernetes version and update kubenetes upgrade version test to check id

* Add note to the docs about version upgrades.

* Revert addition of go version to go.mod
2019-11-12 17:43:30 -05:00
Steven Normore 320ee053c3 doks: add node pool auto-scale fields (#307)
* doks: add auto_scale, min_nodes, max_nodes, and actual_node_count to node pool

* doks: add more auto-scaling node pool test coverage

* doks: documentation for auto-scaling node pools

* Handle case where a node pool is empty.

* Bump testClusterVersion to 1.15.5-do.0
2019-10-30 18:39:39 -04:00
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 9cc70a3bda
doks: Produce a valid kubeconfig file. (#315)
* doks: Produce a valid kubeconfig file.

* doks: Re-add cluster_ca_certificate to example.

* Revert change to go.mod

* Make client-key-data and client-certificate-data omitempty.

* doks: Re-add cluster_ca_certificate to example in datasource as well.
2019-10-08 18:32:46 -04:00
Steven Normore 0b606c4e68 doks: fetch new kubeconfig credentials only when expired (#311)
* Upgrade godo to v1.22.0

* doks: fetch new kubeconfig credentials only when expired
2019-10-08 11:32:24 -04:00
Steven Normore 356fd5c157 doks: bump version in tests to 1.15.4-do.0 (#312) 2019-10-08 10:14:44 -04:00
Steven Normore 2454bb055e doks: bump to latest cluster version and use token auth (#309)
* doks: bump versions to latest 1.15.3-do.3

* doks: fix acc tests to use auth token instead of certs

* doks: update docs to mention token auth in the kube config
2019-10-07 13:00:56 -04:00
Steven Normore 980fd9a853 doks: fix acc tests (#308)
* doks: run testacc in parallel

* doks: use alpha-prefixed random cluster and node pool names in tests

* doks: wait for node pool count in tests

* Use 'tf-acc-test-' for test resource prefix.
2019-10-07 12:07:49 -04:00
Jonathan Hartman f7b97cb7e8
Mark the kubernetes_cluster resource's kube_config field as sensitive
This data includes sensitive information about the cluster, such as its private
key. This prevents that data from ending up in, for example, logs on a CI system
that does a `terraform plan` as part of its build.

With this applied, a `terraform plan` or `terraform apply` instead shows:

```
...
        ipv4_address   = "1.2.3.4"
        kube_config    = (sensitive value)
        name           = "roboticcheese"
...
```

Also updates the acceptance tests, as 1.14.4-do.0 is no longer available.
2019-08-31 12:16:51 -07:00
Jackson Sadowski 2c024ad05a Update Kubernetes cluster version 2019-07-22 20:33:03 -04:00
Andrew Starr-Bochicchio 08c7646403 Add tests for filterTags function. 2019-07-03 12:30:49 -04:00
Andrew Starr-Bochicchio 74b6e23f92 Update K8s test to excersise issue #184. 2019-06-06 16:51:01 -04:00
Andrew Starr-Bochicchio 896d377ca8 Add integration test with Kubernetes provider. 2019-05-24 11:50:52 -04:00
Ellis Percival 8e28483cae
Fix typo in k8s cluster resource test filename 2019-04-11 16:46:18 +01:00
Renamed from digitalocean/resource_digitialocean_kubernetes_cluster_test.go (Browse further)