0.9.4
Multiple
Either the properties should accept only a single case, or else the behavior should be idempotent no matter which casing the template uses.
Example: azurerm_virtual_machine_scale_set.agentpool.sku.tier accepts either "standard" or "Standard", and it shouldn't matter which is actually used.
Example: azurerm_virtual_machine_scale_set.agentpool.sku.tier accepts either "standard" or "Standard", but if "standard" is used, the next tf plan will think a change occurred when none has.
See #11626 for an example.
We need to go through all the enum-style string properties and verify casing is handled correctly.
@abhijeetgaiha is planning on working on this.
Which is the more appropriate approach, restricting the input or making the behavior idempotent?
@StephenWeatherford @abhijeetgaiha thanks for raising this!
The convention is to make this case-insensitive - the Resource Schema exposes a DiffSuppressFunc property which allows us to handle this by assigning a Diff function. Here's an example of how we're using an ignoreCaseDiffSuppressFunc to do this in the Load Balancer Rule resource :)
Hope that helps :)
@tombuildsstuff Thanks! Is there a reason to also use a state func (ignoreCaseStateFunc), or does that not matter, as long as we have the ignore-case-diff function?
@StephenWeatherford it's optional - so I believe you should be able to get away without it :)
(it's used should you wish to modify the data stored in the *.tfstate file, for example base64 encoding a large string to compress space in the state etc)
@tombuildsstuff Can we have DiffSuppressFunc on individual fields on map and set types? It doesn't seem to be the case.
@abhijeetgaiha I believe so, however a Set has a Hash associated with it, which will need to be updated to take that into account, potentially through a state migration. Here's an example in a list, set and whilst I can't find an example with a Map within the AzureRM Provider, it should work AFAIK.
Have you got a example of where you're seeing issues?
@tombuildsstuff While trying out a fix for #11626, I added the function for the sku tier, but it had no effect on the diff. The hash value might be the cause of that, as you suggest.
@tombuildsstuff I think the hash was the issue. After making some changes there, the diff is working correctly. Thanks! 👍
Closed via #14861
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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.