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 setproduct function to the bake HCL #503

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Add setproduct function to the bake HCL #503

merged 1 commit into from
Jan 20, 2021

Conversation

felipecrs
Copy link
Contributor

@felipecrs felipecrs commented Jan 10, 2021

As explained in the following link, it's a very useful function.

https://www.terraform.io/docs/configuration/functions/setproduct.html#finding-combinations-for-for_each

This is my use case:

function "create_tags" {
  params = [image_name]
  variadic_param = tags
  
  result = [
    for rt in setproduct(["docker.io", "ghcr.io"], tags):
        "${rt[0]}/${image_name}:${rt[1]}"
  ]
}

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM

@tonistiigi tonistiigi merged commit a56a4c0 into docker:master Jan 20, 2021
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.

3 participants