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

resource "azurerm_site_recovery_replicated_vm" Error: Unsupported argument after provider update from 3.108.0 to 3.109.0 #26434

Closed
1 task done
enorlando opened this issue Jun 24, 2024 · 5 comments · Fixed by #26437

Comments

@enorlando
Copy link

enorlando commented Jun 24, 2024

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.8.5

AzureRM Provider Version

3.109.0

Affected Resource(s)/Data Source(s)

azurerm_site_recovery_replicated_vm

Terraform Configuration Files

resource "azurerm_site_recovery_replicated_vm" "xx" {
  name                                      = "xx"
  resource_group_name                       = azurerm_resource_group.xx.name
  recovery_vault_name                       = azurerm_recovery_services_vault.xx.name
  source_recovery_fabric_name               = azurerm_site_recovery_fabric.xx.name
  source_vm_id                              = module.xx.vm_id
  recovery_replication_policy_id            = azurerm_site_recovery_replication_policy.xx.id
  source_recovery_protection_container_name = azurerm_site_recovery_protection_container.xx.name
  target_resource_group_id                  = azurerm_resource_group.xx.id
  target_recovery_fabric_id                 = azurerm_site_recovery_fabric.xx.id
  target_recovery_protection_container_id   = azurerm_site_recovery_protection_container.xx.id

  managed_disk = [
    {
      disk_id                       = azurerm_managed_disk.xx.id
      staging_storage_account_id    = azurerm_storage_account.xx.id
      target_disk_encryption        = []
      target_disk_encryption_set_id = azurerm_disk_encryption_set.xx.id
      target_disk_type              = var.target-disk-type
      target_replica_disk_type      = var.target-replica-disk-type
      target_resource_group_id      = azurerm_resource_group.xx.id
    },
  ]
}

Debug Output/Panic Output

Expected Behaviour

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Actual Behaviour

│ Error: Unsupported argument
│ 
│   on xx.tf line 838, in resource "azurerm_site_recovery_replicated_vm" "xx":
│  838:   managed_disk = [
│ 
│ An argument named "managed_disk" is not expected here. Did you mean to define a block of type "managed_disk"?

Steps to Reproduce

  1. Pin provider from version 3.108.0 to 3.109.0
  2. Run terraform plan

Important Factoids

Once we revert the provider version back to 3.108.0, we no longer receive the error.

References

https://github.com/ScentreGroup/infrastructure/pull/4084#issuecomment-2185348916

@stephybun
Copy link
Member

stephybun commented Jun 24, 2024

Thanks for raising this issue @enorlando!

The property is still there, but would need to be specified as a block now instead of as an attribute, so

  managed_disk {
      disk_id                       = azurerm_managed_disk.xx.id
      staging_storage_account_id    = azurerm_storage_account.xx.id
      target_disk_encryption        = []
      target_disk_encryption_set_id = azurerm_disk_encryption_set.xx.id
      target_disk_type              = var.target-disk-type
      target_replica_disk_type      = var.target-replica-disk-type
      target_resource_group_id      = azurerm_resource_group.xx.id
}

as opposed to

  managed_disk = [
    {
      disk_id                       = azurerm_managed_disk.xx.id
      staging_storage_account_id    = azurerm_storage_account.xx.id
      target_disk_encryption        = []
      target_disk_encryption_set_id = azurerm_disk_encryption_set.xx.id
      target_disk_type              = var.target-disk-type
      target_replica_disk_type      = var.target-replica-disk-type
      target_resource_group_id      = azurerm_resource_group.xx.id
    },
  ]

Nevertheless this is a breaking change to the configuration and should have been put behind the 4.0 flag, apologies for that! I've just opened a PR to fix this. If you pin your provider version to v3.108.0 for the time being, you should be able to upgrade to v3.110.0 later in the week without requiring any configuration changes to this resource.

@github-actions github-actions bot added this to the v3.110.0 milestone Jun 24, 2024
@beararmy
Copy link

Worth noting this affects the sub blocks too. target_disk_encryption for example I had in squaresies and had to remove them to work with 3.109.0 too.

@stephybun
Copy link
Member

Indeed @beararmy, the changes to the sub-blocks such as target_disk_encryption have also been put behind our 4.0 feature flag in #26437. I would suggest reverting your configuration back to using the attribute assignment something = [{ }] and pinning your provider version to 3.108.0 until 3.110.0 is available.

@beararmy
Copy link

Perfect thanks @stephybun - I was mostly making this searchable for others ❤️

@enorlando
Copy link
Author

Thanks @stephybun for the info. Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants