Attaching a Terraform Module to an Environment
To attach a Terraform Module to an environment, you only need to follow the steps below:
1. Go to the Environments page and click on the desired environment.
2. Click the button and select Terraform Module.
3. Select the Terraform Module you wish to attach to the environment.

Click the Continue button.
4. Next, Bunnyshell will identify the Terraform variables that have been defined as configurable at the module level. These variables must be configured before the module is attached to the environment.

Click Continue.
5. In this next step, you can map Terraform output values to your environment components. This will help you connect your applications to your infrastructure.

Mapping Output Values
Output values can be mapped to variables from your components (apps, services etc) deployed in Kubernetes.
Mapping output values is not a mandatory step, but it can help you integrate Terraform with your services. It is not only useful for random output values, but also for those with static values, since you will no longer need to manage them both in config and in Terraform. You simply create a mapping and when a Terraform module is applied the new value is automatically injected in the app.
When selecting the Terraform output value, the drop-down menu will only display the output values you chose to include when you added the Terraform module.
In the Resource Type drop-down menu you can select the way in which Bunnyshell injects an output value. Choose one of the two options:
Environment. In this case, the value will be injected in all the services inside that environment. This feature comes in handy, for example, if your environment includes a number of services that use the same database and share one or more variables.
Environment Components. In this case, the value will be injected in just one service inside the environment. So, for example, if you want to name a variable password, but another service has a variable with the same name, this feature can help you avoid a situation where there are two variables named password inside the same environment.
Bunnyshell now checks if all the variables provided are in order and makes sure there no errors that could affect the module. This is the final and most important check performed. If everything is in order, the attachment will be functional.
Click Continue.
6. Bunnyshell now creates an execution plan, which lets you preview the changes the Terraform module plans to make to your infrastructure.
Should you wish to make further changes, click Back to return to the previous screen.
When everything is properly configured, click Attach Terraform Module.

Last updated
Was this helpful?