Difference in TF state files

Hi,

We have created 2VMs in GCP. Now to test the terraform import functionality, we have moved the tf-state file to a different folder. Now by using “terraform import” command, we are able to successfully import the tf-sate file for the 2VMs that were created. But, I noticed certain resource attributes are missing in the imported state file for which while executing the terraform plan command its trying to create few resources.

Can some one help me to understand the reason for the difference in two state files?

Regards,
Apratim

The import process is not guaranteed to be able to produce the same state as the original. Some APIs may not have access to all the original configuration information and only can return a subset. Some providers may need to normalize data based on the configuration, and without the original state that normalization can appear differently.

If both states produce zero changes given the same configuration, then the provider has confirmed for you that the states are semantically equivalent.