atmos icon indicating copy to clipboard operation
atmos copied to clipboard

Vendor a terraform resource as a module/component

Open nitrocode opened this issue 7 months ago • 1 comments

Describe the Feature

It would be nice to vendor a terraform resource as a module/component so it can be easily used without needing to setup all of the scaffolding.

Expected Behavior

vendor yaml works for specific resources

Use Case

Use-cases:

  • I want a module specific for route53 records. I want to use atmos vendor to create a wrapper module for the aws_route53_record resource
  • I want to compose a simple component that uses 2 resources, aws_security_group and aws_security_group_rule, and use the composition as a base and then manually tie these resources together

Describe Ideal Solution

atmos either reads the golang code of a provider to read the arguments of a resource in OR atmos reads the html doc to scrape the arguments of a resource.

Once a resource and its arguments are read, atmos should populate the variables.tf and main.tf for every argument of the resource.

Alternatives Considered

Vendor in a module that already uses the resources that we're interested in and then delete everything except for the arguments related to those resources

Additional Context

N/A

nitrocode avatar Apr 25 '25 14:04 nitrocode

This is similar, but not exactly what you want:

  • https://atmos.tools/core-concepts/vendor/component-manifest/#vendoring-modules-as-components

That said, I think "vendor" might be the wrong term for this. "Vendoring" typically implies copying existing artifacts, whereas in this case the request is more about generating a new component from some resource.

I believe the right approach would be to use Gen AI (e.g., Cursor) to generate a lightweight component that you then wire up into Atmos as part of the framework.

Just a word of caution: one of our goals with Atmos is to avoid turning it into a reimplementation of HCL in YAML. We're trying to sidestep the pitfalls that come from blindly using HCL without a framework, while still respecting the fact that HCL already does many things very well. We want to build on those strengths without unnecessarily reinventing the wheel.

osterman avatar Apr 25 '25 15:04 osterman