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: add extra validation when data_protection_snapshot_policy.0. snapshot_policy_id is empty #18348

Merged
merged 2 commits into from
Sep 14, 2022
Merged

azurerm_netapp_volume: add extra validation when data_protection_snapshot_policy.0. snapshot_policy_id is empty #18348

merged 2 commits into from
Sep 14, 2022

Conversation

LarsK78s
Copy link
Contributor

In at least one circumstance, described in issue #18284, the azure backend is set the SnapshotPolicyId to an empty string.

This proposed change checks if the string is empty, and then ignoring the block.

fixes: #18284

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @LarsK78s, thanks for opening this PR! I checked your change and it looks good but we can make it slightly better by consolidating some lines

@@ -1121,6 +1121,10 @@ func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *volumes.VolumeProper
return []interface{}{}
}

if input.Snapshot != nil && *input.Snapshot.SnapshotPolicyId == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can consolidate into this line.

if input == nil || input.Snapshot == nil || *input.Snapshot.SnapshotPolicyId == ""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @mbfrahry, thanks for the feedback!
I changed the corresponding code and added an new commit.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 📟

@mbfrahry mbfrahry changed the title azurerm_netapp_volume: add verification for empty SnapshotPolicyId string azurerm_netapp_volume: add extra validation when data_protection_snapshot_policy.0. snapshot_policy_id is empty Sep 14, 2022
@mbfrahry mbfrahry added this to the v3.23.0 milestone Sep 14, 2022
@mbfrahry mbfrahry merged commit 39736e7 into hashicorp:main Sep 14, 2022
mbfrahry added a commit that referenced this pull request Sep 14, 2022
@github-actions
Copy link

This functionality has been released in v3.23.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ANF volume: data_protection_snapshot_policy state not handled correctly.
3 participants