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

Storage Account Lifecycle Policies - Versions #970

Open
mike-wade opened this issue Sep 5, 2022 · 4 comments
Open

Storage Account Lifecycle Policies - Versions #970

mike-wade opened this issue Sep 5, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@mike-wade
Copy link
Contributor

Hi team,

I would like to add a lifecycle policy to my storage account to delete old versions of my blobs. Is this possible with the current implementation? If so, I haven't worked it out yet.

The following

storageAccount {
    name "storageAccountName"
    enable_versioning [ StorageService.Blobs, true]
    add_lifecycle_rule "delete-old-versions" [Storage.DeleteAfter 30<Days>] Storage.NoRuleFilters
    sku Sku.Standard_GRS
}

Generates this rule:

"policy": {
    "rules": [
      {
        "definition": {
          "actions": {
            "baseBlob": {
              "delete": {
                "daysAfterModificationGreaterThan": 30
              }
            }
          },
          "filters": {
            "blobTypes": [
              "blockBlob"
            ],
            "prefixMatch": []
          }
        },
        "enabled": true,
        "name": "delete-old-versions",
        "type": "Lifecycle"
      }
    ]
  }

As per the Lifecycle Management Overview actions.baseBlob needs to be actions.version but I haven't spotted how this can be specified with the current API.

Thanks in advance

@isaacabraham isaacabraham added the triage Requires investigation label Sep 10, 2022
@isaacabraham
Copy link
Member

Hi @mike-wade . This looks like a bug then in how Farmer is rendering the ARM out. Probably the code here needs to be adjusted.

@isaacabraham isaacabraham added bug Something isn't working and removed triage Requires investigation labels Jan 2, 2023
@isaacabraham
Copy link
Member

isaacabraham commented Jan 2, 2023

In fact it's not a bug, it's just that we don't support that feature of lifecycle policies as far as I recall. These look like the main ones we support at the moment. Probably this code needs enhancing and then following the breadcrumbs all the way down to the ARM generation. Doesn't seem like it would be too bad though.

@isaacabraham isaacabraham added enhancement New feature or request and removed bug Something isn't working enhancement New feature or request labels Jan 2, 2023
@isaacabraham
Copy link
Member

@mike-wade I've created a branch, update-blob-lifecycle-management for this. I now remember when I implemented this it was a simple version that intentionally didn't do everything - the hope being that someone would feedback as and when they wanted extra capabilities in it (as you did). Feel free to have a look at the branch, in particular the Adds lifecycle policies correctly test, which shows you how the API will look like to consume. Feedback welcome.

@martinbryant
Copy link
Contributor

@isaacabraham - are we going to go ahead with this enhancement? - will be happy to pick it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants