-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add ERB template support to the command helpers #111
Comments
Args files are just ruby, so it wouldn't be ERB. Instead, it would be something like this: config/args/terraform.rb command("plan",
args: ["-lock-timeout=22m", "-out=#{expansion(":ENV-:ACCOUNT-:REGION-:MOD_NAME-:INSTANCE")}.tfplan.json"],
) Unfortunately, it's not simple as including the helper methods to the args builder. The reason is that helpers are currently designed for tfvars file where the dependency graph is calculated. Terraspace actually evaluates the tfvars files twice and caches the calculated results of the helpers methods for performance reasons. The dependency graph processing logic would needed to be altered so the first pass would not be a regular ruby eval but possibly a parser. This avoids the the helpers actually being invoked in the first pass. Then helpers would be more easily be included elsewhere. Think the original reason took the ruby eval twice approach was because it's faster than writing a decent parser. So it's a bit complex right now 🧐 Will take a decent amount of time. Will consider PRs. Of course no sweat either way 👍 |
The main reason is that i'm trying to get hold of an uniquely named plan file for each stack being spun up when using |
Thinking will add an option to handle plans. Perhaps:
Maybe the default conventional saves the plan to an expanded path. But you can also provide specify pattern the command
Unsure when will get to this, probably not for a while. Would like to provide this ability though. Happy to consider PRs. No sweat either way of course. 👍 Thanks! |
That'd work fine, as long as each plan output file has a unique name and/or path it'll be workable. |
Closed in favor of #156 |
Summary
Add the ability to do ERB template resolution on the fields (in particular the
args
field) passed to thecommand
definition in theconfig/args/terraform.rb
file.Motivation
I'm hoping to be able to generate suitable output Terraform plan files when using
terraspace all plan
with an individual plan name for each stack/instance to review the changes and to feed the suitable plans in to the apply/up commands.Guide-level explanation
In particular i'd be interested in doing the below so that I can add the "plan" files to my MR/PR's via the CI/CD process (GitLab).
The text was updated successfully, but these errors were encountered: