2
votes

What's the common pattern for not duplicating variable values across plans?

We have a standard set of tags we use in plans and modules for which we wish to define once and use many. For example: we set CostType tag to values like compute, storage, etc.. We can define it plan level, or module level but that means defining a variable in multiple places which isn't very DRY (don't repeat yourself).

Options

  • non infrastructure changing module which defines these "global" variables and all modules/plans use that first so the rest of the actions can harvest the values from that plan

  • use a non infrastructure changing plan store remote state to store variable values and access it as from module/plans

  • use a tfvars file and handle it via the scripts that wrap terraform actions

  • devops elves magically handle this problem

How do you solve this problem in your organization?

1
Can I reuse "DevOps elves magically handle this problem"?Giulio Vian
By all means. I like to add a crazy option to ensure people know I'm not limiting the field of ideas. "use a tfvars file..." ha what other jokes are there...Peter Kahn

1 Answers

0
votes

I used with success symbolic links to link the same variable file in multiple locations.

Symbolic links are well supported by Git and can be used on Windows too (with some care Git Symlinks in Windows).