You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// k: The key of the field, e.g., "export_policy.0.rules.1.squash_mode"
82
+
// old: The value in the state (what the API returned on last read)
83
+
// new: The value in the configuration (what the user set)
84
+
// d: The ResourceData for the entire resource
85
+
86
+
// 1. Only suppress if the user did NOT set squash_mode in the config.
87
+
// According to the requirements, a "classic rule" is identified by the ABSENCE of squash_mode.
88
+
ifnew=="ALL_SQUASH" {
89
+
// If 'new' is not an empty string, the user has explicitly provided a value
90
+
// for squash_mode in the Terraform configuration. In this scenario, any
91
+
// difference between the API's value ('old') and the configured value ('new')
92
+
// is a real change and should NOT be suppressed.
93
+
returnfalse
94
+
}
95
+
96
+
ifnew==""&&old!="ALL_SQUASH" {
97
+
returntrue
98
+
}
99
+
100
+
// 2. The user did not specify squash_mode in the configuration ('new' is empty).
101
+
// Now, we suppress the diff if the API/state value ('old') is one of the
102
+
// specific values that should be treated as equivalent to an unset field.
103
+
// These values are "NO_ROOT_SQUASH", "ROOT_SQUASH".
104
+
switchold {
105
+
case"NO_ROOT_SQUASH", "ROOT_SQUASH", "":
106
+
// The API returned one of the values that we consider equivalent to the field
107
+
// being unconfigured by the user. Since the user also didn't configure it,
108
+
// we should suppress this diff.
109
+
returntrue
110
+
default:
111
+
// If 'old' is not one of the values to be suppressed (and 'new' is empty),
112
+
// we do not suppress the diff. This could happen if, for instance, the API
113
+
// returned an unexpected value or if 'old' is also empty.
114
+
returnfalse
115
+
}
116
+
// Note: The previous logic involving parsing 'k' and checking 'has_root_access'
117
+
// has been removed because squash_mode is independent of has_root_access,
118
+
// and a "classic rule" is defined by the absence of squash_mode itself.
119
+
}
120
+
80
121
var (
81
122
_=bytes.Clone
82
123
_=context.WithCancel
@@ -361,13 +402,14 @@ the parent Volume's 'capacity_gib'.`,
361
402
"anon_uid": {
362
403
Type: schema.TypeInt,
363
404
Optional: true,
364
-
Description: `An integer representing the anonymous user ID. Range is 0 to 4294967295. Required when 'squash_mode' is 'ROOT_SQUASH' or 'ALL_SQUASH'.`,
405
+
Description: `An integer representing the anonymous user ID. Range is 0 to 4294967295. Required when 'squash_mode' is 'ALL_SQUASH'.`,
365
406
},
366
407
"has_root_access": {
367
-
Type: schema.TypeString,
368
-
Computed: true,
369
-
Optional: true,
370
-
Description: `If enabled, the root user (UID = 0) of the specified clients doesn't get mapped to nobody (UID = 65534). This is also known as no_root_squash.`,
408
+
Type: schema.TypeString,
409
+
Computed: true,
410
+
Optional: true,
411
+
Description: `If enabled, the root user (UID = 0) of the specified clients doesn't get mapped to nobody (UID = 65534). This is also known as no_root_squash.
412
+
It's overwritten by the squash_mode parameter. Use either squash_mode or has_root_access.`,
371
413
},
372
414
"kerberos5_read_only": {
373
415
Type: schema.TypeBool,
@@ -410,11 +452,12 @@ the parent Volume's 'capacity_gib'.`,
410
452
Description: `Enable to apply the export rule to NFSV4.1 clients.`,
Description: `SquashMode defines how remote user privileges are restricted when accessing an NFS export. It controls how the user identities (like root) are mapped to anonymous users to limit access and enforce security. Possible values: ["NO_ROOT_SQUASH", "ROOT_SQUASH", "ALL_SQUASH"]`,
Description: `SquashMode defines how remote user privileges are restricted when accessing an NFS export. It controls how the user identities (like root) are mapped to anonymous users to limit access and enforce security.
460
+
It overwrites the has_root_access parameter. Use either squash_mode or has_root_access. For ALL_SQUASH, access_type needs to be set to READ_WRITE. Possible values: ["SQUASH_MODE_UNSPECIFIED", "NO_ROOT_SQUASH", "ROOT_SQUASH", "ALL_SQUASH"]`,
418
461
},
419
462
},
420
463
},
@@ -1525,12 +1568,106 @@ func resourceNetappVolumeUpdate(d *schema.ResourceData, meta interface{}) error
0 commit comments