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

Azure NetApp Files SDK | Properties that requires for disassociation operations with null or empty string being ignored #4328

Open
paulomarquesc opened this issue Jul 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@paulomarquesc
Copy link
Contributor

ANF just hit a blocker with the Pandora's SDK version, we have a process that allows us to disassociate backup policies and backup vaults from a volume, and I need to have that process working properly in order to guarantee that the Terraform deletion of the volumes and their backups will work, or that if customer decides to stop those backups, they will be able to do it through HCL.

The way to do that is passing nil or empty string as the value of the property, the issue that I'm hitting is that Terraform is ignoring the properties with those values and when I hovered over the model object (from SDK) I noticed a property called omitEmpty , how can I overcome this issue and pass the actual value?

This is what I see while hoving over the property:

image

This is the object definition where I need backupPolicyId and BackupVaultId passed down to ARM as nil or empty string:

					disableBackupPolicy := volumes.VolumePatch{
						Properties: &volumes.VolumePatchProperties{
							DataProtection: &volumes.VolumePatchPropertiesDataProtection{
								Backup: &volumes.VolumeBackupProperties{
									PolicyEnforced: utils.Bool(false),
									BackupPolicyId: nil,
									BackupVaultId:  nil,
								},
							},
						},
					}

This is the request details that goes to ARM and our Resource Provider, we can see that the request came without those properties:

Patching resource request. updatedResource = {
  "location": "westus2",
  "properties": {
    "dataProtection": {
      "backup": {
        "policyEnforced": false
      }
    }
  },
  "systemData": {
    "createdBy": "*****",
    "createdByType": "*****",
    "createdAt": "*****",
    "lastModifiedBy": "*****",
    "lastModifiedByType": "*****",
    "lastModifiedAt": "*****"
  }
}

Here is the swager definition for that object (API version 2023-11-01):

    "volumeBackupProperties": {
      "description": "Volume Backup Properties",
      "type": "object",
      "properties": {
        "backupPolicyId": {
          "type": "string",
          "description": "Backup Policy Resource ID"
        },
        "policyEnforced": {
          "type": "boolean",
          "description": "Policy Enforced"
        },
        "backupVaultId": {
          "type": "string",
          "description": "Backup Vault Resource ID"
        }
      }
    }
@manicminer manicminer added the bug Something isn't working label Jul 26, 2024
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
None yet
Development

No branches or pull requests

2 participants