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

digitalocean_kubernetes_node_pool droplets not assigned to correct digitalocean_project #469

Open
Mavwarf opened this issue Jul 22, 2020 · 7 comments
Labels
do-api Depends on changes to the DigitalOcean API

Comments

@Mavwarf
Copy link

Mavwarf commented Jul 22, 2020

Terraform Version

Terraform v0.13.0-beta3

Affected Resource(s)

digitalocean_kubernetes_node_pool

Terraform Configuration Files

resource "digitalocean_kubernetes_cluster" "tf-kubernetes-cluster" {
  name   = "tf-${var.do_cluster_name}-k8"
  region = var.do_region

  version = "1.18.6-do.0"

  node_pool {
    name       = "tf-${var.do_cluster_name}-k8-fe-node-pool"
    size       = var.do_k8_droplet_size
    node_count = 1
    tags       = ["tf-node", "tf-front-end"]
    labels = {
      "fnx.node.type" = "public"
    }
  }
}

resource "digitalocean_project_resources" "tf-kubernetes-cluster-project-resource" {
  project   = digitalocean_project.tf-project.id
  resources = ["do:kubernetes:${digitalocean_kubernetes_cluster.tf-kubernetes-cluster.id}"]
}

resource "digitalocean_kubernetes_node_pool" "tf-kubernetes-be-node-pool" {
  cluster_id = digitalocean_kubernetes_cluster.tf-kubernetes-cluster.id

  name       = "tf-${var.do_cluster_name}-k8-be-node-pool"
  size       = var.do_k8_droplet_size
  node_count = 1
  tags       = ["tf-node", "tf-back-end"]
}

Expected Behavior

I would expect that the additional k8 node pool is also added to the k8 cluster do project, but that is not the case. All droplets created in the additional node pool are assigned to the default DO project.

Actual Behavior

The droplets created within the additional digitalocean_kubernetes_node_pool are assigned to the default DO project.

Steps to Reproduce

terraform apply

Misc

Work around is to manually assign all node pool droplets 'manually'. Problem here is, that with each terrafrom apply this is done again. If I did so once, terraform 'forgets' about that the next time I apply.

# Need to manually add all droplets of node pool to project
resource "digitalocean_project_resources" "tf-kubernetes-be-node-pool-project-resource" {
  project   = digitalocean_project.tf-project.id
  resources = formatlist("do:droplet:%s", digitalocean_kubernetes_node_pool.tf-kubernetes-be-node-pool.nodes[*].droplet_id)
}
@Mavwarf
Copy link
Author

Mavwarf commented Jul 22, 2020

I noticed another, I guess relating issue, as well: if I scale the default node pool, the new droplets are not assigned to the project I assign the cluster to, but to the default project.

@Mavwarf
Copy link
Author

Mavwarf commented Jul 22, 2020

Personal note: I really like and appreciate your work and your dedication! It is so super simple to use terraform with DO. Until yesterday I did everything manually with the DO UI. Using TF is so simple and 'working as expected'! I am blown away!

Stay safe! Thomas

@andrewsomething andrewsomething added the do-api Depends on changes to the DigitalOcean API label Jul 27, 2020
@andrewsomething
Copy link
Member

Hi @Mavwarf. Thanks for the kind words. Unfortunately, DigitalOcean Kubernetes clusters do not fully support projects yet. I've checked in with the team, and projects support is on the near term road map. Once this is supported in the API, your initial example will work as expected without any change on the Teraform side. Though we'll export the URN so you won't need to do the formatting.

@Mavwarf
Copy link
Author

Mavwarf commented Jul 28, 2020

@andrewsomething thanks for giving an update! Looking forward to the upcoming version.

@ffuentes
Copy link

ffuentes commented Jan 5, 2021

Hi @andrewsomething , it's this in the roadmap or have you any recommendation regarding projects and k8s clusters? I'm doing some testing with terraform and digitalocean and really want to structure all the associated resources in their own projects.

@devurandom
Copy link
Contributor

devurandom commented Apr 24, 2021

It seems the only thing missing now, after digitalocean/godo#441 is merged, is a urn attribute for the digitalocean_kubernetes_cluster resource?

@andrewsomething
Copy link
Member

@devurandom Clusters can now be assigned to a project, but there are still some discussions going on around how best to handle individual nodes and other associated resources in a cluster. Currently individual nodes are hidden from project details, but that is being revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-api Depends on changes to the DigitalOcean API
Projects
None yet
Development

No branches or pull requests

4 participants