Open matthewi opened 4 years ago
@tombuildsstuff Some further investigation shows that while OFF
is a valid value and the default, transitioning to OFF
from an enabled state is not allowed. The docs suggest resetting this is handled implicitly by manipulating the servers in replication: https://docs.microsoft.com/en-us/azure/postgresql/howto-read-replicas-portal
This also means that you can't use terraform to destroy a server that has had replication enabled. You have to use azure directly and then reconcile your state.
Hi @matthewi , thanks for opening this issue. Upstream microsoft service team ticket has opened: https://github.com/Azure/azure-rest-api-specs/issues/10037, please track it.
In light of the response from Microsoft, I think this is the behavior we need to implement:
Thoughts?
@matthewi could you please advice ETA for the proposed fix?
@matthewi I am also interested in the way of fixing.
Ideally Azure would return the appropriate values for the database type, but the upstream ticket has stalled out. Is it feasible to put a workaround on the Terraform side? This issue makes a huge mess and requires manual state edits to clean up.
Or progress on the 2015 feature request for a "skip on destroy" in core Terraform would be amazing for these situations. https://github.com/hashicorp/terraform/issues/3874#issuecomment-161715361 https://github.com/hashicorp/terraform/issues/23547
This isn't directly related to work right now so I'm not sure when I would get around to making a fix. Its basically a dead end IMO with MS (works as intended). Unless something has changed since I filed the original issue, I think what I outlined is probably what will be necessary. Unfortunately this deviates from how the rest of the items in the provider are handled. I was hoping for some input the maintainers/community on if this sort of special case would be acceptable.
On Thu, Feb 4, 2021 at 1:17 PM Jason Greathouse notifications@github.com wrote:
Ideally Azure would return the appropriate values for the database type, but the upstream ticket has stalled out. Is it feasible to put a workaround on the Terraform side? This issue makes a huge mess and requires manual state edits to clean up.
Or progress on the 2015 feature request for a "skip on destroy" in core Terraform would be amazing for these situations. hashicorp/terraform#3874 (comment) https://github.com/hashicorp/terraform/issues/3874#issuecomment-161715361 hashicorp/terraform#23547 https://github.com/hashicorp/terraform/issues/23547
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/terraform-providers/terraform-provider-azurerm/issues/7567#issuecomment-773544241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTSKVVJQ6RIRGQKAGOMLDS5LXFHANCNFSM4OO66PIQ .
@matthewi as you've mentioned unfortunately this really needs to be fixed by Microsoft - I've just posted a comment looking for an update: https://github.com/Azure/azure-rest-api-specs/issues/10037#issuecomment-773911110
From Terraform's perspective whilst we could essentially do nothing when destroying this value, it seems logical that disabling read replicas in the remote api would disable read replicas - so I think it's worth waiting for Microsoft to respond here before determining how to proceed, apologies for the delay here.
Thanks!
Anybody has a workaround for this problem please?
@Tomasz-Kluczkowski the workaround is to have your TF code deleting the resources... when you get the error about OFF go to Azure portal and delete the DB manually. Then run your TF code again and it deletes the few leftovers.
Here's the plan from the destroy:
Which generates this error:
Versions:
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_XXXXX
Terraform Configuration Files
Relevant resources:
Debug Output
From the trace:
Panic Output
Expected Behavior
Terraform removed/reset the configuration value.
Actual Behavior
Produced a error.
Steps to Reproduce
terraform apply
Important Factoids
References
0000