diff --git a/cluster.tf b/cluster.tf index 2e0ca6862a..c558e52a66 100644 --- a/cluster.tf +++ b/cluster.tf @@ -46,7 +46,7 @@ resource "aws_eks_cluster" "this" { } resource "null_resource" "wait_for_cluster" { - count = var.manage_aws_auth ? 1 : 0 + count = var.create_eks && var.manage_aws_auth ? 1 : 0 depends_on = [ aws_eks_cluster.this[0] diff --git a/examples/create_false/main.tf b/examples/create_false/main.tf new file mode 100644 index 0000000000..86604aacdd --- /dev/null +++ b/examples/create_false/main.tf @@ -0,0 +1,30 @@ +provider "aws" { + region = var.region +} + +data "aws_eks_cluster" "cluster" { + count = 0 + name = module.eks.cluster_id +} + +data "aws_eks_cluster_auth" "cluster" { + count = 0 + name = module.eks.cluster_id +} + +provider "kubernetes" { + host = element(concat(data.aws_eks_cluster.cluster[*].endpoint, list("")), 0) + cluster_ca_certificate = base64decode(element(concat(data.aws_eks_cluster.cluster[*].certificate_authority.0.data, list("")), 0)) + token = element(concat(data.aws_eks_cluster_auth.cluster[*].token, list("")), 0) + load_config_file = false + version = "~> 1.11" +} + +module "eks" { + source = "../.." + create_eks = false + + vpc_id = "" + cluster_name = "" + subnets = [] +} diff --git a/examples/create_false/variables.tf b/examples/create_false/variables.tf new file mode 100644 index 0000000000..81b8dbe73e --- /dev/null +++ b/examples/create_false/variables.tf @@ -0,0 +1,3 @@ +variable "region" { + default = "us-west-2" +}