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

scaffold doesn't show default boilerplate variables #3655

Open
platymatt opened this issue Dec 13, 2024 · 3 comments
Open

scaffold doesn't show default boilerplate variables #3655

platymatt opened this issue Dec 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@platymatt
Copy link

platymatt commented Dec 13, 2024

Describe the bug

This could be a feature request instead.

If I define default variables in the boilerplate.yml they don't show up in the scaffold output when entering in variables.

When I run terragrunt scaffold /<module-location>//<module-name> I get the following output:

image

When I run ./boilerplate_linux_amd64 --template-url /module-name/.boilerplate/ --output-folder /output I get the following output:

image

I may misunderstand as I thought scaffold was supposed to have similar features to boilerplate, but maybe I don't understand the intent.

Steps To Reproduce

These steps are using a local module in a monorepo.

  1. Create /.boilerplate/boilerplate.yml with variables that have defaults
  2. Run terragrunt scaffold <module-location>//<module-name>
  3. Provide variable input

Example boilerplate.yml used

# boilerplate.yml
  - 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

Expected behavior

I expect terragrunt scaffold to have similar behavior as boilerplate as the usage is similar.

Versions

  • Terragrunt version: terragrunt version v0.56.2
  • OpenTofu/Terraform version: Terraform v1.8.1
  • Environment details (Ubuntu 20.04, Windows 10, etc.): Running in devcontainer with the following:
cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Additional context

I am hoping terragrunt scaffold to be similar to boilerplate, but if that is not the intent then maybe I should use boilerplate instead as it has more features.

@platymatt platymatt added the bug Something isn't working label Dec 13, 2024
@platymatt platymatt changed the title scaffold doesn't showcase default boilerplate variables scaffold doesn't show default boilerplate variables Dec 13, 2024
@yhakbar
Copy link
Collaborator

yhakbar commented Dec 13, 2024

Hey @platymatt ,

Scaffold is an opinionated command that runs Boilerplate in a way that is considered optimal for most users trying to leverage code generation via Terragrunt.

That isn't to say it can't expand in functionality, though!

If you're familiar with Golang, I'd really like to welcome you to become a contributor to help make scaffold the kind of tool you're hoping to have. I'm happy to support you on the process of adjusting the functionality, as long as there are still good defaults, and smart controls.

You can see here how scaffold sets up Boilerplate usage, and you can see here the options that Boilerplate exposes.

You can also see an example here of me proposing an adjustment to how Scaffold works by introducing a new flag.

If you're interested in getting involved, I recommend joining the Discord too, so you can reach out to us if you need any guidance on best practices, etc. I think that will be the fastest way to get this issue and #3652 resolved to your satisfaction.

@platymatt
Copy link
Author

Thank you for your response. I am not familiar or experienced in Golang yet, but desiring to get started. I would be willing to contribute.

@yhakbar
Copy link
Collaborator

yhakbar commented Dec 13, 2024

Take a look at the docs here.

As first steps, I would recommend the following:

  1. Build Terragrunt locally, so that you can play with your own version of Terragrunt.
  2. Run the Scaffold tests (you don't need to run the tests for the entire project, just the stuff that you're interested in changing).
  3. Write a test that produces the outcomes you're looking for, and get those tests to fail the way you expect.
  4. Write code that fixes the tests so that you have the new behavior you want.

Let me know if you get stuck at any stage, and I'll help you out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants