<p>Terraform is idempotent so will only change what needs to be changed.</p>
<p>So after applying your existing plan, if you add more modules or resources and run another plan and apply, it will add the new resources not the whole infrastructure.</p>
<p>Terraform import is used when you want to start managing a resource created outside your Terraform code for example created in the AWS console, AWS CLI).</p>
<p>It basically associates and existing resource with your new Terraform code, so that Terraform doesn't try to recreate it when you run the plan/ apply.</p>

CC BY-SA 4.0
2021-07-13T10:03:37.370Z
this should be accepted
krystan honour
CC BY-SA 4.0
2021-05-13T10:02:00.467Z
2021-05-13T10:02:00.467Z
Alastair Montgomery
<p>I have deployed a project within Terraform. I need to add a 4th application module to my existing plan. How do I update my plan to include this 4th module and deploy the missing module without starting over? I thought terraform import might be an option, but I'm not understanding how it would be done.</p>

CC BY-SA 4.0
2021-01-22T04:12:00.643Z
Could you please provide more detail, what is your existing code state or how the code ( TF modules are ) is structured currently?
Kamlendra Sharma
CC BY-SA 4.0
2021-01-22T06:44:11.667Z
Why is adding a new module any different than adding a resource to an existing module?  In my view, there is no difference.
CryptoFool
CC BY-SA 4.0
2021-01-24T21:01:15.413Z
@KamlendraSharma I have about 8 different applications (modules) I check out from Gitlab and I'm deploying different sets of them and I want to know how do I add to my existing plan if I do a terraform plan -target=module.nifi -target=module.kafka --out test1 - After it's deployed, how do I add another module to my plan and deploy just the new module?
DemiSheep
CC BY-SA 4.0
2021-02-03T11:24:13.833Z
Terraform should handle this by default as it keeps track of deployments in a state file which is stored locally or in a configured backend so all you should need to do is run `terraform plan -target=module.nifi -target=module.kafka -target=module.other --out test1` and it should calculate the changes required based on the current state. Have you tried this? If so were there any specific errors?
Aquila Sands
CC BY-SA 4.0
2021-02-03T11:43:49.800Z
You might want to include these modules in a top level module as using `-target=module` is not recommended as stated in the docs https://www.terraform.io/docs/cli/commands/plan.html#resource-targeting
Aquila Sands
<terraform><terraform-module>
How can I add another module to my existing Terraform deployment plan?
DemiSheep
# How can I add another module to my existing Terraform deployment plan?

(Asked by: username_0 on 2021-01-21)

I have deployed a project within Terraform. I need to add a 4th application module to my existing plan. How do I update my plan to include this 4th module and deploy the missing module without starting over? I thought terraform import might be an option, but I'm not understanding how it would be done.

**Tags:** terraform, terraform-module

> **Comments:**
> **username_1**: Could you please provide more detail, what is your existing code state or how the code ( TF modules are ) is structured currently?  
> **username_2**: Why is adding a new module any different than adding a resource to an existing module?  In my view, there is no difference.  
> **username_0**: @KamlendraSharma I have about 8 different applications (modules) I check out from Gitlab and I'm deploying different sets of them and I want to know how do I add to my existing plan if I do a terraform plan -target=module.nifi -target=module.kafka --out test1 - After it's deployed, how do I add another module to my plan and deploy just the new module?  
> **username_3**: Terraform should handle this by default as it keeps track of deployments in a state file which is stored locally or in a configured backend so all you should need to do is run `terraform plan -target=module.nifi -target=module.kafka -target=module.other --out test1` and it should calculate the changes required based on the current state. Have you tried this? If so were there any specific errors?  
> **username_3**: You might want to include these modules in a top level module as using `-target=module` is not recommended as stated in the docs https://www.terraform.io/docs/cli/commands/plan.html#resource-targeting  

---

## 1 answers

### Answer by username_4 on 2021-05-13. Score: 2

Terraform is idempotent so will only change what needs to be changed.

So after applying your existing plan, if you add more modules or resources and run another plan and apply, it will add the new resources not the whole infrastructure.

Terraform import is used when you want to start managing a resource created outside your Terraform code for example created in the AWS console, AWS CLI).

It basically associates and existing resource with your new Terraform code, so that Terraform doesn't try to recreate it when you run the plan/ apply.

> **Comments:**
> **username_5**: this should be accepted  

---

