Open krzysztofmaciejewskiit opened 1 month ago
I believe this is a bug on NX-OS where the configuration does not get applied correctly with the first attempt (NX-OS REST API call). I have seen similar instances with other interface level configurations. I assume a subsequent "terraform apply" fixes the config, which would confirm that TF is doing the "right" thing. You can try adding the -parallelism=1
CLI argument and see if that improves the situation, which would suggest that NX-OS might have an issue with concurrent API calls.
Having a "clean" terraform directory (main.tf, terraform.tfvars, variables.tf) executes the command "terraform init; terraform apply -auto-approve", everything passes fine, adds the first part of the code marked "part-1", all the commands along with "no shutdown" are added. When I add the code "part-2", coemend "terraform apply -auto-approve" usually all commands except "no shutdown" are added, relatively rarely all will be added, so it happens quite randomly. When I let go of the same terraform again without changes it will add the command "no shutdown" correctly. Below I paste the code of "part-1" and "part-2" and the output from terraform.
Terraform code: main.tf
Output form Nexus9000:
So as you can see on the second interface no shutdown was added. It can happen randomly, it is not a rule. I have a theory that this happens because after the “no switchport” command is executed, the interface flaps and, in my opinion, Terraform can't keep up with the “no shutdown” command afterwards.
The strangest thing is that the above result shows “+ admin_state = ‘up’”
Link to Cisco Community discussion: https://community.cisco.com/t5/devnet-general-discussions/terraform-problem-with-adding-quot-no-shutdown-quot-to/td-p/5157845