Skip to content

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

@paulomarquesc

Description

@paulomarquesc

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"
        }
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions