Skip to content

Instantly share code, notes, and snippets.

@oponomarov-tu
Created August 13, 2024 09:21
Show Gist options
  • Save oponomarov-tu/f6f85516f33b20630a988a9867e39ad1 to your computer and use it in GitHub Desktop.
Save oponomarov-tu/f6f85516f33b20630a988a9867e39ad1 to your computer and use it in GitHub Desktop.
module "eks" {
# https://github.com/terraform-aws-modules/terraform-aws-eks
source = "terraform-aws-modules/eks/aws"
version = "~> 20.20.0"
create = local.create_eks_cluster
cluster_name = local.eks_cluster_name
...
}
locals {
common_kubernetes_host = module.eks.cluster_endpoint
common_cluster_ca_certificate = try(base64decode(module.eks.cluster_certificate_authority_data), "")
common_provider_api_version = "client.authentication.k8s.io/v1beta1"
common_provider_command = "aws"
common_provider_args = [
"eks", "get-token", "--cluster-name", module.eks.cluster_name, "--region", var.region
]
}
provider "kubernetes" {
host = local.common_kubernetes_host
cluster_ca_certificate = local.common_cluster_ca_certificate
exec {
api_version = local.common_provider_api_version
command = local.common_provider_command
args = local.common_provider_args
}
}
resource "kubernetes_namespace" "argocd" {
count = local.create_gitops_bridge ? 1 : 0
metadata {
name = "argocd"
}
depends_on = [
module.eks
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment