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

migration to 2.x fails for azapi_resource_action if body is an empty string in state #801

Open
4c74356b41 opened this issue Mar 4, 2025 · 0 comments

Comments

@4c74356b41
Copy link

4c74356b41 commented Mar 4, 2025

│ Error: failed to migrate body to dynamic value
│ 
│   with module.foundation.azapi_resource_action.ssh_key_gen["xyz"],
│   on ../../../../modules/foundation/virtual_machine.tf line 53, in resource "azapi_resource_action" "ssh_key_gen":
│   53: resource "azapi_resource_action" "ssh_key_gen" {
│ 
│ failed to unmarshal : unexpected end of JSON input

resource config pre-migration:

resource "azapi_resource_action" "ssh_key_gen" {
  for_each    = local.vms
  type        = "Microsoft.Compute/sshPublicKeys@2022-11-01"
  resource_id = azapi_resource.ssh_key[each.key].id
  action      = "generateKeyPair"
  method      = "POST"
  body        = "{}"

  response_export_values = ["publicKey", "privateKey"]
  lifecycle {
    ignore_changes = [
      body
    ]
  }
}

body in state:

"body": {
 "value": "",
 "type": "string"
},

any workaround?

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

No branches or pull requests

1 participant