Terraform
Clusters
Register and manage DevZero clusters with Terraform.
Clusters
The devzero_cluster resource registers a Kubernetes cluster with DevZero. Once created, it outputs a cluster id and a token that operators use to connect to the DevZero platform.
For a higher-level approach that also handles operator installation, see the devzero-inc/cluster/devzero module described in the overview.
Example
resource "devzero_cluster" "production" {
name = "production-cluster"
}
output "cluster_id" {
value = devzero_cluster.production.id
}
output "cluster_token" {
value = devzero_cluster.production.token
sensitive = true
}Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique name for the cluster |
Attributes
| Attribute | Type | Description |
|---|---|---|
id | string | The cluster ID assigned by DevZero |
token | string (sensitive) | Authentication token used by operators to connect to the cluster |
The token is sensitive -- always mark outputs that reference it with sensitive = true.
Import
You can import an existing cluster into Terraform state:
terraform import devzero_cluster.production <cluster_id>Module Alternative
Instead of managing the devzero_cluster resource directly, you can use the devzero-inc/cluster/devzero module which registers the cluster and installs operators in a single step:
module "devzero_cluster" {
source = "devzero-inc/cluster/devzero"
cluster_name = "my-cluster"
}