Skip to content

Commit

Permalink
fix: Create false and avoid waiting forever for a non-existent clus…
Browse files Browse the repository at this point in the history
…ter to respond (#789)
  • Loading branch information
dpiddockcmp authored Mar 18, 2020
1 parent 2c98a00 commit e8a1ce1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
30 changes: 30 additions & 0 deletions examples/create_false/main.tf
Original file line number Diff line number Diff line change
@@ -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 = []
}
3 changes: 3 additions & 0 deletions examples/create_false/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
variable "region" {
default = "us-west-2"
}

0 comments on commit e8a1ce1

Please sign in to comment.