Currently, I am implementing Terraform for a specific project and I have been assigned two tasks within my package.json
file. These tasks involve executing the commands terraform plan
and terraform apply
.
"scripts": {
"tf:apply": "terraform apply",
"tf:plan": "terraform plan"
}
It is essential for both of these commands to be preceded by a terraform get
operation. Ideally, I am looking to streamline this process by incorporating just one pretask
that can be applied to both.
My initial attempt involved using the following code snippet:
"scripts": {
"pretf:*": "terraform get",
"tf:apply": "terraform apply",
"tf:plan": "terraform plan"
}
Unfortunately, this approach did not yield the desired outcome.
Is there a way to accomplish this utilizing NPM
or Yarn
exclusively? Or is it inevitable for me to specify the same pretask
for each of these tasks separately?