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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for creating incremental azurerm_snapshot resources #21099

Closed
1 task done
SergioLuis opened this issue Mar 23, 2023 · 1 comment 路 Fixed by #21263
Closed
1 task done

Support for creating incremental azurerm_snapshot resources #21099

SergioLuis opened this issue Mar 23, 2023 · 1 comment 路 Fixed by #21263
Milestone

Comments

@SergioLuis
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I'm using a certain kind of managed disk (PremiumV2_LRS). These disks support only incremental snapshots. However, the resource azurerm_snapshot doesn't seem to be able to be created with said flag.

The azurerm_snapshot.create_option attribute only supports Import and Copy. I dived into the code of both azurerm and Terraform Azure SDK, and did not find anything resembling "incremental" regarding snapshots.

I can create the snapshot with no issues using the az command line tool:

$ az snapshot create \
  --name metadata-disk-snapshot \
  --resource-group storage-resources \
  --source "/subscriptions/0000(...)/disks/metadata-disk" \
  --incremental true

When using Terraform with create_option = "Copy" I get a meaningful error message regarding this limitation:

**Error: creating/updating Snapshot (Subscription: "(...)" Resource Group Name: "storage-resources" Snapshot Name: "metadata-disk-snapshot"): performing CreateOrUpdate: snapshots.SnapshotsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="OperationNotAllowed" Message="Only incremental snapshots are supported for disks of Sku PremiumV2\_LRS."**
with module.(...)\_metadata\_disk\_snapshot
on .terraform/modules/(...)/main.tf line 30, in resource "azurerm\_snapshot" "storage\_metadata\_disk\_snapshot":

And, of course, using create_option = "Import" does not work, because I'm using the disk ID as the source_uri:

**Error: creating/updating Snapshot (Subscription: "(...)" Resource Group Name: "storage-resources" Snapshot Name: "metadata-disk-snapshot"): performing CreateOrUpdate: snapshots.SnapshotsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="InvalidParameter" Message="Uri not of expected kind" Target="sourceUri"**
with module.(...)\_metadata\_disk\_snapshot
on .terraform/modules/(...)/main.tf line 30, in resource "azurerm\_snapshot" "storage\_metadata\_disk\_snapshot":

New or Affected Resource(s)/Data Source(s)

azurerm_snapshot

Potential Terraform Configuration

resource "azurerm_resource_group" "storage_resource_group" {
  name      = "storage-resources"
  location  = "West Europe"
}

resource "azurerm_managed_disk" "storage_metadata_disk" {
  name                 = "metadata-disk"
  location             = azurerm_resource_group.storage_resource_group.location
  resource_group_name  = azurerm_resource_group.storage_resource_group.name
  zone                 = 1
  storage_account_type = "PremiumV2_LRS"
  create_option        = "Empty"
  disk_size_gb         = 1024
  disk_iops_read_write = 300
  disk_mbps_read_write = 512
}

resource "azurerm_snapshot" "storage_metadata_disk_snapshot" {
  name                = "metadata-disk-snapshot"
  location            = azurerm_resource_group.storage_resource_group.location
  resource_group_name = azurerm_resource_group.storage_resource_group.name
  source_uri          = azurerm_managed_disk.storage_metadata_disk.id
  create_option       = "Incremental"
}

References

@github-actions
Copy link

This functionality has been released in v3.51.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 github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant