generated from appvia/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathefs_csi.tf
More file actions
51 lines (43 loc) · 1.64 KB
/
efs_csi.tf
File metadata and controls
51 lines (43 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
## Used to enable the EFS CSI driver on the EKS cluster
#
locals {
## Indicates if we should enable the EFS CSI driver
enable_efs_csi_driver = try(var.efs_csi_driver.enable, false) ? true : false
}
## Attach the EFS CSI driver policy to the EKS cluster
module "aws_efs_csi_pod_identity" {
count = local.enable_efs_csi_driver ? 1 : 0
source = "terraform-aws-modules/eks-pod-identity/aws"
version = "2.7.0"
name = "${local.name}-efs-csi-driver"
attach_aws_efs_csi_policy = true
aws_efs_csi_policy_name = format("%s-efs-csi-driver", local.name)
description = "Pod identity for the EFS CSI driver for the ${local.name} cluster"
tags = local.tags
## Default association for the EFS CSI driver pod identity
association_defaults = {
namespace = var.efs_csi_driver.namespace
service_account = var.efs_csi_driver.service_account
}
## Associations for the EFS CSI driver pod identity
associations = {
addon = {
cluster_name = module.eks.cluster_name
}
}
}
## Attach the EFS CSI driver policy to the EKS cluster
resource "aws_eks_addon" "efs_csi_driver" {
count = local.enable_efs_csi_driver ? 1 : 0
cluster_name = module.eks.cluster_name
addon_name = "aws-efs-csi-driver"
addon_version = var.efs_csi_driver.version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
tags = local.tags
pod_identity_association {
role_arn = module.aws_efs_csi_pod_identity[0].iam_role_arn
service_account = var.efs_csi_driver.service_account
}
}