In this post we’ll walk through configuring StackStorm to integrate with Terraform and leverage Slack to trigger Terraform actions in a ChatOps manner.
In a previous post I covered vRA7 ChatOps with StackStorm which covered integrating Slack, VMware vRealize Automation 7 and StackStorm to interact with vR7 from within Slack.
All the code for this post can be found in the stackstorm-terraform repo on github.
- Terraform must be installed and in the system path.
- Currently the Terraform plan must be local to the StackStorm instance.
Install the Terraform StackStorm Pack
Run the following command on the StackStorm instance to install the Terraform pack.
st2 pack install https://github.com/martezr/stackstorm-terraform
The Terraform pack supports the following actions.
The terraform apply command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.
! terraform apply "/plan/directory"
The terraform destroy command is used to destroy the Terraform-managed infrastructure.
! terraform destroy "/plan/directory"
The terraform show command is used to provide human-readable output from a state or plan file.
! terraform show "/plan/directory"
vRA7 ChatOps with StackStorm