01-06-2025 08:07 AM
Hi,
I build Cisco ACI using terraform with CI\CD, having only one tenant and one vrf. Since my prod environment is big with thousands of variables, I end up having very big state file and huge delay (7-8 minutes) when running the pipeline.
I found that a possible solution is to migrate to nexus-as-code, having 40k of code in prod, I don't want to start over with nexus-as-code.
Is there a solution to reduce the state file delay? without clearing everything and starting from the beginning?
Thank you in advance.
01-06-2025 09:00 AM
I had the same thing years back with Python and Ansible. One way to do this is too infrastructure into multiple smaller TF workspaces, thus each managing a logical group of resources (for example by application or network segment), this will reduce your individual state file sizes and parallel execution time.
06-17-2025 01:39 PM
I am new to Terraform and am learning to automate Cisco ACI with Network-as-code module. Splitting the state files into multiple TF workspace as you suggested means that we have to take care ourselves which order the ACI objects should be created (we lose the automatic dependency handling), right? If yes, is there any solution for that? Thank you.
06-17-2025 01:58 PM
Yes this can be a problem and you can lose the automatic dependency resolution between objects in different state files.
Take a look at HashiCorp's Terragrunt tool handles cross state dependencies very elegantly and it can automatically manage the apply order based on dependencies.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide