I am learning Terraform, so just added the provider config, ad config and the resource group config in my main.tf file. While trying to run the plan command "terraform plan -out main.tfplan", I am getting
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
even on running the terraform init command there is no lock file or the terraform folder is getting created in my package structure.
I was expecting the lock file and a terraform folder getting created on running the init command and the changes that I have made(added a Resource group) should be reflected on running the plan command
2
Answers
Need to check below:
Firstly, check you are executing the terraform file in the directory where it has been created.
If you are viewing "No changes. Your infrastructure matches the configuration" means it indicates the terraform has verified your infrastructure with the configured provider and it already aligns with the resources specified in your
filename.tf
file.Also, if you are executing in Azure CLI, make sure that you saved all the changes using
:wq
command as shown below.And it doesn’t not necessarily needed to have a terraform Lock file for each and every terraform project. It is completely related to remote backends.
Make sure that the terraform state file has created successfully with the given configuration.
I tried to deploy a resource group and was able to perform all the operations successfully.
Output:
If still the issue persists, enable debugging which is detailed here in the doc.
A ‘ no changes ‘ by Terraform seems to me is due to few scenarios :