Skip to content

Commit cf9bf23

Browse files
committed
Allow for the FSx CSI driver to be selectively installed
1 parent a2a1767 commit cf9bf23

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

deployment/aws-terraform/1-services/fsx-csi.tf

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
resource "helm_release" "fsx_csi_driver" {
2+
count = local.use_fsx
23
namespace = "kube-system"
34

45
name = "aws-fsx-csi-driver"
56
repository = "https://kubernetes-sigs.github.io/aws-fsx-csi-driver/"
67
chart = "aws-fsx-csi-driver"
8+
9+
set {
10+
name = "controller.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
11+
value = module.fsx_csi_irsa[0].iam_role_arn
12+
}
13+
14+
set {
15+
name = "node.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
16+
value = module.fsx_csi_irsa[0].iam_role_arn
17+
}
718
}
819

920
resource "kubernetes_storage_class_v1" "fsx_sc" {
21+
count = local.use_fsx
1022
metadata {
1123
name = "fsx-sc"
1224
}
@@ -16,5 +28,5 @@ resource "kubernetes_storage_class_v1" "fsx_sc" {
1628
securityGroupIds = module.eks.cluster_security_group
1729
deploymentType = "PERSISTENT_2"
1830
}
19-
depends_on = [ helm_release.fsx_csi_driver ]
31+
depends_on = [ helm_release.fsx_csi_driver[0] ]
2032
}

deployment/aws-terraform/1-services/irsa.tf

+15-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ resource "kubernetes_annotations" "ebs_csi_iam_annotation" {
2929
}
3030

3131
module "fsx_csi_irsa" {
32+
count = local.use_fsx
33+
3234
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
3335

3436
role_name_prefix = "fsx-csi-${local.cluster_name}"
@@ -46,14 +48,16 @@ module "fsx_csi_irsa" {
4648
tags = local.tags
4749
}
4850

49-
resource "kubernetes_annotations" "fsx_csi_controller_annotation" {
50-
api_version = "v1"
51-
kind = "ServiceAccount"
52-
metadata {
53-
name = "fsx-csi-controller-sa"
54-
namespace = "kube-system"
55-
}
56-
annotations = {
57-
"eks.amazonaws.com/role-arn": module.fsx_csi_irsa.iam_role_arn
58-
}
59-
}
51+
# resource "kubernetes_annotations" "fsx_csi_controller_annotation" {
52+
# count = local.use_fsx
53+
54+
# api_version = "v1"
55+
# kind = "ServiceAccount"
56+
# metadata {
57+
# name = "fsx-csi-controller-sa"
58+
# namespace = "kube-system"
59+
# }
60+
# annotations = {
61+
# "eks.amazonaws.com/role-arn": module.fsx_csi_irsa[0].iam_role_arn
62+
# }
63+
# }

deployment/aws-terraform/1-services/locals.tf

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ locals {
22
cluster_name = "${var.project_prefix}-${var.environment}"
33
db_count = var.create_rds_instance ? 1 : 0
44
cognito_pool_count = var.create_cognito_pool ? 1 : 0
5+
use_fsx = var.use_fsx_csi ? 1 : 0
56

67
tags = {
78
Name = var.project_prefix

deployment/aws-terraform/1-services/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ variable "google_identity_client_secret" {
4444
description = "Client ID for Google identity provider"
4545
}
4646

47+
variable "use_fsx_csi" {
48+
type = bool
49+
description = "Install CSI driver for FSx for Lustre volumes"
50+
default = false
51+
}
52+
4753
variable "r53_rds_private_hosted_zone" {
4854
type = string
4955
default = null

0 commit comments

Comments
 (0)