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

Request for contributions - Usage patterns #311

Closed
bryantbiggs opened this issue Oct 27, 2023 · 5 comments
Closed

Request for contributions - Usage patterns #311

bryantbiggs opened this issue Oct 27, 2023 · 5 comments

Comments

@bryantbiggs
Copy link
Member

Is your request related to a problem? Please describe.

  • With the updates in feat!: Refactor module to use maps instead of lists #305 (v9.0), the configurations utilize deeply nested maps which reflect the AWS API. Understanding these maps can be challenging for users so we would like to demonstrate the configurations required for common usage patterns.

Describe the solution you'd like.

  • If you would like to contribute, please open a pull request to contribute the configuration snippet (we do not need the full module definition, just the relevant bits for the associated usage pattern) adding that pattern to here

Describe alternatives you've considered.

Additional context

@rdhar
Copy link
Contributor

rdhar commented Nov 14, 2023

Hi @bryantbiggs, many thanks once again for pushing the major v9 upgrade; conversion of lists to maps as well as inclusion of a li'l Route 53 have been excellent additions.

To aid debugging a separate issue, I published this repo which makes heavy use of the latest ALB module. Most notably, it features rules, target_groups, and route53_records which iterate over input maps of their own like so:

locals {
  services = {
    alpha = { port = 80 }
    bravo = { port = 80 }
  }
}
...

target_groups = {
  for key, value in local.services : key => {
    name              = key
    backend_port      = value.port
    target_type       = "ip"
    create_attachment = false
  }
}

Beyond keeping code DRY, I've found it to be a really useful pattern for leveraging the benefits of nested object maps across IaC configuration, particularly in the context of provisioning ECS services in bulk.

Is this the sort of snippet that you're looking for contribution, or perhaps something more substantial than this?

Edit: Based on this pattern, I've opened #327 for consideration.

@cdhesse
Copy link

cdhesse commented Nov 27, 2023

I believe making use of typed variables (with detailed validations on each field which gives feedback to the developer while trying to use it) would be very beneficial, vs. definitions with type "any". Is there a reason why this isn't being done? Is it fear of backwards compatability?

@bryantbiggs
Copy link
Member Author

Is there a reason why this isn't being done?

Yes - the use of fully structured variable definitions have been quite problematic. We have not revisited this with the new optional arguments, but the gain seems to be marginal at best when compared with the overhead and complexity of maintaining such definitions

@bryantbiggs
Copy link
Member Author

thanks all for the contributions! If there are additional patterns that are of interest, please feel free to let us know, but for now we'll close out this issue

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 11, 2024
@bryantbiggs bryantbiggs unpinned this issue Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants