However, problem starts when I try to deploy the contacts in different project.
It destroys the contacts from the project where it was created earlier and then creates it fresh in new project. This is weird behaviors compares all other modules I deploy using terraform.
Generally all the resources are at the project level. I don’t understand why essential contacts are now working as expected.
Hello @bansodab ,Welcome on Google Cloud Community.
Did you’ve tried to use tf workspaces ? It will create separate tfstate file for each workspace. Maybe, if you will create separate workspace, deploy code for ProjectA, then you will switch workspace to project2 and deploy code for Project2, TF will not destroy resources from first project? Ofc, projectIDs must be different
We have tfstate file for each project stored in respective GCS buckets. I’ve also verified the state files. Nothing conflicts there. I’ve 50+ projects which I deploy using my TF environment to deploy many other services like BigQuery, GCS Buckets, DataProc. Never seen such issue before because every deployment is always project specific. We select the project for which deployment needs to run. And of course, project IDs are unique