We are excited to announce that Terrahaxs now supports regular expressions for project names!
What does this mean for you?
Previously, there was a one-to-one relationship between a project and directory/workspace configuration. If you are working in a large Terraform ecosystem then your configuration file becomes bloated and could be thousands of lines long.
How does it work?
You can checkout an example pull request here.
In this PR our configuration file looks like this:
version: 3
defaults:
workflow: myworkflow
roles:
aws: arn:aws:iam::530084066544:role/terrahaxs-worker
projects:
- dir: (foo|bar|baz).*
workspace: default
terraform_version: v1.0.11
- dir: bar.*
workspace: default
terraform_version: v1.0.11
drift_detection_enabled: false
- dir: hw_dir.*
workspace: default
workflows:
myworkflow:
plan:
steps:
- run: terraform fmt -check -diff .
- init
- plan:
extra_args: ["-lock=false"]
- show
- run: conftest test $SHOWFILE --policy $CLONE_DIR/policy --no-color
name: Conftest
apply:
steps:
- run: echo hi
- init
- apply
and we added 100 directories that begin with hw_dir
and we ended up with a workflow run on 100 projects.
If a project matches more than one regular expression then the last match will be the one that gets executed.
We hope you enjoy this feature and it makes it reduces the amount of effort required to keep your configuration file up to date!