Skip to content

Commit cdb8f0f

Browse files
committed
Add FSX CSI plugin and required storage class
1 parent 96e6e2b commit cdb8f0f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
resource "helm_release" "fsx_csi_driver" {
2+
namespace = "kube-system"
3+
4+
name = "aws-fsx-csi-driver"
5+
repository = "https://kubernetes-sigs.github.io/aws-fsx-csi-driver/"
6+
chart = "aws-fsx-csi-driver"
7+
}
8+
9+
resource "kubernetes_storage_class_v1" "fsx_sc" {
10+
metadata {
11+
name = "fsx-sc"
12+
}
13+
storage_provisioner = "fsx.csi.aws.com"
14+
parameters = {
15+
subnetId = tolist(module.eks.vpc_private_subnet_ids)[0]
16+
securityGroupIds = module.eks.cluster_security_group
17+
deploymentType = "PERSISTENT_2"
18+
}
19+
depends_on = [ helm_release.fsx_csi_driver ]
20+
}

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

+29
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,32 @@ resource "kubernetes_annotations" "ebs_csi_iam_annotation" {
2727
"eks.amazonaws.com/role-arn": module.ebs_csi_irsa.iam_role_arn
2828
}
2929
}
30+
module "fsx_csi_irsa" {
31+
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
32+
33+
role_name_prefix = "fsx-csi-${local.cluster_name}"
34+
attach_fsx_lustre_csi_policy = true
35+
36+
oidc_providers = {
37+
main = {
38+
provider_arn = module.eks.oidc_provider_arn
39+
namespace_service_accounts = [
40+
"kube-system:fsx-csi-controller-sa"
41+
]
42+
}
43+
}
44+
45+
tags = local.tags
46+
}
47+
48+
resource "kubernetes_annotations" "fsx_csi_controller_annotation" {
49+
api_version = "v1"
50+
kind = "ServiceAccount"
51+
metadata {
52+
name = "fsx-csi-controller-sa"
53+
namespace = "kube-system"
54+
}
55+
annotations = {
56+
"eks.amazonaws.com/role-arn": module.fsx_csi_irsa.iam_role_arn
57+
}
58+
}

0 commit comments

Comments
 (0)