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

[Bug]: Volume modify incorrectly tries to update in-place a RW to DP change in volume attribute. #329

Open
nichollri opened this issue Oct 17, 2024 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@nichollri
Copy link

Terraform Core Version

1.9.6

ONTAP Provider Version

1.1.4

Affected Resource(s)

netapp-ontap_storage_volume_resource

Expected Behavior

I changed in my terraform code the "type" from a RW volume to a DP volume. I expected that the terraform should destroy the volume and recreate it. Instead it said it would "update in-place"

Actual Behavior

When trying to update in-place, it failed as you cannot modify a RW volume to DP directly. It gave ONTAP API 400 errors.

`Terraform will perform the following actions:

netapp-ontap_storage_volume_resource.volloop["cifs_share"] will be updated in-place

~ resource "netapp-ontap_storage_volume_resource" "volloop" {
~ analytics = {
~ state = "off" -> (known after apply)
} -> (known after apply)
~ comment = null -> (known after apply)
~ efficiency = {
~ compression = "inline" -> (known after apply)
~ policy_name = "auto" -> (known after apply)
} -> (known after apply)
~ encryption = false -> (known after apply)
id = "ced2bde9-8cab-11ef-8100-fd3c3ad661ce"
~ language = "c.utf_8" -> (known after apply)
name = "cifs_share"
~ nas = {
~ group_id = 0 -> (known after apply)
~ unix_permissions = 755 -> (known after apply)
~ user_id = 0 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ qos_policy_group = null -> (known after apply)
~ snaplock = {
~ type = "non_snaplock" -> (known after apply)
} -> (known after apply)
~ space = {
~ percent_snapshot_space = 5 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ state = "online" -> (known after apply)
~ tiering = {
~ minimum_cooling_days = 31 -> (known after apply)
# (1 unchanged attribute hidden)
}
~ type = "rw" -> "DP"
# (5 unchanged attributes hidden)
}

netapp-ontap_storage_volume_resource.volloop["rvwn_from_bxp"] will be updated in-place

~ resource "netapp-ontap_storage_volume_resource" "volloop" {
~ analytics = {
~ state = "off" -> (known after apply)
} -> (known after apply)
~ comment = null -> (known after apply)
~ efficiency = {
~ compression = "inline" -> (known after apply)
~ policy_name = "auto" -> (known after apply)
} -> (known after apply)
~ encryption = false -> (known after apply)
id = "ced2b872-8cab-11ef-8100-fd3c3ad661ce"
~ language = "c.utf_8" -> (known after apply)
name = "rvwn_from_bxp"
~ nas = {
~ group_id = 0 -> (known after apply)
~ unix_permissions = 755 -> (known after apply)
~ user_id = 0 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ qos_policy_group = null -> (known after apply)
~ snaplock = {
~ type = "non_snaplock" -> (known after apply)
} -> (known after apply)
~ space = {
~ percent_snapshot_space = 5 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ state = "online" -> (known after apply)
~ tiering = {
~ minimum_cooling_days = 31 -> (known after apply)
# (1 unchanged attribute hidden)
}
~ type = "rw" -> "DP"
# (5 unchanged attributes hidden)
}

netapp-ontap_storage_volume_resource.volloop["unix"] will be updated in-place

~ resource "netapp-ontap_storage_volume_resource" "volloop" {
~ analytics = {
~ state = "off" -> (known after apply)
} -> (known after apply)
~ comment = null -> (known after apply)
~ efficiency = {
~ compression = "inline" -> (known after apply)
~ policy_name = "auto" -> (known after apply)
} -> (known after apply)
~ encryption = false -> (known after apply)
id = "ced3dc1c-8cab-11ef-8850-2b70aca4968a"
~ language = "c.utf_8" -> (known after apply)
name = "unix"
~ nas = {
~ group_id = 0 -> (known after apply)
~ unix_permissions = 755 -> (known after apply)
~ user_id = 0 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ qos_policy_group = null -> (known after apply)
~ snaplock = {
~ type = "non_snaplock" -> (known after apply)
} -> (known after apply)
~ space = {
~ percent_snapshot_space = 5 -> (known after apply)
# (3 unchanged attributes hidden)
}
~ state = "online" -> (known after apply)
~ tiering = {
~ minimum_cooling_days = 31 -> (known after apply)
# (1 unchanged attribute hidden)
}
~ type = "rw" -> "DP"
# (5 unchanged attributes hidden)
}

Plan: 0 to add, 3 to change, 0 to destroy.
`

