submitted by /u/sarcasticengineer369
I want to ask do I have to import the existing infrastructure to Terraform if I want to build the infrastructure with Terraform from now on.
To make it simple:
- I have an existing infrastructure in Google Cloud ( separated in 2 projects, prod and non prod)
- All this infra was created manually.
- Now, I want to introduce terraform so that I don't want to sit and do it manually the next time I'm setting up a resource
I have a few questions in regards to this:
- Can I start writing code from now and add the resources to the existing infrastructure right away?
- Do I have to import the existing infra and keep it in my repo and keep adding the code to the imported resources?
- Is there any easy way of importing the existing infrastructure without writing the code for all the existing resources, cause there are a lot?
- If I start writing code now and apply it to my non prod without importing the existing resources, will it delete the existing ones and apply only the resources I have terraform files for (the files I'm going to write?)
Any help is greatly appreciated!