Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Create a Terraform Configuration for Multi-Cloud Use

In this lab, you will create a multi-cloud Terraform configuration that can deploy an EC2 instance and/or an Azure VM. These instances are the same resource type with the same image (Ubuntu 18.04 LTS). You will use modules, variables, and outputs to accomplish this deployment. You should be able to choose which cloud environment you would like to deploy the resources to and even do the deployment simultaneously. **_Note:_** In order to complete this lab, you will need to spin up an Azure sandbox from our Cloud Playground once the lab starts. Visit [the Cloud Playground](https://learn.acloud.guru/cloud-playground/cloud-sandboxes).

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 15m
Published
Clock icon Sep 20, 2022

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create the Terraform Project

    In the AWS Console

    1. Create the AWS access key and secret access key for the cloud_user.

    In the Terminal

    1. Configure the AWS CLI with your credentials.
    2. Configure the Azure CLI.
    3. Create the eightbit_studios directory with a modules directory containing the aws_instance and azure_instance directories.
    4. Create the providers.tf file in the Terraform working directory eightbit_studio with the AWS and Azure providers.
    5. Initialize the eightbit_studio working directory.
  2. Challenge

    Create the AWS Module

    1. Create the aws_instance.tf Terraform configuration file that declares the resources necessary to create multiple EC2 instances in the .modules/aws_instance directory.
    2. Create the variables.tf Terraform configuration file that declares the variables necessary for the AWS module in the .modules/aws_instance directory. These variables should include instances, subnet, ami id, and instance type.
    3. Create the outputs.tf Terraform configuration file that declares the output necessary to output the AWS instance names for the AWS module in the .modules/aws_instance directory.
  3. Challenge

    Create the Azure Module

    1. Create the azure_instance.tf Terraform configuration file that declares the resources necessary to create multiple Virtual Machines in the .modules/azure_instance directory.
    2. Create the variables.tf Terraform configuration file that declares the variables necessary for the Azure module in the .modules/azure_instance directory. These variables should include instances, resource group name, and resource group location.
    3. Create the outputs.tf Terraform configuration file that declares the output necessary to output the Azure instance names for the Azure module in the .modules/azure_instance directory.
  4. Challenge

    Create the Root Module

    1. Create the main.tf Terraform configuration file in the 8bit_studio working directory that declares both modules. This root module should be able to pass an enable/disable selector, the number of instances, and the subnet to the AWS module, as well as pass the resource group name and resource group location to the Azure module.
    2. Create the variables.tf Terraform configuration file that declares the variables necessary for the root module in the 8bit_studio working directory. These variables should include the enable_aws and enable_azure variable for each, instance_count, aws subnet, and the Azure resource group name and location.
    3. Create the outputs.tf Terraform configuration file that declares the outputs necessary to output the AWS instance names and the Azure instance names.
  5. Challenge

    Deploy and Verify

    1. Initialize the Terraform working directory again to pull in the module information.
    2. Import the Azure resource group into your Terraform state.
    3. Deploy three EC2 instances to AWS and three VMs to Azure simultaneously.
    4. Verify that all instances have been deployed.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans