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

kubernetes: Require importing additional node pools manually. #976

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

andrewsomething
Copy link
Member

This resolves #892 by only importing the default node pool when importing a cluster. Additional pools should now be imported separately as digitalocean_kubernetes_node_pool resources.

The old approach of importing multiple resources in one go was fragile, and the upstream Terraform developer documentation has begun to actively discourage it:

Multiple resource import is generally discouraged due to the implementation/testing complexity and since the resource addresses saved into the Terraform state will likely not align with the operator's configuration.

https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/import#multiple-resource-import

Other providers like AWS' have removed all usage of "complex imports," hashicorp/terraform-provider-aws#13408.

I think this is likely a bug in upstream Terraform. Though this "feature" is not widely used, and they are clearly trying to move away from it. So I believe this is the best approach moving forward.

Fixes: #892

$ make testacc TESTARGS='-run TestAccDigitalOceanKubernetesCluster_Import'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -v ./digitalocean/... -run TestAccDigitalOceanKubernetesCluster_Import -timeout 120m -parallel=2
=== RUN   TestAccDigitalOceanKubernetesCluster_ImportBasic
=== PAUSE TestAccDigitalOceanKubernetesCluster_ImportBasic
=== RUN   TestAccDigitalOceanKubernetesCluster_ImportErrorNonDefaultNodePool
=== PAUSE TestAccDigitalOceanKubernetesCluster_ImportErrorNonDefaultNodePool
=== RUN   TestAccDigitalOceanKubernetesCluster_ImportNonDefaultNodePool
=== PAUSE TestAccDigitalOceanKubernetesCluster_ImportNonDefaultNodePool
=== CONT  TestAccDigitalOceanKubernetesCluster_ImportBasic
=== CONT  TestAccDigitalOceanKubernetesCluster_ImportErrorNonDefaultNodePool
--- PASS: TestAccDigitalOceanKubernetesCluster_ImportBasic (297.67s)
=== CONT  TestAccDigitalOceanKubernetesCluster_ImportNonDefaultNodePool
--- PASS: TestAccDigitalOceanKubernetesCluster_ImportErrorNonDefaultNodePool (476.18s)
--- PASS: TestAccDigitalOceanKubernetesCluster_ImportNonDefaultNodePool (496.43s)
PASS
ok      github.com/digitalocean/terraform-provider-digitalocean/digitalocean/kubernetes 794.131s

@andrewsomething andrewsomething requested a review from a team April 18, 2023 21:27
Copy link

@mikeberezowski mikeberezowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit in the documentation portion. Otherwise looks good to me 👍

docs/resources/kubernetes_node_pool.md Outdated Show resolved Hide resolved
@andrewsomething andrewsomething merged commit 92057f6 into main Apr 19, 2023
@andrewsomething andrewsomething deleted the asb/issues/892 branch April 19, 2023 12:37
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.

Unable to import digitalocean_kubernetes_cluster
2 participants