Skip to content

Latest commit

 

History

History
296 lines (237 loc) · 12.1 KB

File metadata and controls

296 lines (237 loc) · 12.1 KB
page_title duploai_cluster_attributes Resource - duploai
subcategory
description Manages DuploCloud AI Helpdesk cluster attributes — add-ons and components installed onto an existing EKS cluster (autoscaler, ALB controller, EFS, external-dns, and more).

duploai_cluster_attributes (Resource)

Manages DuploCloud AI Helpdesk cluster attributes — add-ons and components installed onto an existing EKS cluster (autoscaler, ALB controller, EFS, external-dns, and more).

Example Usage

# Minimal example — install a few components onto an existing EKS cluster.
# region, vpc_id, cluster_name, and scope_ids are inherited from the cluster.
resource "duploai_cluster_attributes" "basic" {
  workspace_id = "<workspace-id>"
  name         = "<cluster-attributes-name>"
  cluster_id   = "<cluster-id>"

  components = {
    cluster_autoscaler           = true
    alb_load_balancer_controller = true
    efs_volumes                  = true
    metrics_server               = true
  }
}

# Azure (AKS) cluster attributes — enable only AKS-valid components. AKS provides
# cluster autoscaling, metrics-server, and secret access (azureKeyvaultSecretsProvider)
# out of the box, and alb_load_balancer_controller / efs_volumes / eks_addons are
# AWS-only — enabling any of those for an Azure cluster is rejected at apply.
# Allowed on Azure: flux_cd, external_dns, kube_state_metrics.
resource "duploai_cluster_attributes" "azure" {
  workspace_id = "<workspace-id>"
  name         = "<cluster-attributes-name>"
  cluster_id   = "<azure-cluster-baseline-id>"

  components = {
    kube_state_metrics = true
    flux_cd            = true
    external_dns       = true
  }

  # On Azure, external-dns manages records in an existing Azure DNS zone — the
  # domain(s) must already exist in the subscription. provider, policy, and
  # txt_owner_id are set by the platform.
  external_dns_config = {
    domain_filters = ["dev.example.com"]
  }
}

# Install components and configure ExternalDNS to manage a specific Route53 zone.
resource "duploai_cluster_attributes" "with_external_dns" {
  workspace_id = "<workspace-id>"
  name         = "<cluster-attributes-name>"
  cluster_id   = "<cluster-id>"

  components = {
    cluster_autoscaler           = true
    alb_load_balancer_controller = true
    efs_volumes                  = false
    metrics_server               = true
    external_dns                 = true
  }

  external_dns_config = {
    provider       = "aws"
    sources        = ["service", "ingress"]
    policy         = "upsert-only"
    txt_owner_id   = "<cluster-attributes-name>"
    domain_filters = ["example.com"]
  }
}

# Full example — linked to a cluster baseline resource, with EKS managed add-ons,
# ExternalDNS, the Secrets Store CSI driver, GitOps via Flux CD, a custom
# provisioner, and extended timeouts.
#
# Available EKS managed add-on names:
#   vpc-cni                      — VPC CNI plugin for pod networking
#   coredns                      — In-cluster DNS
#   kube-proxy                   — Kubernetes network proxy
#   aws-ebs-csi-driver           — EBS persistent volumes          (needs IRSA)
#   aws-efs-csi-driver           — EFS persistent volumes          (needs IRSA)
#   aws-mountpoint-s3-csi-driver — S3 as a filesystem              (needs IRSA)
#   snapshot-controller          — Volume snapshot support
#   eks-pod-identity-agent       — EKS Pod Identity (modern IRSA alternative)
#   amazon-cloudwatch-observability — CloudWatch Container Insights (needs IRSA)
#   adot                         — AWS Distro for OpenTelemetry    (needs IRSA)
#   aws-guardduty-agent          — GuardDuty runtime monitoring
resource "duploai_cluster_baseline" "this" {
  workspace_id = "<workspace-id>"
  name         = "prod-cluster"
  network_id   = "<network-id>"
  version      = "1.34"
}

resource "duploai_cluster_attributes" "full" {
  workspace_id = "<workspace-id>"
  name         = "prod-cluster-attrs"
  cluster_id   = duploai_cluster_baseline.this.id

  provisioner_type = "IacNativeTf"

  components = {
    cluster_autoscaler           = true
    secret_csi_driver            = true
    alb_load_balancer_controller = true
    efs_volumes                  = true
    metrics_server               = true
    kube_state_metrics           = true
    flux_cd                      = true
    external_dns                 = true
  }

  eks_addons = [
    # Core networking and DNS — usually pre-installed; pin versions to control upgrades.
    { name = "vpc-cni", version = "v1.19.0-eksbuild.1" },
    { name = "coredns", version = "v1.11.4-eksbuild.2" },
    { name = "kube-proxy", version = "v1.31.2-eksbuild.3" },

    # Storage — require an IRSA role with the appropriate AWS-managed policy.
    {
      name                     = "aws-ebs-csi-driver"
      version                  = "v1.37.0-eksbuild.1"
      service_account_role_arn = "<ebs-csi-irsa-role-arn>"
    },
    {
      name                     = "aws-efs-csi-driver"
      service_account_role_arn = "<efs-csi-irsa-role-arn>"
    },
    {
      name                     = "aws-mountpoint-s3-csi-driver"
      service_account_role_arn = "<s3-csi-irsa-role-arn>"
    },

    # Volume snapshots.
    { name = "snapshot-controller" },

    # Identity — EKS Pod Identity agent (modern alternative to IRSA).
    { name = "eks-pod-identity-agent" },

    # Observability — require an IRSA role.
    {
      name                     = "amazon-cloudwatch-observability"
      service_account_role_arn = "<cloudwatch-irsa-role-arn>"
    },
    {
      name                     = "adot"
      service_account_role_arn = "<adot-irsa-role-arn>"
    },

    # Security.
    { name = "aws-guardduty-agent" },
  ]

  external_dns_config = {
    provider       = "aws"
    sources        = ["service", "ingress"]
    policy         = "upsert-only"
    txt_owner_id   = "prod-cluster-attrs"
    domain_filters = ["prod.example.com"]
  }

  timeouts {
    create = "45m"
    update = "30m"
    delete = "20m"
  }
}

Schema

Required

  • cluster_id (String) ID of the cluster baseline this resource configures.
  • name (String) Name of the cluster attributes resource.
  • workspace_id (String) ID of the workspace that owns this cluster attributes resource.

Optional

  • components (Attributes) Cluster components to install. (see below for nested schema)
  • description (String) Optional description.
  • eks_addons (Attributes List) EKS managed add-ons to install on the cluster. (see below for nested schema)
  • external_dns_config (Attributes) Configuration for ExternalDNS. Takes effect when components.external_dns is true. (see below for nested schema)
  • failure_retries (Number) Number of extra polls to tolerate a transient failure status during provisioning before treating it as terminal. Overrides the resource's default; leave unset to use it.
  • provisioner_type (String) Provisioner type: Cli, IacNativeTf, IacDuploTf, or DirectApiCall.
  • provisioner_version (String) Optional provisioner version.
  • timeouts (Block, Optional) (see below for nested schema)

Read-Only

  • cf_stack_name (String) CloudFormation stack name for provisioned infrastructure.
  • cluster_attributes_id (String) ID of this cluster attributes resource, for reference by dependent resources.
  • cluster_name (String) Name of the cluster. Inherited from the linked cluster baseline.
  • id (String) Composite resource identifier (workspace_id/id).
  • installed_components (Attributes List) Components currently installed on the cluster. (see below for nested schema)
  • installed_eks_addons (Attributes List) EKS managed add-ons currently installed on the cluster. (see below for nested schema)
  • region (String) AWS region. Inherited from the linked cluster baseline.
  • scope_ids (List of String) Scope IDs for the cluster. Inherited from the linked cluster baseline.
  • status (String) Current provisioning status.
  • vpc_id (String) VPC ID for the cluster. Inherited from the linked cluster baseline.

Nested Schema for components

Optional:

  • alb_load_balancer_controller (Boolean) Install the AWS ALB/NLB load balancer controller.
  • cluster_autoscaler (Boolean) Install the Kubernetes Cluster Autoscaler.
  • efs_volumes (Boolean) Install the Amazon EFS CSI driver for persistent volumes.
  • external_dns (Boolean) Install ExternalDNS to manage Route53 records automatically.
  • flux_cd (Boolean) Install Flux CD for GitOps-based continuous delivery.
  • kube_state_metrics (Boolean) Install Kube State Metrics for cluster-level monitoring.
  • metrics_server (Boolean) Install the Kubernetes Metrics Server.
  • secret_csi_driver (Boolean) Install the AWS Secrets Store CSI driver.

Nested Schema for eks_addons

Required:

  • name (String) EKS add-on name (e.g. vpc-cni, coredns, kube-proxy).

Optional:

  • config_values (String) JSON configuration values for the add-on.
  • service_account_role_arn (String) IAM role ARN for the add-on's service account (IRSA).
  • version (String) Add-on version. Defaults to the latest compatible version when unset.

Nested Schema for external_dns_config

Optional:

  • domain_filters (List of String) Domain name filters restricting which hosted zones ExternalDNS manages.
  • policy (String) DNS sync policy (upsert-only or sync).
  • provider (String) DNS provider (e.g. aws).
  • sources (List of String) Kubernetes resource types ExternalDNS should watch (e.g. ["service", "ingress"]).
  • txt_owner_id (String) TXT record owner ID for tracking ExternalDNS-managed records.

Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

Nested Schema for installed_components

Read-Only:

  • chart_version (String) Helm chart version.
  • iam_role_arn (String) IAM role ARN for the component's service account.
  • name (String) Component name.
  • namespace (String) Kubernetes namespace the component is deployed into.
  • status (String) Installation status of this component.
  • version (String) Installed version.

Nested Schema for installed_eks_addons

Read-Only:

  • configuration_values (String) Configuration values applied to the add-on. Corresponds to config_values set in eks_addons.
  • name (String) Add-on name.
  • status (String) Add-on installation status.
  • version (String) Installed version.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Import an existing cluster attributes resource.
#  - WORKSPACE_ID is the ID of the workspace (e.g. 6a1578ae322a8a4142bbfa04)
#  - CLUSTER_ATTRIBUTES_ID is the ID of the cluster attributes resource (e.g. 6a23fee94703bc957a24eeb4)
terraform import duploai_cluster_attributes.basic WORKSPACE_ID/CLUSTER_ATTRIBUTES_ID
# Example:
# terraform import duploai_cluster_attributes.basic 6a1578ae322a8a4142bbfa04/6a23fee94703bc957a24eeb4