Relevant Error/Panic Output Snippet

netapp-ontap_storage_volume_resource.volloop["cifs_share"]: Modifying... [id=ced2bde9-8cab-11ef-8100-fd3c3ad661ce]
netapp-ontap_storage_volume_resource.volloop["rvwn_from_bxp"]: Modifying... [id=ced2b872-8cab-11ef-8100-fd3c3ad661ce]
netapp-ontap_storage_volume_resource.volloop["unix"]: Modifying... [id=ced3dc1c-8cab-11ef-8850-2b70aca4968a]
╷
│ Error: error updating volume
│
│   with netapp-ontap_storage_volume_resource.volloop["rvwn_from_bxp"],
│   on main.tf line 98, in resource "netapp-ontap_storage_volume_resource" "volloop":
│   98: resource "netapp-ontap_storage_volume_resource" "volloop" {
│
│ error on POST storage/volumes: REST reported error restclient.RestError{Code:"262196", Message:"Field \"type\" cannot
│ be set in this operation", Target:"type"}, statusCode: 400, statusCode 400
╵
╷
│ Error: error updating volume
│
│   with netapp-ontap_storage_volume_resource.volloop["cifs_share"],
│   on main.tf line 98, in resource "netapp-ontap_storage_volume_resource" "volloop":
│   98: resource "netapp-ontap_storage_volume_resource" "volloop" {
│
│ error on POST storage/volumes: REST reported error restclient.RestError{Code:"262196", Message:"Field \"type\" cannot
│ be set in this operation", Target:"type"}, statusCode: 400, statusCode 400
╵
╷
│ Error: error updating volume
│
│   with netapp-ontap_storage_volume_resource.volloop["unix"],
│   on main.tf line 98, in resource "netapp-ontap_storage_volume_resource" "volloop":
│   98: resource "netapp-ontap_storage_volume_resource" "volloop" {
│
│ error on POST storage/volumes: REST reported error restclient.RestError{Code:"262196", Message:"Field \"type\" cannot
│ be set in this operation", Target:"type"}, statusCode: 400, statusCode 400

Terraform Configuration Files

resource "netapp-ontap_storage_volume_resource" "volloop" {
for_each = data.netapp-ontap_storage_volume_data_source.my_vol
cx_profile_name = "dr_clus"
name = "${each.value.name}_dp"
type = "RW"
svm_name = aws_fsx_ontap_storage_virtual_machine.mysvm.name
aggregates = [
{
name = "aggr1"
},
]
space_guarantee = "none"
space = {
size = each.value.space.size
size_unit = each.value.space.size_unit
logical_space = {
enforcement = true
reporting = true
}
}
tiering = {
policy_name = "all"
}
nas = {
export_policy_name = "default"
security_style = "unix"
# junction_path = join("", ["/",each.value.name])
}
}

Steps to Reproduce

deploy with 'RW' volume type and then switch to "DP" and apply again.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@nichollri nichollri added the bug Something isn't working label Oct 17, 2024
@carchi8py carchi8py added this to the 2.0.1 milestone Oct 29, 2024
@carchi8py carchi8py moved this from Future to 2.0.1 in Terraform for ONTAP Roadmap Oct 29, 2024
@carchi8py
Copy link
Contributor

Quick note to who ever picks this up to fix it. A change in type should in the schema have a modifier.ReequireReplace() (String for example https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier#RequiresReplace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 2.0.1
Development

No branches or pull requests

2 participants