-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_log_analytics_workspace: on change of "sku", terraform incorrectly wants to rebuild workspace #12177
Comments
reservation_capcity_in_gb_per_day is missing an "a" in compare to the documentation https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/log_analytics_workspace#sku |
+1 to this - we just ran into this and it created all sorts of chaos. I believe that it is possible to upgrade the commitment tier to a higher level at any time without deleting/recreating the workspace, so the azurerm provider should do this. The commitment / SKU can only be downgraded during a certain time window. I think the azurerm provider should probably try to perform the downgrade and then emit a warning (or fail?) if it could not do so. Deleting and recreating the workspace is something you almost never want to do, especially in production. |
Just ran into this as well, will have to update it manually and then update the code it seems. The AZ CLI documentation doesn't show an explicit SKU change argument, but there is --set argument that can be used to set properties from For example:
Or
There is also the powershell cmdlet that could be used. |
In case anyone else runs into this, if you are trying to change from a reserve tier to pay-as-you-go, and manually make a SKU change and then try to change your TF code to match -- for example from "CapacityReservation" to "pergb2018", the plan will actually say successful but the apply will still fail because it still has the 'reservation_capacity_in_gb_per_day' attribute as unchanged, even though 'reservation_capacity_in_gb_per_day' was removed from the code. We had to state rm and import the workspace, then run TF plan and apply again in order to fix this issue. |
What if for now simply update the SKU in portal and then TF should detect changes in code and import the change into code |
@kudu-star See the comment above, that's what I did and we still ran into issues doing it that way without fixing tf state.
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.13.7
Affected Resource(s)
Terraform Configuration Files
Expected Behaviour
When changing the sku from "PerGB2018" to "CapacityReservation", the workspace should just have been updated, not destroyed. This change is easily doable in the portal or REST API without the workspace getting re-created.
Actual Behaviour
Terraform wants to delete the workspace due to the sku change:
Steps to Reproduce
terraform apply
References
The text was updated successfully, but these errors were encountered: