learn-terraform

Course outlines for learning terraform.

View the Project on GitHub robertdebock/learn-terraform

Use cases

expected time requirements
120 minutes A computer with Terraform installed, terraform knowledge.

Goal: Write Terraform code for the cloud provider of your choice.

Explanation

We’ll try some experiments. Some of these experiments take some time to finish, maybe you’ll run into issues. Don’t worry, share your screen to troubleshoot together.

Pick the easiest use case first.

Howto

Use case 1

Use cloud-init in the Terraform code (hint to do these things on a newly generated system:

Use case 2

Add a resource manually, import and try to expand the memory.

Use case 3

How do you organize variables so that you have the least amount of locations to define variables, but keep flexibility.

For example:

Use case 4

Write Terraform code to:

        +--- loadbalancer1 ---+
        | Listening on ports: |
        |   - port 80         |
        |   - port 443        |
        +---------------------+
               |         |
               V         V
+--- instance1 ---+   +--- instance2 ---+
| Linux:          |   | Linux:          |
|   - apache      |   |   - apache      |
+-----------------+   +-----------------+

The image above leaves some room for interpretation. If you’re done, you should be able to:

  1. Visit the IP address of the loadbalancer in your browers.
  2. Get service a page (likely default) from instance1 or instance2.

Use case 5

You’ve written Terraform code, see what items can be moved to a module and rewrite your code to use these modules.

Questions