@@ -58,6 +58,7 @@ module "vpc" {
58
58
source = " terraform-aws-modules/vpc/aws"
59
59
version = " 5.21.0"
60
60
name = var. stack_name
61
+ create_vpc = var. stack_existing_vpc_config == null
61
62
enable_dns_hostnames = " true"
62
63
enable_dns_support = " true"
63
64
enable_nat_gateway = " true"
@@ -86,7 +87,7 @@ data "aws_region" "current" {}
86
87
87
88
# https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/using-govcloud-vpc-endpoints.html
88
89
resource "aws_vpc_endpoint" "eks_vpc_endpoints" {
89
- for_each = toset (var. vpc_endpoints )
90
+ for_each = var . stack_existing_vpc_config == null ? toset (var. vpc_endpoints ) : []
90
91
vpc_id = module. vpc . vpc_id
91
92
service_name = " com.amazonaws.${ data . aws_region . current . name } .${ each . value } "
92
93
tags = var. stack_tags
@@ -96,16 +97,16 @@ module "eks" {
96
97
source = " terraform-aws-modules/eks/aws"
97
98
version = " 20.36.0"
98
99
cluster_name = var. stack_name
99
- cluster_version = " 1.31 "
100
+ cluster_version = var . eks_cluster_version
100
101
create = var. stack_create
101
102
# TODO: resume usage of node security group; see: https://linear.app/pelotech/issue/PEL-97
102
103
create_node_security_group = false
103
104
cluster_endpoint_private_access = true
104
105
cluster_endpoint_public_access = true
105
106
cluster_enabled_log_types = []
106
107
107
- subnet_ids = module. vpc . private_subnets
108
- vpc_id = module. vpc . vpc_id
108
+ vpc_id = var . stack_existing_vpc_config != null ? var . stack_existing_vpc_config . vpc_id : module. vpc . vpc_id
109
+ subnet_ids = var . stack_existing_vpc_config != null ? var . stack_existing_vpc_config . subnet_ids : module. vpc . private_subnets
109
110
create_kms_key = true
110
111
enable_irsa = true
111
112
# cluster_encryption_config = [{
0 commit comments