Data sources
Terraform data sources retrieve read-only information from existing Cloudfleet resources, so you can reference them elsewhere in your configuration. Use them to connect to an existing cluster or Fleet, or to use client credentials, without managing those resources in your Terraform code. Data sources support flexible and modular setups, where infrastructure is shared or managed outside the current deployment workflow.
cloudfleet_cfke_cluster
Retrieves information about an existing CFKE cluster.
Required arguments:
id- Cluster identifier
Available attributes:
name- Cluster nameregion- Cluster regionendpoint- Kubernetes API endpointcertificate_authority- Deprecated. Not needed to connect to the clusterkubernetes_version- Current Kubernetes versionstatus- Cluster statusrelease_channel- Release channel for the control plane (stable,rapid, orextended)features- Effective cluster feature togglesgpu_sharing_strategy- GPU sharing strategy (none,mps, ortime_slicing)gpu_max_shared_clients_per_gpu- Maximum number of Pods that can share a single GPUcilium_socket_lb_host_namespace_only- Whether Cilium socket load-balancing is restricted to the host namespace
networking- Effective cluster networking configurationpod_cidr/pod_cidr_v6- IPv4 and IPv6 Pod CIDR rangesservice_cidr/service_cidr_v6- IPv4 and IPv6 Service CIDR rangesdual_stack- Whether the cluster runs dual-stack (IPv4+IPv6) networking
created_at- Creation timestampupdated_at- Last update timestamp
Example:
data "cloudfleet_cfke_cluster" "existing" {
id = "b3618d0a-5a46-4e23-a583-2c79171b31a0"
}
# Use cluster information in outputs
output "cluster_info" {
value = {
name = data.cloudfleet_cfke_cluster.existing.name
status = data.cloudfleet_cfke_cluster.existing.status
kubernetes_version = data.cloudfleet_cfke_cluster.existing.kubernetes_version
region = data.cloudfleet_cfke_cluster.existing.region
endpoint = data.cloudfleet_cfke_cluster.existing.endpoint
}
}
# Configure kubectl provider using cluster data
provider "kubectl" {
host = data.cloudfleet_cfke_cluster.existing.endpoint
token = data.cloudfleet_client_config.me.access_token
}cloudfleet_cfke_fleet
Retrieves information about an existing CFKE Fleet.
Required arguments:
id- Fleet identifiercluster_id- Identifier of the cluster that the Fleet belongs to
Available attributes:
name- Fleet namescaling_profile- Scaling profile (aggressiveorconservative)limits- Resource limits configurationcpu- CPU limit in cores
constraints- Scheduling and provisioning constraints (allowed values per Kubernetes label key)arch- Allowed values forkubernetes.io/archcapacity_type- Allowed values forkarpenter.sh/capacity-typeinstance_family- Allowed values forcfke.io/instance-familyregion- Allowed values fortopology.kubernetes.io/region
taints- Taints applied to the Fleet’s nodes (key,value,effect)aws- AWS configuration (if enabled)enabled- Whether the AWS Fleet is enabledrole_arn- AWS IAM role ARN
gcp- GCP configuration (if enabled)enabled- Whether the GCP Fleet is enabledproject_id- GCP Project ID
hetzner- Hetzner configuration (if enabled)enabled- Whether the Hetzner Fleet is enabled
Example:
data "cloudfleet_cfke_fleet" "existing" {
id = "my-fleet"
cluster_id = "b3618d0a-5a46-4e23-a583-2c79171b31a0"
}
# Display fleet configuration information
output "fleet_info" {
value = {
name = data.cloudfleet_cfke_fleet.existing.name
cluster_id = data.cloudfleet_cfke_fleet.existing.cluster_id
# AWS configuration (if enabled)
aws_enabled = data.cloudfleet_cfke_fleet.existing.aws != null ? data.cloudfleet_cfke_fleet.existing.aws.enabled : false
aws_role_arn = data.cloudfleet_cfke_fleet.existing.aws != null ? data.cloudfleet_cfke_fleet.existing.aws.role_arn : null
# GCP configuration (if enabled)
gcp_enabled = data.cloudfleet_cfke_fleet.existing.gcp != null ? data.cloudfleet_cfke_fleet.existing.gcp.enabled : false
gcp_project_id = data.cloudfleet_cfke_fleet.existing.gcp != null ? data.cloudfleet_cfke_fleet.existing.gcp.project_id : null
# Hetzner configuration (if enabled)
hetzner_enabled = data.cloudfleet_cfke_fleet.existing.hetzner != null ? data.cloudfleet_cfke_fleet.existing.hetzner.enabled : false
# Resource limits
cpu_limit = data.cloudfleet_cfke_fleet.existing.limits != null ? data.cloudfleet_cfke_fleet.existing.limits.cpu : null
}
}cloudfleet_client_config
Retrieves the current Cloudfleet client configuration for authentication. Use this data source to configure other providers (for example, kubernetes or kubectl) to connect to your CFKE clusters.
Available attributes:
access_token- OAuth2 access token for API authenticationorganization_id- Organization ID from JWT tokenuser- Authenticated user email address
Example:
# Get current client configuration
data "cloudfleet_client_config" "me" {}
# Create a CFKE cluster
resource "cloudfleet_cfke_cluster" "example" {
name = "my-cluster"
region = "europe-central-1a"
tier = "basic"
}
# Configure Kubernetes provider using cluster connection details and client credentials
provider "kubernetes" {
host = cloudfleet_cfke_cluster.example.endpoint
token = data.cloudfleet_client_config.me.access_token
}
# Example: Create a namespace using the configured kubernetes provider
resource "kubernetes_namespace" "example" {
metadata {
name = "my-application"
}
}
# Output current user information
output "current_user" {
value = {
user = data.cloudfleet_client_config.me.user
organization_id = data.cloudfleet_client_config.me.organization_id
}
}← Resources