docs
docs copied to clipboard
KubeOne: Digital Ocean Projects not documented
Digital Ocean now have so-called projects which resources can be assigned to.
- https://docs.digitalocean.com/reference/terraform/reference/resources/project/
This allows creation of resources under different name spaces.
Its usage is currently not documented for KubeOne.
This is how this looks in main.tf:
resource "digitalocean_project" "kube_cluster" {
name = "${var.project_name}"
description = "${var.project_description}"
purpose = "${var.project_purpose}"
environment = "${var.project_environment}"
resources = concat(
flatten(
digitalocean_droplet.control_plane.*.urn
),
[
digitalocean_loadbalancer.control_plane.urn,
digitalocean_tag.kube_cluster_tag.id,
digitalocean_ssh_key.deployer.id
]
)
}
and in variables.tf:
variable "project_name" {
description = "Name of the project"
type = string
}
variable "project_description" {
description = "Description of the project"
type = string
}
variable "project_purpose" {
description = "Purpose of the project"
type = string
}
variable "project_environment" {
description = "Environment of the project"
type = string
}
Updates need to be applied to
- https://github.com/kubermatic/kubeone/tree/master/examples/terraform/digitalocean
as well.
@almereyda it's not documented because we don't support it?! :D
Yes (:
I was just leaving a note here for documenting my own attempts at using them, in case someone would want to do something similar.
That is, sometimes it had become useful to remove and import the Terraform state of the project, in order for it not being removed during multiple cycles of setting up the KubeOne cluster.
terraform state rm digitalocean_project.kube_cluster
terraform destroy
terraform import digitalocean_project.kube_cluster b36238c2-f9d0-4971-b2ae-fead4b4af00b
terraform plan
terraform apply
The only true workaround for this, from the perspective of a DO Cloud user, is to set the desired project as default project in your account.
Digital Ocean's Projects are just a label. It's not like Hetzner's projects, which is true isolation between projects.