How to extend access policy

Let’s assume this simple example of creating shared file storage on Azure using Terraform and azurerm provider.

resource "azurerm_resource_group" "example" {
  name     = "azuretest"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "azureteststorage"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_storage_share" "example" {
  name                 = "sharename"
  storage_account_name = azurerm_storage_account.example.name
  quota                = 50

  acl {
    id = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"

    access_policy {
      permissions = "rwdl"
      start       = "2020-08-02T09:38:21.0000000Z"
      expiry      = "2021-08-02T10:38:21.0000000Z"
    }
  }
}

The access policy states that it will expire on August 2 2021. How to extend that using terraform? Is it even possible?

Did you consider defining variables and use them like:

access_policy {
  permissions = "rwdl"
  start       = var.access_policy_start
  expiry      = var.access_policy_end
}

You can then change value of these variable and apply it.