-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolume.tf
More file actions
47 lines (40 loc) · 1.16 KB
/
volume.tf
File metadata and controls
47 lines (40 loc) · 1.16 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
resource "kubernetes_persistent_volume_v1" "this" {
metadata {
name = local.resource_name
namespace = local.kubernetes_namespace
labels = local.tags
}
spec {
access_modes = ["ReadWriteMany"]
persistent_volume_reclaim_policy = "Retain"
storage_class_name = "efs"
volume_mode = "Filesystem"
capacity = {
storage = "100Gi" // EFS does not have storage limits, this is done to match K8s semantics
}
persistent_volume_source {
csi {
driver = "efs.csi.aws.com"
volume_handle = "${local.fs_id}:${var.source_path}"
}
}
}
}
resource "kubernetes_persistent_volume_claim_v1" "this" {
metadata {
name = local.resource_name
namespace = local.kubernetes_namespace
labels = local.tags
}
spec {
access_modes = ["ReadWriteMany"]
resources {
requests = {
// EFS does not have storage limits, this is done to match K8s semantics
// This must be <= persistent volume above
storage = "1Gi"
}
}
volume_name = kubernetes_persistent_volume_v1.this.metadata[0].name
}
}