0
  1. Suppose I crated an environment using Terraform script, and then I'd like to add another resource of the same type I already have. For example, I have 2 instances of my app VM and I'd like to add another one. What would be the way to do so?

  2. Suppose I need to work on an environment which was not created using Terraform, or that was created by Terraform but was manually modified. How can I recreate or update the state of Terraform?

1
  1. Either copy the existing resource and duplicate it with a different name/id, or set the count parameter on the existing resource to 2.
  2. Terraform allows you import existing resources, but it won't create the resource code in your manifests for you, you need to write that yourself. In the case of the actual state diverging from the Terraform manifests you need to either update the code to match or let Terraform apply the necessary changes to make reality match the code again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.