Open JD-Phx opened 1 year ago
Hi @JD-Phx , thanks for opening this issue.
Could you please update your Terraform and azurerm provider, then give it another try with the environment variable TF_LOG=DEBUG
? if it failed with the same error again, please provide the log. (The log could be redirected to a file by TF_LOG_PATH
variable. Here is the document about log)
Thanks.
I've updated the Terraform Version, and Provider version to the latest, and there is no change on the output.
This is running in a live environment, so I will have to sanitise the debug file before uploading it. There's also a lot of resources within the environment, so I'll try and reduce the unnecessary resources. I may have to setup a dev environment with just the minimum resources to redeploy this resource and replicate the issue.
Hey @JD-Phx
I tried to reproduce the error, but I cant. Could you please some more details about how it happened? Here is my assumption, please correct me.
terraform import azurerm_site_recovery_replicated_vm.vm-replication ......
terraform plan
<- where it errored out.And, just to confirm: the log shows it was errored on example1
but the config was vm-replication
, was it caused by manually editing?
Hi @ziyeqf
I appreciate you trying to replicate the issue for me. I'll see if I can't put something together today to replicate it, as the clients main subscription is throwing a lot of these errors. That's pretty close:
It wouldn't be so bad if the plan ran, and just told me what config it's going to change, and by the documentation, those are not required properties, so I should be able to run the plan without them. I could then extract the values and add them in. It seems like the provider has these flagged as required, and I'm not sure they should be. If this resource were deploy with MS Platform Managed Keys, you wouldn't know these values, and there's nothing within the resource block to specify its CMK or PMK.
I've also tried adding the disks in via a data block, and calling the values that way as they are unknown to me, and cannot be accessed via the portal. Unfortunately, when the plan runs, it suggests that the values are blank/empty/null, which I suspect is a permissions issue, as the resource is actually MS managed.
Yes, apologies, that's my poor manual editing skills. The config is taken from the documentation page, but matches what is being imported, and the output is from the live environment, and I didnt match the name up properly. I've rectified that for future viewers.
Hey @JD-Phx
I have reproduced it successfully by using aztfexport
. Please modify the managed_disk
block from
managed_disk = [{
disk_id=...
.....
}]
to
managed_disk {
disk_id=...
}
Then it should work.
For any further questions please leave comments. Thanks!
Hi @ziyeqf
I tried updating the code with the [ ] removed, but I now get a different error:
│ Error: Incorrect attribute value type
│ 5048: managed_disk = {
| ## middle section removed due to sensitive data ##
│ 5054: }
│
│ Inappropriate value for attribute "managed_disk": set of object required.
There appears to be a underscore squiggle (like you get with a spelling mistake) before the opening { in my vs code terminal, that hasn't copied across.
IGNORE THIS: I didn't remove the = sign!
Thank you @ziyeqf!! That's amazing work, I'd have never worked that out! It's odd how terraform returned an error that makes sense, but it was actually the format of the managed disk block that was incorrect! I'll definitely keep an eye out for that one.
Is there an existing issue for this?
Community Note
Terraform Version
1.5.5
AzureRM Provider Version
3.65
Affected Resource(s)/Data Source(s)
azurerm_site_recovery_replicated_vm
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The provider documentation shows that these elements should be optional: https://registry.terraform.io/providers/hashicorp/azurerm/3.65.0/docs/resources/site_recovery_replicated_vm#target_disk_encryption_set_id
So on a plan run, this should not error.
Actual Behaviour
This is an import that I'm attempting, I'm unsure if this due to the disks being encrypted with platform managed keys (that the details cannot be accessed for) is causing these to be flagged as required, but this is a plan, so these shouldn't be required, but rather show as a change on at the end.
Steps to Reproduce
No response
Important Factoids
No response
References
No response