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 name
  • region - Cluster region
  • endpoint - Kubernetes API endpoint
  • certificate_authority - Deprecated. Not needed to connect to the cluster
  • kubernetes_version - Current Kubernetes version
  • status - Cluster status
  • release_channel - Release channel for the control plane (stable, rapid, or extended)
  • features - Effective cluster feature toggles
    • gpu_sharing_strategy - GPU sharing strategy (none, mps, or time_slicing)
    • gpu_max_shared_clients_per_gpu - Maximum number of Pods that can share a single GPU
    • cilium_socket_lb_host_namespace_only - Whether Cilium socket load-balancing is restricted to the host namespace
  • networking - Effective cluster networking configuration
    • pod_cidr / pod_cidr_v6 - IPv4 and IPv6 Pod CIDR ranges
    • service_cidr / service_cidr_v6 - IPv4 and IPv6 Service CIDR ranges
    • dual_stack - Whether the cluster runs dual-stack (IPv4+IPv6) networking
  • created_at - Creation timestamp
  • updated_at - Last update timestamp

Example:

terraform
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 identifier
  • cluster_id - Identifier of the cluster that the Fleet belongs to

Available attributes:

  • name - Fleet name
  • scaling_profile - Scaling profile (aggressive or conservative)
  • limits - Resource limits configuration
    • cpu - CPU limit in cores
  • constraints - Scheduling and provisioning constraints (allowed values per Kubernetes label key)
    • arch - Allowed values for kubernetes.io/arch
    • capacity_type - Allowed values for karpenter.sh/capacity-type
    • instance_family - Allowed values for cfke.io/instance-family
    • region - Allowed values for topology.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 enabled
    • role_arn - AWS IAM role ARN
  • gcp - GCP configuration (if enabled)
    • enabled - Whether the GCP Fleet is enabled
    • project_id - GCP Project ID
  • hetzner - Hetzner configuration (if enabled)
    • enabled - Whether the Hetzner Fleet is enabled

Example:

terraform
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 authentication
  • organization_id - Organization ID from JWT token
  • user - Authenticated user email address

Example:

terraform
# 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
  }
}
On this page