Skip to content

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

3 participants