Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding comments to code that needs to be removed on v3.0 #13588

Merged
merged 5 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/services/netapp/netapp_snapshot_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func resourceNetAppSnapshot() *pluginsdk.Resource {
return &pluginsdk.Resource{
Create: resourceNetAppSnapshotCreate,
Read: resourceNetAppSnapshotRead,
// todo remove this in version 3.0 of the provider as tags was the only updatable property and they can no longer be updated and will also be removed
Update: resourceNetAppSnapshotUpdate,
Delete: resourceNetAppSnapshotDelete,

Expand Down Expand Up @@ -72,6 +73,7 @@ func resourceNetAppSnapshot() *pluginsdk.Resource {

// TODO: remove this in a next breaking changes release since tags are
// not supported anymore on Snapshots (todo 3.0)
// todo remove this in version 3.0 of the provider
"tags": {
Type: pluginsdk.TypeMap,
Optional: true,
Expand Down Expand Up @@ -169,6 +171,7 @@ func resourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) err
return nil
}

// todo remove this in version 3.0 of the provider
func resourceNetAppSnapshotUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
// Snapshot resource in Azure changed its type to proxied resource, therefore
// tags are not supported anymore, ignoring any tags.
Expand Down
27 changes: 19 additions & 8 deletions internal/services/netapp/netapp_volume_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,23 @@ func resourceNetAppVolume() *pluginsdk.Resource {
},
},

// todo remove this in version 3.0 of the provider
"cifs_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
Deprecated: "Deprecated in favour of `protocols_enabled`",
},

// todo remove this in version 3.0 of the provider
"nfsv3_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
Deprecated: "Deprecated in favour of `protocols_enabled`",
},

// todo remove this in version 3.0 of the provider
"nfsv4_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down Expand Up @@ -763,9 +766,11 @@ func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePrope
}
}
} else {
// TODO: Remove in next major version
// todo remove this in version 3.0 of the provider
cifsEnabled = v["cifs_enabled"].(bool)
// todo remove this in version 3.0 of the provider
nfsv3Enabled = v["nfsv3_enabled"].(bool)
// todo remove this in version 3.0 of the provider
nfsv41Enabled = v["nfsv4_enabled"].(bool)
}
}
Expand Down Expand Up @@ -836,29 +841,33 @@ func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPol
if v := item.AllowedClients; v != nil {
allowedClients = strings.Split(*v, ",")
}
// TODO: Start - Remove in next major version
// todo remove this in version 3.0 of the provider
cifsEnabled := false
// todo remove this in version 3.0 of the provider
nfsv3Enabled := false
// todo remove this in version 3.0 of the provider
nfsv4Enabled := false
// End - Remove in next major version
protocolsEnabled := []string{}
if v := item.Cifs; v != nil {
if *v {
protocolsEnabled = append(protocolsEnabled, "CIFS")
}
cifsEnabled = *v // TODO: Remove in next major version
// todo remove this in version 3.0 of the provider
cifsEnabled = *v
}
if v := item.Nfsv3; v != nil {
if *v {
protocolsEnabled = append(protocolsEnabled, "NFSv3")
}
nfsv3Enabled = *v // TODO: Remove in next major version
// todo remove this in version 3.0 of the provider
nfsv3Enabled = *v
}
if v := item.Nfsv41; v != nil {
if *v {
protocolsEnabled = append(protocolsEnabled, "NFSv4.1")
}
nfsv4Enabled = *v // TODO: Remove in next major version
// todo remove this in version 3.0 of the provider
nfsv4Enabled = *v
}
unixReadOnly := false
if v := item.UnixReadOnly; v != nil {
Expand All @@ -880,9 +889,11 @@ func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPol
"unix_read_write": unixReadWrite,
"root_access_enabled": rootAccessEnabled,
"protocols_enabled": utils.FlattenStringSlice(&protocolsEnabled),
// TODO: Remove in next major version
"cifs_enabled": cifsEnabled,
// todo remove this in version 3.0 of the provider
"cifs_enabled": cifsEnabled,
// todo remove this in version 3.0 of the provider
"nfsv3_enabled": nfsv3Enabled,
// todo remove this in version 3.0 of the provider
"nfsv4_enabled": nfsv4Enabled,
})
}
Expand Down
12 changes: 5 additions & 7 deletions internal/services/netapp/netapp_volume_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,11 @@ resource "azurerm_netapp_volume" "test" {
}

export_policy_rule {
rule_index = 3
allowed_clients = ["1.2.6.0/24"]
cifs_enabled = false
nfsv3_enabled = true
nfsv4_enabled = false
unix_read_only = true
unix_read_write = false
rule_index = 3
allowed_clients = ["1.2.6.0/24"]
protocols_enabled = ["NFSv3"]
unix_read_only = true
unix_read_write = false
}

tags = {
Expand Down
6 changes: 0 additions & 6 deletions website/docs/r/netapp_volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ An `export_policy_rule` block supports the following:

* `protocols_enabled` - (Optional) A list of allowed protocols. Valid values include `CIFS`, `NFSv3`, or `NFSv4.1`. Only one value is supported at this time. This replaces the previous arguments: `cifs_enabled`, `nfsv3_enabled` and `nfsv4_enabled`.

* `cifs_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the CIFS protocol allowed?

* `nfsv3_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the NFSv3 protocol allowed?

* `nfsv4_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the NFSv4 protocol allowed?

* `unix_read_only` - (Optional) Is the file system on unix read only?

* `unix_read_write` - (Optional) Is the file system on unix read and write?
Expand Down