0
votes

I manage Google Cloud Platform all infrastructure with Terraform. At first I forgot while working and init over Macos. Plugins were installed according to “darwin_amd64”.

But I must to convert it to “linux_amd64”.

I put all my “.tf” files on a linux for testing purposes. I deleted the “.terraform.tfstate” and “.terraform” files. I did “terraform init” again.

Whenever I run the “terraform plan” command it automatically tries to rebuild the entire infrastructure. But then he says that there is such a source and he gives an error. The same happens when I try copying my old “terraform.tfstate” file.

I need to convert these terraform files to work on linux. I don’t want to delete the all infrastructure and re-init on a linux server. Is there a way to do this ?

1
You can run Terraform on any of the supported platforms interoperably. Your problem is you were storing state locally and then you deleted the state file (.terraform.tfstate). Now you either need to manually delete and rebuild everything or import everything back in to your state file. And stop using local state for anything you care about.ydaetskcoR

1 Answers

0
votes

You don't need to delete the entire .terraform folder or the state file terraform.tfstate, just delete the .terraform/plugins folder and run terraform init again to download the proper binaries for your platform.