Infrastructure as Code

ConnectPrivatet

After understanding about the three components in the architecture, we can easily structure our source code to build infrastructure.

In this step, we will use Terraform to sequentially build modules such as Networking, Compute, and Load Balancing.

  1. First, let’s create a folder and name it whatever you want. Open the terminal and type cd to navigate to where you want to create a folder. Using the mkdir command to create a folder.
  • You can see that I create a folder and named it Deploy-Infrastructure. You can create a folder anywhere on your computer and name whatever you want.

ConnectPrivate

  1. Then, you can type the following command to open the folder you just created without opening Visual Studio Code.
code <yourfolder>
  • In my case, it would be like below.

ConnectPrivate

  1. After you run the command, a Visual Studio Code tab will suddenly appear on the computer.

ConnectPrivate

  1. Let begin structure our working directory. Create two folders and name them respectively as modules and terraform. You can do this using either the terminal in Visual Studio Code or choosing New Folder on Visual Studio Code.

ConnectPrivate

ConnectPrivate

Right now, our working directory looks like this.

DEPLOY-INFRASTRUCTURE
├── modules
├── terraform
  1. In the modules folder, create three folders and name them respectively as Networking, Compute, and Load Balancing.

ConnectPrivate

  1. We have successfully structured our working directory. Let’s go on each modules and build source code to provision infrastructure.

Right now, our working directory looks like this.

DEPLOY-INFRASTRUCTURE
├── modules
|   |── Compute
|   |── LoadBalancing
|   |── Networking
├── terraform

Now, let’s move on each modules to build our infrastructure.

Content

  1. Networking
  2. Compute
  3. Load Balancing
  4. Terraform