Skip to content

[User Guide] how to create a building block based on a terraform code

MJ edited this page Sep 21, 2023 · 2 revisions

Updated on: 04.08.2023 meshStack Version: 2023.7.0

Here you can find a full example of how to create a building block block based on a Terraform module in this repository.

Creating the Building Block Definition

  1. In meshStack's ADMIN AREA, from the left sidebar scroll down until you find the Building Block section. Click on "Create new Definition"
image
  1. Enter the Definition Name, Description and Logo of your building block. Click on Next.
image
  1. Choose your Supported Platforms (You may choose more than one option based on your Terraform code) and select Terraform as Implementation Type.
image

Note: If you want to use a private repository, add the SSH URL instead of HTTPS, and then upload your Private SSH Key

  1. In the next page, you can add dependency between building blocks. For example a "Virtual Machine" building block which have a dependency with a "Virtual Network" building block.
image
  1. In the Inputs page, add the variables in your terraform module as desired:
  • for your Backend file, enter "Backend.tf" as the name of the input, choose "File" in the type, and "Static" as source. Then upload your backend.tf file
image
  • You have to also enter the details of the Service Principal which will deploy this building block in your environment. (e.g. for Azure Service Principal, Add ARM_CLIENT_ID and ARM_CLIENT_SECRET as Environment Variable and make sure to turn on the Encryption switch)
image
  1. In the next page, Add your terraform outputs which will be later in the output box of your building block. Then Click on Create Building Block. Congratulations!! You have made your building block definition. Now you or your internal customers can add it to their tenants inside their project to get actually deployed in their environment.

to do so, do as follows:

Add building block to a Tenant

  1. From the top bar, Navigate to your Workspace. Then inside your Project find the Tenant that you want to add the building block into and click on "View more details".
image image image
  1. Click on Building Blocks tab, Then "Add Building Block"
image image
  1. Click on the building block you have created, Enter a name for it. Click on Done and then Save.
image
  1. Then in Building Blocks tab you can see that your building block is being deployed (Creation Pending)
image
  1. You can click on View more details to get more information like inputs and outputs of that Building Blocks.
image
  1. If you want to view the Terraform Logs during the deployment, please navigate to the "Admin Area", and select "Tenants" from the left side bar.
image

Find the Tenant that you have deployed the Building block into and Click on "View more" image

Then in the Building Blocks tab click on one the building blocks. image