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

feat: default variables for infracost config template files #2394

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

hugorut
Copy link
Contributor

@hugorut hugorut commented Apr 3, 2023

Adds support for default data to be passed into the template parser. This allows up to provide top level metadata variables that users can interact with. Currently the only supported variable is .branch which represents the current branch name of the repo, e.g. main, test.

Adds support for default data to be passed into the template parser. This allows up to provide top level metadata variables that users can interact with. Currently the only supported variable is `.branch` which represents the current branch name of the repo, e.g. `main`, `test`.
@hugorut hugorut self-assigned this Apr 3, 2023
@hugorut hugorut requested a review from vdmgolub April 3, 2023 11:14
internal/config/template/parser.go Outdated Show resolved Hide resolved
Co-authored-by: Vadim Golub <vadim@infracost.io>
@hugorut hugorut merged commit 9479155 into master Apr 3, 2023
8 of 9 checks passed
@hugorut hugorut deleted the feat/default-template-variables branch April 3, 2023 13:41
@@ -22,13 +22,15 @@ var (
type Parser struct {
repoDir string
template *template.Template
data map[string]interface{}
Copy link
Member

Choose a reason for hiding this comment

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

@hugorut is there any benefit to making this a struct with types instead of a map of interfaces? Does it help if we want to pass these variables into other template functions in the future?

hugorut added a commit that referenced this pull request Apr 24, 2023
hugorut added a commit that referenced this pull request Apr 25, 2023
hugorut added a commit that referenced this pull request Jun 6, 2023
hugorut added a commit that referenced this pull request Jun 8, 2023
… files"" (#2488)

* Revert "Revert "feat: default variables for infracost config template files (#2394)" (#2419)"

This reverts commit 9e36c1f.

* fix: change input variables to struct
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.

None yet

3 participants