0

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.

5
  • Could you please provide more detail, what is your existing code state or how the code ( TF modules are ) is structured currently? – Kamlendra Sharma Jan 22 at 4:12
  • Why is adding a new module any different than adding a resource to an existing module? In my view, there is no difference. – CryptoFool Jan 22 at 6:44
  • 1
    @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 Jan 24 at 21:01
  • 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 Feb 3 at 11:24
  • You might want to include these modules in a top level module as using -target=module is not recommended as stated in the docs terraform.io/docs/cli/commands/plan.html#resource-targeting – Aquila Sands Feb 3 at 11:43

Your Answer

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

Browse other questions tagged or ask your own question.