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.
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’”
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