Skip to content
Français
Cloud medium

Learn Terraform with no cloud account and no credit card

2 min de lecture

Read this page in French

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

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

    Fenêtre de terminal
    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.

    Fenêtre de terminal
    terraform apply
    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
    address = "203.0.113.2"
  4. Look at the state, the concept beginners discover last although it explains almost everything.

    Fenêtre de terminal
    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.

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

    Fenêtre de terminal
    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"
Fenêtre de terminal
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.

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, 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.

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 combination is what makes learning genuinely free: the course gives the progression, feint provides the cloud to run it on.

Next steps

Is this site useful to you?

Fewer than 1% of readers support this site.

I maintain more than 700 free guides, with no ads and no tracking. Any support, even a symbolic one, helps cover hosting and keeps these resources free. Thank you for the help.

The form does not show? Open Ko-fi in a new tab.

Subscribe and follow my DevSecOps work on LinkedIn