Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output-folder flag for scaffold #3652

Open
platymatt opened this issue Dec 12, 2024 · 4 comments
Open

output-folder flag for scaffold #3652

platymatt opened this issue Dec 12, 2024 · 4 comments
Labels
contributions-requested Requesting contributions from the community enhancement New feature or request preserved Preserved issues never go stale

Comments

@platymatt
Copy link

platymatt commented Dec 12, 2024

Describe the enhancement

When using terragrunt scaffold it creates the terragrunt.hcl in your working directory. I would like to be able to specify an output directory with a flag or variable. My goal is to place the terragrunt.hcl within my nested folder structure with the scaffold command.

I have tried messing with the following boilerplate.yml below as well as adding a before: section that would change my current directory to one provided by the variables or use an after: section to move the produced file to the desired location and neither work.

variables:
  - name: Environment
    description: The environment for where to deploy this infrastucture.
    type: string
    default: dev
  - name: Region
    description: The region for where to deploy this infrastucture.
    type: string
    default: us-gov-west-1
  - name: Tenant
    description: The region for where to deploy this infrastucture.
    type: string
    default: common
  - name: Resource
    description: The region for where to deploy this infrastucture.
    type: string
    default: common
  - name: outPutFolder
    type: string
    default: "deployments/{{ .Environment }}}/{{ .Region }}/{{ .Tenant }}/{{ .Resource }}/"

Additional context

Add any other context about the enhancement here.

Things you might want to address include:

Alternatives I may have to consider is running a after: block with a script to create the directories and place the file where I want it to go. I haven't tried that yet. I've been looking for examples for this use case and haven't found any.

PoC (Proof of Concept)

No PoC available at this time.

RFC Not Needed

  • I'm unsure if this needs an RFC. The boilerplate tool allows for an --output-folder flag and requires it, but terragrunt scaffold doesn't allow the output-folder flag to be set.
@platymatt platymatt added the enhancement New feature or request label Dec 12, 2024
@yhakbar
Copy link
Collaborator

yhakbar commented Dec 12, 2024

Thanks for creating this @platymatt ,

This is a solid enhancement, and not one that would be terribly difficult, I don't think.

I'll mark it as contributions-requested, as it's not something we're looking to prioritize anytime soon, but I'll also mark it as preserved, as we will get to it eventually if the community doesn't first.

My preferred solution would be that scaffold uses an --output-folder flag so that users familiar with Boilerplate can guess the right flag without reading the docs.

This also adds an additional wrinkle that the catalog TUI doesn't offer a way to select where scaffolding will take place once a user decides to scaffold. It might be good to add an extra keybinding that lets a user do that. It might require integrating or building something like yazi to let someone interact with their filesystem to create the destination for the unit.

@yhakbar yhakbar added contributions-requested Requesting contributions from the community preserved Preserved issues never go stale labels Dec 12, 2024
@platymatt
Copy link
Author

@yhakbar would a workaround for this to make custom script that is called in a after: hook?

@yhakbar
Copy link
Collaborator

yhakbar commented Dec 13, 2024

@yhakbar would a workaround for this to make custom script that is called in a after: hook?

I'm not sure if that's the best workaround. I think some testing would be required. Personally, I would recommend that you look at actually implementing an --output-folder flag in scaffold. I gave you some guidance on the other issue, and I'm happy to help you make it happen.

@tgeijg
Copy link

tgeijg commented Dec 13, 2024

@platymatt You can achieve this currently by using boilerplate dependencies. There is then an issue with the fact that scaffold runs an hclfmt on the entire repo. I've created an issue for that here: #3657

(that also has an example boilerplate that should give you some idea on how that works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions-requested Requesting contributions from the community enhancement New feature or request preserved Preserved issues never go stale
Projects
None yet
Development

No branches or pull requests

3 participants