Skip to content

Commit 6bec0b9

Browse files
committed
simplify export statement
1 parent 3434f6f commit 6bec0b9

File tree

4 files changed

+19
-55
lines changed

4 files changed

+19
-55
lines changed

environment/deployments/science-platform/env/dev.tfvars

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,8 @@ netapp_definitions = [
113113
weekly_backup_limit = 5
114114
monthly_backup_limit = 12
115115
}
116-
export_policy_rules = [
117-
{
118-
has_root_access = true
119-
access_type = "READ_WRITE"
120-
}
121-
]
116+
has_root_access = true
117+
access_type = "READ_WRITE"
122118
default_user_quota_mib = 5000
123119
},
124120
{ name = "project"
@@ -150,12 +146,8 @@ netapp_definitions = [
150146
weekly_backup_limit = 5
151147
monthly_backup_limit = 12
152148
}
153-
export_policy_rules = [
154-
{
155-
has_root_access = true
156-
access_type = "READ_WRITE"
157-
}
158-
]
149+
has_root_access = true
150+
access_type = "READ_WRITE"
159151
default_user_quota_mib = 5000
160152
},
161153
{ name = "scratch"
@@ -188,12 +180,8 @@ netapp_definitions = [
188180
weekly_backup_limit = 0
189181
monthly_backup_limit = 0
190182
}
191-
export_policy_rules = [
192-
{
193-
has_root_access = true
194-
access_type = "READ_WRITE"
195-
}
196-
]
183+
has_root_access = true
184+
access_type = "READ_WRITE"
197185
default_user_quota_mib = 5000
198186
}
199187
]

environment/deployments/science-platform/variables.tf

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,9 @@ variable "netapp_definitions" {
263263
weekly_backup_limit = optional(number)
264264
monthly_backup_limit = optional(number)
265265
}))
266-
export_policy_rules = optional(list(object({
267-
allowed_clients = optional(string)
268-
has_root_access = optional(bool, false)
269-
access_type = optional(string) # READ_ONLY, READ_WRITE, READ_NONE
270-
nfsv3 = optional(bool, true)
271-
nfsv4 = optional(bool, true)
272-
# Not bothering with Kerberos 5 options
273-
})))
266+
# allowed_clients = string # Derived from subnets
267+
has_root_access = bool
268+
access_type = string
274269
default_user_quota_mib = optional(number)
275270
}))
276271
}

modules/netapp_volumes/main.tf

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,30 +94,13 @@ resource "google_netapp_volume" "instance" {
9494
}
9595

9696
# Here's the tricky bit
97-
dynamic "export_policy" {
98-
for_each = each.value.export_policy_rules == null ? [] : ["export_policy_rules"]
99-
content {
100-
dynamic "rules" {
101-
for_each = each.value.export_policy_rules == null ? {} : each.value.export_policy_rules
102-
content {
103-
allowed_clients = "10.129.0.0/16" # var.allowed_ips
104-
has_root_access = lookup(rules.value, "has_root_access")
105-
access_type = lookup(rules.value, "access_type")
106-
nfsv3 = true
107-
nfsv4 = true
108-
}
109-
}
97+
export_policy {
98+
rules {
99+
allowed_clients = var.allowed_ips
100+
has_root_access = each.value.has_root_access
101+
access_type = each.value.access_type
110102
}
111103
}
112-
# export_policy {
113-
# rules {
114-
# nfsv3 = true
115-
# nfsv4 = true
116-
# has_root_access = true
117-
# access_type = "READ_WRITE"
118-
# allowed_clients = "10.129.0.0/16"
119-
# }
120-
# }
121104
}
122105

123106
resource "google_netapp_backup_policy" "instance" {

modules/netapp_volumes/variables.tf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ variable "definitions" {
5959
hour = optional(number,0)
6060
}))
6161
weekly_schedule = optional(object({
62-
snapshots_to_keep = number,
62+
snapshots_to_keep = number
6363
minute = optional(number,0)
6464
hour = optional(number,0)
6565
day = optional(string, "Sunday")
6666
}))
6767
monthly_schedule = optional(object({
68-
snapshots_to_keep = number,
68+
snapshots_to_keep = number
6969
minute = optional(number,0)
7070
hour = optional(number,0)
7171
days = optional(string, "1")
@@ -77,11 +77,9 @@ variable "definitions" {
7777
weekly_backup_limit = optional(number)
7878
monthly_backup_limit = optional(number)
7979
}))
80-
export_policy_rules = optional(list(object({
81-
allowed_clients = string
82-
has_root_access = bool
83-
access_type = string
84-
})))
80+
# allowed_clients = string # Derived from subnets
81+
has_root_access = bool
82+
access_type = string
8583
default_user_quota_mib = optional(number)
8684
}))
8785
}

0 commit comments

Comments
 (0)