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

Add for_each #134

Merged
merged 17 commits into from Jun 29, 2023
Merged

Add for_each #134

merged 17 commits into from Jun 29, 2023

Conversation

brikis98
Copy link
Member

@brikis98 brikis98 commented Jun 19, 2023

Description

This PR adds for_each and for_each_reference support to the dependency block of boilerplate. If you pass in a list to these attributes, instead of creating the dependency once, boilerpalte will loop over each item in the for_each list, and run the dependency once for each of those items. You can access the current item in the loop using __each__.

The main use case for this is to generate sub-folders and files dynamically: e.g., in https://github.com/gruntwork-io/prototypes/pull/361, I use this to generate environments (dev, stage, prod) dynamically, based on which environments the user asked for.

Bonus fix: remove Rho from CODEOWNERS; GitHub was showing an error about that.

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

@brikis98 brikis98 changed the title Add for_each [DO NOT MERGE YET] Add for_each Jun 28, 2023
@brikis98
Copy link
Member Author

OK, this is now ready for review. I added docs and examples; and by virtue of putting the examples and some test fixtures in the right folders, this also automatically adds tests.

README.md Outdated Show resolved Hide resolved
zackproser
zackproser previously approved these changes Jun 28, 2023
Copy link
Contributor

@zackproser zackproser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a question but LGTM

@brikis98 brikis98 dismissed zackproser’s stale review June 28, 2023 18:23

The merge-base changed after approval.

marinalimeira
marinalimeira previously approved these changes Jun 29, 2023
@brikis98 brikis98 dismissed marinalimeira’s stale review June 29, 2023 11:47

The merge-base changed after approval.

@brikis98
Copy link
Member Author

Hm, there seems to be some issue preventing me from merging. Might be related to: https://github.com/orgs/community/discussions/58535. The suggestion there is to close and re-open the PR... Let me try that.

@brikis98 brikis98 closed this Jun 29, 2023
@brikis98 brikis98 reopened this Jun 29, 2023
@brikis98
Copy link
Member Author

That... did not work. WTF.

@brikis98
Copy link
Member Author

Grr, no time to deal with this, will temporarily disable branch protection and merge.

@brikis98 brikis98 merged commit 7d8be32 into master Jun 29, 2023
2 of 3 checks passed
@brikis98 brikis98 deleted the enhancement/hackday-for-each branch June 29, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants