Authors: Elumalai Ganesan and Elina Floim
As a result of recent changes implemented in Terraform version 1.38 and above, there have been modifications to the behavior of the "apply" and "destroy" commands. Prior to version 1.38, when applying and then destroying without any existing resources, a new state would be created. However, in the new version, this behavior has been altered such that no new state is generated under such circumstances.
Consequently, when executing the "terraform apply" and subsequently the "terraform destroy" commands, the previous behavior would result in the creation of three files in the repository: "state.latest.json," "state.{timestamp}.json," and "workspace.json." Conversely, in the updated version, only two files are generated: "state.latest.json" and "workspace.json."
Therefore, attempting these commands using the new Terraform client will trigger the following error message:
2023-04-04T13:49:38.361Z [1;32m[jfrt ][0;39m [1;31m[ERROR][0;39m [2ddf644bc22f3bc ] [aformLocalStateRepoHandler:277] [p-nio-8081-exec-2432] - Failed to create new state version at terraform-backend/workspaces/test/state.latest.json: Could not find item at terraform-backend:workspaces/test/state.latest.json