2i2c-org / infrastructure

Infrastructure for configuring and deploying our community JupyterHubs.
https://infrastructure.2i2c.org
BSD 3-Clause "New" or "Revised" License
105 stars 64 forks source link

Document terraform help from Yuvi someplace suitable #2401

Open consideRatio opened 1 year ago

consideRatio commented 1 year ago

Erik wrote:

(base) ➜  gcp git:(master) terraform init          

Initializing the backend...
╷
│ Error: Backend configuration changed
│ 
│ A change in the backend configuration has been detected, which may require migrating existing state.
│ 
│ If you wish to attempt automatic migration of the state, use "terraform init -migrate-state".
│ If you wish to store the current configuration with no changes to the state, use "terraform init -reconfigure".
╵

Should I do terraform init -migrate-state here? I'm not sure what this is about.

Yuvi wrote:

ah, look for hidden files in your current directory you most likely do not want -migrate-state this usually means terraform is not looking for state files where it should - which is on GCS remotely, but locally.

Erik wrote: Ah I moved away my found .terraform folder, and did (from terraform/gcp): terraform init -backend-config=backends/default-backend.hcl


This resolved the situation, but I don't understand the details here. What caused this? Had I made changes to terraform state that wasn't captured by the remote state or similar?

yuvipanda commented 1 year ago

Had I made changes to terraform state that wasn't captured by the remote state or similar?

Most likely not, as terraform prints out this error precisely to prevent that from happening.

yuvipanda commented 1 year ago

I just ran into this again because I upgraded my terraform version.

yuvipanda commented 1 year ago

I just ran into this again because I upgraded my terraform version.