Skip to content

Commit 0eee754

Browse files
committed
Add aws_vpc_endpoint data block and optional route_table_association
1 parent 45deb94 commit 0eee754

File tree

2 files changed

+50
-1
lines changed
  • src/_nebari/stages/infrastructure/template/aws/modules

2 files changed

+50
-1
lines changed

src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,20 @@ resource "aws_iam_openid_connect_provider" "oidc_provider" {
196196
var.tags
197197
)
198198
}
199+
200+
/*
201+
resource "aws_eks_identity_provider_config" "oidc_config" {
202+
cluster_name = aws_eks_cluster.main.name
203+
204+
oidc {
205+
client_id = "sts.${data.aws_partition.current.dns_suffix}"
206+
identity_provider_config_name = "oidc-config"
207+
issuer_url = aws_eks_cluster.main.identity[0].oidc[0].issuer
208+
}
209+
210+
tags = merge(
211+
{ Name = "${var.name}-eks-oidc-config" },
212+
var.tags
213+
)
214+
}
215+
*/

src/_nebari/stages/infrastructure/template/aws/modules/network/main.tf

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,33 @@ data "aws_security_group" "main" {
180180
}
181181

182182
resource "aws_vpc_endpoint" "s3" {
183+
count = data.aws_vpc_endpoint.s3 == null ? 1 : 0
183184
vpc_id = local.vpc.id
184185
service_name = "com.amazonaws.${var.region}.s3"
185186
vpc_endpoint_type = "Gateway"
186187
route_table_ids = local.private_route_tables[*].id
187188
tags = merge({ Name = "${var.name}-s3-endpoint" }, var.tags)
188189
}
189190

191+
data "aws_vpc_endpoint" "s3" {
192+
vpc_id = local.vpc.id
193+
service_name = "com.amazonaws.${var.region}.s3"
194+
}
195+
196+
/*
197+
# probably can just remove this block entirely - it adds route_table_associations between to data.aws_vpc_endpoint.s3
198+
# with local.private_route_tables (if local.private_route_tables were provided by variable, may be duplicative/overwrite existing associations)
199+
resource "aws_vpc_endpoint_route_table_association" "s3" {
200+
count = data.aws_vpc_endpoint.s3 != null ? length(local.private_route_tables) : 0
201+
#count = length(local.private_route_tables)
202+
203+
# this won't be created unless data.aws_vpc_endpoint.s3 exists, no need to refer to aws_vpc_endpoint.s3 resource here:
204+
#vpc_endpoint_id = length(aws_vpc_endpoint.s3) > 0 ? one(aws_vpc_endpoint.s3[*]).id : data.aws_vpc_endpoint.s3.id
205+
vpc_endpoint_id = data.aws_vpc_endpoint.s3.id
206+
route_table_id = local.private_route_tables[count.index].id
207+
}
208+
*/
209+
190210
resource "aws_vpc_endpoint" "ecr_api" {
191211
vpc_id = local.vpc.id
192212
service_name = "com.amazonaws.${var.region}.ecr.api"
@@ -235,9 +255,21 @@ resource "aws_vpc_endpoint" "eks" {
235255
vpc_id = local.vpc.id
236256
service_name = "com.amazonaws.${var.region}.eks"
237257
vpc_endpoint_type = "Interface"
238-
private_dns_enabled = true
258+
private_dns_enabled = false
239259
security_group_ids = [local.aws_security_group.id]
240260
#security_group_ids = local.aws_security_groups[*].id
241261
subnet_ids = local.private_subnets[*].id
242262
tags = merge({ Name = "${var.name}-eks-endpoint" }, var.tags)
243263
}
264+
/*
265+
resource "aws_vpc_endpoint" "eks_oidc" {
266+
vpc_id = local.vpc.id
267+
service_name = "com.amazonaws.${var.region}.eks.oidc"
268+
vpc_endpoint_type = "Interface"
269+
private_dns_enabled = true
270+
security_group_ids = [local.aws_security_group.id]
271+
#security_group_ids = local.aws_security_groups[*].id
272+
subnet_ids = local.private_subnets[*].id
273+
tags = merge({ Name = "${var.name}-eks-oidc-endpoint" }, var.tags)
274+
}
275+
*/

0 commit comments

Comments
 (0)