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

azurerm_netapp_volume - remove Computed from network_features, create_from_snapshot_resource_id and protocols_enabled #26165

Merged
merged 6 commits into from
Jun 12, 2024
Next Next commit
azurerm_netapp_volume - remove Computed from network_features
  • Loading branch information
neil-yechenwei committed May 31, 2024
commit 9c64cf312dadee067fc252786d8d1dd3d087cd0e
27 changes: 18 additions & 9 deletions internal/services/netapp/netapp_volume_resource.go
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
@@ -30,7 +31,7 @@ import (
)

func resourceNetAppVolume() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceNetAppVolumeCreate,
Read: resourceNetAppVolumeRead,
Update: resourceNetAppVolumeUpdate,
@@ -111,7 +112,7 @@ func resourceNetAppVolume() *pluginsdk.Resource {
"network_features": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Default: string(volumes.NetworkFeaturesBasic),
ValidateFunc: validation.StringInSlice([]string{
string(volumes.NetworkFeaturesBasic),
string(volumes.NetworkFeaturesStandard),
@@ -357,6 +358,20 @@ func resourceNetAppVolume() *pluginsdk.Resource {
},
},
}

if !features.FourPointOhBeta() {
resource.Schema["network_features"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
string(volumes.NetworkFeaturesBasic),
string(volumes.NetworkFeaturesStandard),
}, false),
}
}

return resource
}

func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) error {
@@ -392,13 +407,7 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err
subnetID := d.Get("subnet_id").(string)
kerberosEnabled := d.Get("kerberos_enabled").(bool)
smbContiuouslyAvailable := d.Get("smb_continuous_availability_enabled").(bool)

var networkFeatures volumes.NetworkFeatures
networkFeaturesString := d.Get("network_features").(string)
if networkFeaturesString == "" {
networkFeatures = volumes.NetworkFeaturesBasic
}
networkFeatures = volumes.NetworkFeatures(networkFeaturesString)
networkFeatures := volumes.NetworkFeatures(d.Get("network_features").(string))

smbNonBrowsable := volumes.SmbNonBrowsableDisabled
if d.Get("smb_non_browsable_enabled").(bool) {