Skip to content

Commit

Permalink
first possibly valid setup
Browse files Browse the repository at this point in the history
Signed-off-by: David van der Spek <[email protected]>
  • Loading branch information
davidspek committed Sep 7, 2023
1 parent 83daf6a commit 145abf6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bootstrap/terraform/aws-bootstrap/existing.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ data "aws_eks_node_group" "cluster" {
}

data "aws_subnet" "cluster_subnets" {
count = var.create_cluster ? 0 : length(one(data.aws_eks_cluster.test_cluster[*].vpc_config[0].subnet_ids))
id = tolist(one(data.aws_eks_cluster.test_cluster[*].vpc_config[0].subnet_ids))[count.index]
count = var.create_cluster ? 0 : length(one(data.aws_eks_cluster.cluster[*].vpc_config[0].subnet_ids))
id = tolist(one(data.aws_eks_cluster.cluster[*].vpc_config[0].subnet_ids))[count.index]
}


Expand Down
2 changes: 1 addition & 1 deletion bootstrap/terraform/aws-bootstrap/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ locals {
create_vpc = var.create_cluster && var.create_vpc ? true : false
vpc_id = var.create_cluster ? one(module.vpc[*].vpc_id) : one(data.aws_eks_cluster.cluster[*].vpc_config[0].vpc_id)
cluster_id = var.create_cluster ? one(module.cluster[*].cluster_id) : one(data.aws_eks_cluster.cluster[*].id)
cluster_config = var.create_cluster ? one(module.cluster[*].config_map_aws_auth) : {}
cluster_config = try(var.create_cluster ? one(module.cluster[*].config_map_aws_auth) : tomap(false), {})
cluster_oidc_issuer_url = var.create_cluster ? one(module.cluster[*].cluster_oidc_issuer_url) : one(data.aws_eks_cluster.cluster[*].identity[0].oidc.0.issuer)
cluster_endpoint = var.create_cluster ? one(module.cluster[*].cluster_endpoint) : one(data.aws_eks_cluster.cluster[*].endpoint)
}
Expand Down
39 changes: 39 additions & 0 deletions bootstrap/terraform/aws-bootstrap/moved.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
moved {
from = module.cluster
to = module.cluster[0]
}

moved {
from = module.vpc
to = module.vpc[0]
}

moved {
from = module.single_az_node_groups
to = module.single_az_node_groups[0]
}

moved {
from = module.multi_az_node_groups
to = module.multi_az_node_groups[0]
}

moved {
from = aws_eks_addon.vpc_cni
to = aws_eks_addon.vpc_cni[0]
}

moved {
from = aws_eks_addon.core_dns
to = aws_eks_addon.core_dns[0]
}

moved {
from = aws_eks_addon.kube_proxy
to = aws_eks_addon.kube_proxy[0]
}

moved {
from = kubernetes_namespace.bootstrap
to = kubernetes_namespace.bootstrap[0]
}
4 changes: 2 additions & 2 deletions bootstrap/terraform/aws-bootstrap/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ output "worker_role_arn" {
}

output "node_groups" {
value = var.create_cluster ? [for d in merge(one(module.single_az_node_groups[*].node_groups), one(module.multi_az_node_groups[*].node_groups)): d] : {}
value = try(var.create_cluster ? [for d in merge(one(module.single_az_node_groups[*].node_groups), one(module.multi_az_node_groups[*].node_groups)): d] : tomap(false), {})
}

output "vpc" {
Expand All @@ -52,7 +52,7 @@ output "vpc_cidr" {


output "cluster" {
value = var.create_cluster ? one(module.cluster[*]) : (data.aws_eks_cluster.cluster[*])
value = try(var.create_cluster ? one(module.cluster[*]) : tomap(false), one(data.aws_eks_cluster.cluster[*]))
}

output "cluster_service_ipv4_cidr" {
Expand Down

0 comments on commit 145abf6

Please sign in to comment.