Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Parsing terraform template/workspace tags should support local and some basic builtin functions #15977

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

Closed
Emyrk opened this issue Dec 30, 2024 · 3 comments
Assignees
Labels
must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this.

Comments

@Emyrk
Copy link
Member

Emyrk commented Dec 30, 2024

Tag parsing should support a basic set of builtin functions and support local blocks.

@coder-labeler coder-labeler bot added the needs-triage Issue that require triage label Dec 30, 2024
@johnstcn johnstcn self-assigned this Dec 30, 2024
@johnstcn johnstcn added must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this. go and removed needs-triage Issue that require triage labels Dec 30, 2024
@johnstcn
Copy link
Member

johnstcn commented Dec 30, 2024

Here is the complete list of functions available in Terraform (as of v1.9.8).

Some of them (e.g. stdlib.*) can simply be imported, but the Terraform-internal ones (funcs.*) will need to be manually vendored in (example).

@johnstcn
Copy link
Member

johnstcn commented Jan 7, 2025

You can use locals to give a name to the result of any Terraform expression, and re-use that name throughout your configuration.

source (emphasis mine)

If we support locals in workspace tags, we will need to evaluate them dynamically. Storing pre-evaluated locals values in the database will most likely not have the desired effect.

Given that we also have a critical path inside wsbuilder to evaluate workspace tags, the current approach of extracting the file on-disk is not ideal when holding a database transaction. Part of this work will involve some refactoring to allow extracting the tags in-memory.

@matifali matifali removed the go label Jan 17, 2025
johnstcn added a commit that referenced this issue Jan 20, 2025
…rm functions (#16183)

Relates to #15977

Adds support for some functions in `tfparse` (only functions that do not
reference local files).
NOTE: for now, I'm importing trivy-iac. If we prefer to avoid a little
dependency, I can do a little copying instead.
@mtojek mtojek closed this as completed Jan 20, 2025
@johnstcn
Copy link
Member

Closing this out as #16183 added (partial) support for functions. Support for locals will come later.

SasSwart pushed a commit that referenced this issue Jan 22, 2025
…rm functions (#16183)

Relates to #15977

Adds support for some functions in `tfparse` (only functions that do not
reference local files).
NOTE: for now, I'm importing trivy-iac. If we prefer to avoid a little
dependency, I can do a little copying instead.
johnstcn added a commit that referenced this issue Jan 27, 2025
…rm functions (#16183)

Relates to #15977

Adds support for some functions in `tfparse` (only functions that do not
reference local files).
NOTE: for now, I'm importing trivy-iac. If we prefer to avoid a little
dependency, I can do a little copying instead.

(cherry picked from commit 4ba0b39)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this.
Projects
None yet
Development

No branches or pull requests

4 participants