How can I add another module to my existing Terraform deployment plan?

HOW TO -️ October 18, 2021

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.


Could you please provide more detail, what is your existing code state or how the code ( TF modules are ) is structured currently? Why is adding a new module any different than adding a resource to an existing module? In my view, there is no difference. @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? 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? You might want to include these modules in a top level module as using -target=module is not recommended as stated in the docs