cycloidio/terracognita

Be able to merge states

xescugc opened this issue · 5 comments

Abstract

From a provided .tfstate, we should be able to merge the generated state in order to create a new updated state (result of the combination)

Proposal

Using this feature, the user will be able to update a "partial" working .tfstate with a legacy infra not declared as-code.

Implementation

Open issues (if applicable)

highb commented

@tormath1 Any idea on the timeline for implementing this feature? I'm trying to absorb a lot of manually created infrastructure from our AWS accounts into our TFState using Terracognita and attempting to merge the TFState files is a huge painful error prone process. Ideally, the tool should look at the existing state, determine if a resource is already in it, and skip generating HCL/state for it is, and then add in only newly discovered resources as HCL/state. Ideally, this would work with Terraform Cloud's Remote state backend.

Additionally, I would like to run Terracognita as part of an automated process to detect manually added infrastructure and codify it before it sprawls out of control.

@highb hi ! Thanks for your interest with Terracognita - I'm a bit less active on this project especially for timeline features in the roadmap. I'll let @xescugc bring a more accurate answer to you.

Additionally, I would like to run Terracognita as part of an automated process to detect manually added infrastructure and codify it before it sprawls out of control.

This can be already done independently from the merging feature - one could imagine Terracognita running on a regular basis
against your accounts and comparing terraform plan using the files generated by Terracognita and the files actually used to deploy your resources.

Hi @highb :).

This is a feature we want to add, it's not yet on top of the priority list but it was always one of the things we wanted to add since the beggining on Terracognita.

I cannot give you an ETA for this though :(

But if you want you could add it if wanted :) I could take a bit of time (if you want to do it) to maybe guide you though it if needed. I don't think it would be really hard though.

highb commented

@tormath1 @xescugc Thank you for responding! I don't have sufficient free time to tackle this right now but I'm happy to hear your offer to help out with implementation tips and tricks. For now, I'll just be watching this thread closely.

Ok don't worry, I may try to hack it in a close, close future hehe.