Team, I am new to terraform, and my requirement will be needed to create a resource group along with virtual machine. I made everything correctly, but not sure why my terraform is referring another state file which is not at all there in my subscription.[![enter image description here.
- Show hidden folders
ls -A
- Got ". terraform" folder
cd .terraform
- Open and update the state file named "terraform.tfstate". Hope this resolve your issue.
CodePudding user response:
Looking at your image seems that you are using the sample code from the documentation to persist tf state on azurerm backend. Try changing the “key” value introducing something that recalls to your “project” and change it on other projects. In this way the state will be unique for projects
In my case i use this format .environment.tfstate Where environment can be dev, test, prod…
Alternatively you can use different container for projects and remove it from the key