Lately started working on migrating bunch of "lega...
# random
t
Lately started working on migrating bunch of "legacy" TF glue code into Atmos while refactoring a lot of underlying resources for the whole organization - 5yrs debt so to speak. The idea is to import existing TF/cloud resources into stacks managed by Atmos while refactoring a lot under the hood. Today I have made a Mission Control dashboard to track the progress so everyone can see whats the current status of the whole project, whats the migration status for a particular TF source file, where is the source code (legacy) TF file, how TF resources from those files map into atmos components along with links to those components and stacks that use/define them - the outcome is that large files are being split into more modular and reusable atmos components, so I'ts nice to see whats moved to where. I hope it will help with Atmos adoption within the org. So far it's a simple SPA app.
BTW hope I will be able soon to help you guys with updatating GH actions to include support for GCS and Firestore into main, I saw quite old PRs that didn't get merged yet https://github.com/cloudposse/github-action-atmos-terraform-plan/pull/93 I've forked plan and apply actions and updated the dependencies to leverage GCP support and it's working quite nice
e
Cool dashboard!
Would love to learn more about how you're tackling this
t
Since the lagacy code is organized/grouped by specific file names, I do the migration file by file (or buch of TF files) at a time, starting with the lowest "environments" like dev or sandbox. First I'm identifying which legacy TF resources I can map and combine into GCP modules I'm using. Those modules are so broad and complex enough that I map them 1:1 into Atmos components; in other words each Atmos component wraps exactly one TF module. That leaves me with stuff I cannot map out so "easily", so then I need to decide what to do with it, do I need prep some custom TF module, find one, or just copy paste whats left in there and wrap it as Atmos component, and try to find out how much reusable and generic it needs to be in relation the existing and future codebase. Then I build my stacks, copying values from legacy
vars.tf
/
tfvars
into components inputs and I deploy them into my lab environment/account to validate. After that I'm looking which part of the configuration I can extract as defaults that I put into
catalog/
. Most of the time I'm looking to introduce at least name template(pattern) for the provisioned resources within the
defaults.yaml
file by creating an abstract component with sensible defaults, so things are named consistently. Cloud resource names are computed within the stacks using top level vars. This step is still fluid as I'm still figuring out in between what goes into defaults, and how to transform those components later and pack them into fully reusable blueprints. The catch is that the templated name values need to match the names of resources deployed currently within the cloud account to avoid change/create/destory cycle. The most common input vars get replaced by importing mixins like regions/location, project_id etc. In the next step I'm adding `import {}`block into TF modules within Atmos components. Then I switch project/cloud accounts from lab to dev/sandbox/whatever. and run
Atmos plan
locally to see if resources are being imported or changed/destroyed - in case of any changes I update components input values. After finishing with that I run
Atmos apply
to validate the import into TF state files stored in temporary bucket. When I'm ready I push my PR, review TF Plans once again in the PR comments and those get imported after merging. In case I need to execute components in a specific order I have a filter inside GH workflow that extracts from Atmos settings whether GH actions are enabled or disabled for a component - I control that by importing
enabled/disabled
mixin. I would like to see Atmos pro in action though one day.
e
In this example, I see backstage in the title. Did you write a backstage extension?
> This step is still fluid as I'm still figuring out in between what goes into defaults, and how to transform those components later and pack them into fully reusable blueprints. I would start without using the catalog and see what can be DRY'd up later
✅ 1
t
Not yet, in that case it's just a link to our Atmos docs in backstage.
e
Claude Code will do a good job with that
t
How would you define what exactly such backstage integration should do? Populate atmos components into backstage catalogue?