Hacker News new | ask | show | jobs
by etxm 1831 days ago
> Also the staticness of providers are a serious pain, for example you can't create a kubernetes cluster then add a resource to it.

TF def has some rough edges, but you can certainly create a cluster and add resources in a single root module (I don’t think it’s a great practice).

In this example the EKS cluster is in a module, but it can be a ref to a resource in the same module as well.

  data "aws_eks_cluster_auth" "current" {
    name = module.eks.cluster_id
  }

  provider "kubernetes" {
    load_config_file       = false
    host                   = module.eks.cluster_endpoint
    cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
    token                  = data.aws_eks_cluster_auth.current.token
  }