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

Please add support to alltrue function #13073

Open
luckeyca opened this issue Jun 25, 2024 · 0 comments · May be fixed by #13237
Open

Please add support to alltrue function #13073

luckeyca opened this issue Jun 25, 2024 · 0 comments · May be fixed by #13237

Comments

@luckeyca
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

Description

In HCL2 syntax template, please support alltrue function

Use Case(s)

This is the same as in terraform to be used for variable validation.

Potential configuration

  validation {
    condition = alltrue([for k, v in var.base_image_filter :
      (k == "base_image_compartment_id" && startswith(v, "ocid1.tenancy.oc1..")) ||
      (k == "operating_system" && contains(["Canonical Ubuntu", "Oracle Linux", "Windows"], v)) ||
      (k == "operating_system_version" && contains(["22.04", "8", "9", "Server 2019 Standard", "Server 2022 Standard"], v)) ||
      (k == "display_name_search" && can(regex("^Canonical-Ubuntu-22\\.04-2[0-9][0-9][0-9]\\.\\d+", v))) ||
      (k == "display_name_search" && can(regex("^Oracle-Linux-8\\.\\d-2[0-9][0-9][0-9]\\.\\d+", v))) ||
      (k == "display_name_search" && can(regex("^Oracle-Linux-9\\.\\d-2[0-9][0-9][0-9]\\.\\d+", v))) ||
      (k == "display_name_search" && can(regex("^Windows-Server-2019-Standard-Edition-VM-2[0-9][0-9][0-9]\\.\\d+", v))) ||
      (k == "display_name_search" && can(regex("^Windows-Server-2022-Standard-Edition-VM-2[0-9][0-9][0-9]\\.\\d+", v)))
    ])
    error_message = "Source image search criteria must have the correct keys and values. See base_image_filter variable definition for details."
  }

Potential References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants