Terraform Modules in Bunnyshell
Terraform Modules in Bunnyshell are templates which can be used to create cloud-managed services (dependencies) for your application environments.
They provide governance, as you can only have the permission to modify certain input variables when attaching to an Environment ("lock" the instance size, for example, to limit costs).
Furthermore, they abstract all the configuration needed for a Terraform module and allow only relevant options to be configured.
1. To create Terraform Modules in Bunnyshell, click the Terraform Module icon on the left side of the interface.
2. Click on Add Terraform module.
3. Fill in the name and description.
4. Select the repository, branch and path of the module
In this case, we used the repository demo-books-terraform
and the branch master
in order to test out a module that hasn't been released yet.
The path should be set to /backend/_terraform
as this is the folder in which the Terraform module is defined for the application.
5. The module will now be validated
6. Needed variables will be detected. In our case, we only have the bucket name, which needs to be defined. Click Define value.

7. Fill in the necessary fields as indicated below.
Type: Fixed value (String, Number, Bool)
Value: books-{{ env.unique }}

8. Next, environment variables need to be added (env vars with which Terraform will run). These are not related to Bunnyshell Environments. Click Add variable, as indicated below.

9. It's time to add the values required for cloud access:
AWS_ACCESS_KEY_ID = replace-access-key
AWS_SECRET_ACCESS_KEY = replace-secret
AWS_REGION = us-west-1
You can choose the access key to be a secret, allowing it to be obfuscated.

10. The plan will now be tested with the provided values.

11. Finally, the output values are detected. They will be used after attaching the Module to an Environment.
You can also choose to exclude irrelevant output values, in order not to pollute the variable namespace - not the case here.

12. Click Add Terraform Module. And that's it: you have a Module which you can use in your Environments.

It is important that you make sure the Git source of the Terraform Module is not deleted, as Bunnyshell fetches the code from there before applying it.
Bunnyshell has implemented GitOps for Terraform Modules, meaning the module gets updated if you update it in Git.
If approved, the changes will be cascaded all the way to your Environment, but they will not be automatically applied.
All variables (Environment Variables and Input Variables) are stored in an encrypted form. The secret property only determines if it obfuscated in the UI and in logs.
Last updated
Was this helpful?