can you write a Terraform Deployment action and a ...
# 🤖|ask-kapa
m
Please stand by @quaint-dress-831 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- Sure, based on the information provided in the extracts, you can define a
terraform
Deploy action and a
exec
Run action in your Garden project. Here's an example: First, define a
terraform
Deploy action in your
garden.yml
file:
Copy code
yaml
kind: Deploy
type: terraform
name: tf
autoApply: true
This will deploy your Terraform stack. You can then reference the stack outputs of this
terraform
action using runtime output template strings. Next, define an
exec
Run action that takes a Terraform output and writes it to a local file:
Copy code
yaml
kind: Run
type: exec
name: write-output
dependencies: [deploy.tf]
script: echo ${runtime.services.tf.outputs.my-output} > output.txt
In this example,
my-output
is the name of the output from your Terraform stack. This script will write the output to a file named
output.txt
. Please note that the
exec
actions are executed locally on the same machine as the Garden CLI, and not in a Kubernetes cluster. Also, the
terraform
Deploy action will not automatically apply the Terraform stack unless you explicitly set the
autoApply
flag to
true
. For more details, you can refer to the Garden documentation () and the Terraform plugin documentation (). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
q
@many-pizza-75746 you may need to change
${runtime.services.tf.outputs.my-output}
for
${actions.deploy.tf.outputs.my-output}
in the above
m
@quaint-dress-831 that particular run action is using old syntax The bot will need to be updated with the 0.13 syntax