Commit Graph

11 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
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
Tom Dyas 47436f7b15
add droplet ID to node pools and droplet datasource (#366)
* add droplet_id attribute for nodes in a Kubernetes cluster's node pool

* lookup droplets by ID for data.digitalocean_droplet

* add `id` as valid lookup for data.digitalocean_droplet

* update docs for droplet_id attribute and ID lookups for droplets

* avoid listing all droplets if the lookup is by ID
2020-02-05 17:02:52 -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
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
Boris Popovschi 8fa087d44f Added Tags support for database cluster (#293) 2019-09-20 18:59:09 -04:00
Andrew Starr-Bochicchio 0250fccd12 Consistently protect against nil response in error handling (Fixes: #272). 2019-07-23 12:11:05 -04:00
Andrew Starr-Bochicchio 3551052e93 K8s: Do not filter out node pool tags also applied to the cluster (Fixes: #184)
While still in beta, the DigitalOcean Kubernetes API automatically applied tags
from the cluster to the node pools. The provider's `filterTags` function
accounted for this by not manually applying tags found on the parent cluster
to the children node pools:
```
// we need to filter tags to remove any automatically added to avoid state problems,
// these are tags starting with "k8s:", named "k8s" or duplicates of the cluster tags
```

This does not match the current behavior of the API. See:

https://github.com/terraform-providers/terraform-provider-digitalocean/issues/184

The updated test fails without the additional changes:
```
$ make testacc TESTARGS='-run=TestAccDigitalOceanKubernetesCluster_Basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDigitalOceanKubernetesCluster_Basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-digitalocean	[no test files]
=== RUN   TestAccDigitalOceanKubernetesCluster_Basic
--- FAIL: TestAccDigitalOceanKubernetesCluster_Basic (211.95s)
    testing.go:538: Step 0 error: Check failed: 3 errors occurred:
        	* Check 9/30 error: digitalocean_kubernetes_cluster.foobar: Attribute 'tags.#' expected "2", got "3"
        	* Check 18/30 error: digitalocean_kubernetes_cluster.foobar: Attribute 'node_pool.0.tags.#' expected "2", got "1"
        	* Check 19/30 error: digitalocean_kubernetes_cluster.foobar: Attribute 'node_pool.0.tags.2053932785' not found

FAIL
FAIL	github.com/terraform-providers/terraform-provider-digitalocean/digitalocean	211.957s
GNUmakefile:18: recipe for target 'testacc' failed
make: *** [testacc] Error 1
```

And passes with them:
```
$ make testacc TESTARGS='-run=TestAccDigitalOceanKubernetesCluster_Basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDigitalOceanKubernetesCluster_Basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-digitalocean	[no test files]
=== RUN   TestAccDigitalOceanKubernetesCluster_Basic
--- PASS: TestAccDigitalOceanKubernetesCluster_Basic (242.73s)
PASS
ok  	github.com/terraform-providers/terraform-provider-digitalocean/digitalocean	242.736s
```
2019-06-06 16:51:01 -04:00
Ahmed AbouZaid 54d639bcda Fix a typo in kubernetes_node_pool file name 2019-04-23 22:54:27 +02:00
Renamed from digitalocean/resource_digital_ocean_kuberentes_node_pool.go (Browse further)