Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Learn Terraform with no cloud account and no credit card

By updated

Improve this page

What you will get

By the end of this guide, you will have written a Terraform configuration, applied it, changed it, broken it and fixed it, as many times as you like, on your own machine. You will have seen what a variable, an output, a dependency between resources, a state and a convergence are, and you will have read a real provider error.

All of it with no cloud account, no API key, no credit card and no waiting for a machine to be provisioned.

Why learn this way

Learning Terraform costs, and not only money. Opening an account, generating keys, understanding billing and remembering to destroy everything before closing your laptop: those obstacles come before the first line of HCL, and they discourage you exactly when you should be experimenting.

Yet learning Terraform is mostly about repeating. Write, apply, get it wrong, start again. A loop that costs a few cents and two minutes of waiting is a loop nobody dares to run twenty times in an evening. Here it is free and instant, and that changes how you learn.

Prerequisites

Nothing else. If you have never run the emulator before, start with the getting started guide: this one assumes feint start already works on your machine.

The learning loop

The loop has six steps, to replay as often as you like, from the started emulator to the change of a variable. It closes with a cleanup, described after the "Break it, then fix it" exercise.

  1. Start the emulator and wire the client, once for the whole work session.

    Terminal window
    feint start
    eval "$(feint env scaleway)"
  2. Write a configuration with a variable and an output. Both notions come early in any course, and they are clearer on an example you can re-run than in a definition.

    variable "name" {
    type = string
    default = "web"
    description = "Server name"
    }
    resource "scaleway_instance_ip" "web" {}
    resource "scaleway_instance_server" "web" {
    name = var.name
    type = "DEV1-S"
    image = "ubuntu_jammy"
    ip_id = scaleway_instance_ip.web.id
    }
    output "address" {
    value = scaleway_instance_ip.web.address
    }

    The line that matters pedagogically is ip_id = scaleway_instance_ip.web.id: it does not merely pass a value, it creates a dependency. Terraform works out on its own that the address must be created before the server.

  3. Apply, and read the output.

    Terminal window
    terraform apply
    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
    address = "203.0.113.2"
  4. Apply a second time, to watch convergence. Change nothing, just run the same command again.

    Terminal window
    terraform apply
    No changes. Your infrastructure matches the configuration.
    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

    This is convergence: Terraform compares what the configuration asks for with what exists, finds no difference and does nothing. This property, called idempotence, is what makes an apply safe to replay, and an empty plan is the sign that the infrastructure has "arrived".

  5. Look at the state, the concept beginners discover last although it explains almost everything.

    Terminal window
    terraform state list
    scaleway_instance_ip.web
    scaleway_instance_server.web

    The state is Terraform's memory: what it believes it created, and under what name. It is by comparing it with the real world that it decides what to do.

  6. Change a variable, and read the plan before applying.

    Terminal window
    terraform plan -var 'name=web-02'
    ~ update in-place
    ~ resource "scaleway_instance_server" "web" {
    ~ name = "web" -> "web-02"
    Plan: 0 to add, 1 to change, 0 to destroy.

    Three pieces of information in four lines: the change is an in-place update, it touches one resource only, and nothing will be destroyed. Learning to read that summary before every apply is the most useful habit you can build, and it serves you just as well on a real account.

Break it, then fix it

Learning without errors prepares you for nothing. Change the server type to a value that does not exist:

type = "DEV1-XXL"
Terminal window
terraform apply
Error: cannot change server type: scaleway-sdk-go: could not find server type "DEV1-XXL"

Take the time to read that error in full, because it teaches you three things. It comes from the Scaleway SDK, not from Terraform: the provider is what refuses. It names the offending value, which is not always the case. And it arrived at apply time, not at plan time: Terraform could not know that type does not exist, only the API knows.

Put DEV1-S back, run it again, and the infrastructure comes back. You have just done for free what, on a real account, could have created a machine billed by the hour.

Clean up to start from scratch

A learning loop ends with a cleanup, otherwise the next session starts on the leftovers of the previous one. Two commands are enough, in this order: Terraform destroys first the resources it created, while the emulator still answers, then you stop the emulator.

Terminal window
terraform destroy
feint stop
Destroy complete! Resources: 2 destroyed.

The order matters: an emulator stopped first would no longer answer, and Terraform could no longer destroy anything. On a real account, this same destroy is what saves you from a forgotten bill. Since the emulator keeps its resources in memory, feint stop brings you back to a blank state: the next session starts from a clean feint start.

What this practice ground really teaches you

The skills below transfer unchanged to a real cloud account, because they belong to Terraform rather than to the emulator.

  • The HCL language: blocks, variables, outputs, expressions.
  • The dependency graph, and how a reference builds it.
  • The lifecycle: creation, in-place update, replacement, destruction.
  • The state and its relationship with the real world.
  • Idempotence: applying twice must change nothing the second time.
  • Reading a plan, which is the most profitable skill of the lot.

What it does not teach you

  • Pricing and billing, which are simulated nowhere here.
  • Quotas and a zone's real capacity, which stay decorative values.
  • Delays: here a machine reaches the started state immediately by default, where a real cloud takes a minute and sometimes makes your configuration wait.
  • IAM permissions, since the emulator accepts any identity without ever verifying it.

None of these limits stops you from learning the language and the model. They only tell you when to move to a real account: when you want to learn operations rather than the tool. The full boundary, established row by row with what proves each verdict, is in What Feint proves.

Carry on with the Terraform course

This guide gave you a practice ground, not a curriculum. To learn Terraform in order, from the language to modules, remote state and environments, this site offers a complete course you can now follow without opening a cloud account: just point its examples at the emulator, exactly as you did here.

That course is the site's Terraform course (in French), which leads up to the certifications. That combination is what makes learning genuinely free: the course gives the progression, Feint provides the cloud to run it on.

Within this Feint course, the next steps stay on the emulator: the lesson Test a Terraform configuration moves from two resources to realistic configurations on all three providers, and a feint.yaml declaration then lets others replay your lab with one command.

Key takeaways

  • An emulator makes the learning loop free and instant: write, apply, break, fix, as many times as needed.
  • A reference such as ip_id = scaleway_instance_ip.web.id creates a dependency, and Terraform works out the creation order on its own.
  • A second apply with no change does nothing: that is convergence, and an empty plan says the infrastructure has arrived.
  • The loop closes with terraform destroy then feint stop, in that order, to start again from a blank state.
  • The state is Terraform's memory: what it believes it created, which it compares with the real world to decide what to do.
  • Read the plan before every apply: in-place update, number of resources touched, any destruction.
  • A value the API does not know fails at apply, not at plan, because only the API knows its catalogue.
  • Pricing, quotas, real delays and IAM are not learned here: they need a real account.

Knowledge check

Check that the essentials of this lesson are in place. The questions only cover what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer