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

Manage hierachy of terraform variable #102

Open
Pjack opened this issue Oct 8, 2024 · 1 comment
Open

Manage hierachy of terraform variable #102

Pjack opened this issue Oct 8, 2024 · 1 comment

Comments

@Pjack
Copy link
Contributor

Pjack commented Oct 8, 2024

We need to declare the value of each Terraform variable for every project, which makes the PR lengthy when adding new variables. Here are some examples.
https://github.com/canonical/solutions-engineering-automation/pull/39/files
https://github.com/canonical/solutions-engineering-automation/pull/69/files
https://github.com/canonical/solutions-engineering-automation/pull/101/files

We should manage Terraform variables with a hierarchy, allowing us to define default values for the template.
Reference doc: https://medium.com/@mehmetodabashi/terraform-variable-usage-the-order-of-precedence-for-variable-sources-c91586ddb13f

We can also consider to adopt terragrunt so that we can many the default value for each group.
Ex: https://github.com/canonical/charm-engineering-repos/blob/main/teams/observability/repos/common.hcl

@samuelallan72
Copy link
Contributor

samuelallan72 commented Nov 29, 2024

There has been some conversation in #113 about this - see #113 (comment) for Robert's response. I also reckon that lack of default values is not a bad thing - I also prefer things being more explicit, even if it makes some PRs more verbose.

Either way, if we switch to jinja templating (which it looks like we will, regardless of how we implement it), then we will have support for default variables (whether we decide to use it or not).
Because of this, can we close this issue?

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

No branches or pull requests

2 participants