fix: Create false and avoid waiting forever for a non-existent cluster to respond (#789)

This commit is contained in:
Daniel Piddock
2020-03-18 08:54:57 +01:00
committed by GitHub
parent 2c98a00b21
commit e8a1ce17d8
3 changed files with 34 additions and 1 deletions

View File

@@ -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]

View File

@@ -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 = []
}

View File

@@ -0,0 +1,3 @@
variable "region" {
default = "us-west-2"
}