Closed ajsiersema closed 5 years ago
A little elaboration on the issue and its fix.
The root cause of the error reported was that the provider tried to modify an non modifiable attribute, in this case the attribute "name" of the the "resource_server".
That happened as part of the plan to execute the removal of the middle backend server from the input variables list.
After this failed operation the local state and the state of the target Citrix ADC were mismatched and the second error message was the result.
The fix was to mark this attribute with ForceNew
. Now the execution plan will first delete the backend server and then recreate it with the new name.
Also make sure to run terraform apply -parallelism=1
.
I noticed that this is required to have correct operation since when re adding the missing back end server resulted in a race condition where the server was created but the servicegroup failed to add it since the nitro API regarded it as not created yet.
The dependency of the netscaler_servicegroup
resource on the netscaler_server
resource was not enough to resolve this race condition.
Works like a charm now. Thanks for the explanation and fix, I've tested with provider v0.11.11 and terraform v0.11.13.
Glad I could help.
Steps to reproduce :
resources.tf
variables.tf
local.tfvars (first run: create everything)
Create the lbvserver and it's backends :
Now change the backends list in local.tfvars to:
and run terraform again:
EXPECTED RESULT: 10.42.42.2 removed ACTUAL RESULT:
first try:
idempotent right, so let's try again: