What you will get
By the end of this guide, Scaleway's real Terraform provider will have created a
server and an IP address on your machine, a second plan will report nothing
to change, and feint down will have destroyed it all. No account will have
been opened, no access key read, and nothing billed.
Feint is an emulator: a local program that imitates a cloud provider's control plane, that is, the API that creates, describes and deletes resources, without starting anything behind it. Terraform believes it is talking to the real provider, and you can practise without risk.
The whole thing takes about five minutes, half of it downloading the provider.
Why start here
A successful apply is the first signal, but it is not the one that
counts. The real test of an infrastructure described in Terraform is that it
converges: once created, a second plan must propose no change. This guide
shows you both, in that order, because that is the reflex that serves you later on
a real cloud.
Prerequisites
- Terraform 1.7 or newer, or OpenTofu. If it is not installed yet, the site's Terraform guide (in French) covers it.
- Git, to fetch the example.
- Feint, installed with one command below.
Nothing else: no account, no API key, no container engine. The emulator is a static binary holding its state in memory.
The lab, step by step
-
Install Feint.
Terminal window brew install stephrobert/feint/feintfeint versionThe output must print
v0.13.0. If you prefer the signature-verified binary, or if you do not use Homebrew, the installation page covers the other channels. -
Fetch the example, which lives in the project's repository.
Terminal window git clone https://github.com/stephrobert/feintcd feint/examples/quickstart/scalewayOnly two files sit there: a
main.tfshort enough to read whole, and afeint.yamldescribing the environment it needs. -
Check the host before starting anything.
Terminal window feint doctorRun from the stack's directory,
doctordoes more than check the port: it reads the Terraform files present and looks for the known signatures of a call that would leave for the real cloud.ok no variable measured to reroute outscale clients is set in this shellok no known escape signature in the 1 Terraform file(s) here -
Bring everything up in one command.
Terminal window feint upfeint upreads thefeint.yaml, checks what the host can deliver, starts the emulator, exports what the official client expects, runs Terraform in the directory, then waits for the conditions the file declares before handing back control.feint.yaml: scaleway, runtime off, terraform in .feint listening on 127.0.0.1:4599 (pid 3774695)- terraform init in .- Installing scaleway/scaleway v2.81.0...- terraform apply in .Apply complete! Resources: 2 added, 0 changed, 0 destroyed.- waiting: the emulator answers /instance/v1/zones/fr-par-1/serversok: http:/instance/v1/zones/fr-par-1/servers- waiting: the emulator holds a instance/serverok: resource:instance/server:1- waiting: the emulator holds a instance/ipok: resource:instance/ip:1The end of the output recaps where to find what, which saves you remembering commands or digging them out of a shell history:
up: http://127.0.0.1:4599clients: eval "$(feint env scaleway)"page: http://127.0.0.1:4599/_feint/uilogs: feint logs --addr 127.0.0.1:4599state: feint status --addr 127.0.0.1:4599proved: http:/instance/v1/zones/fr-par-1/servers, resource:instance/server:1, resource:instance/ip:1down: feint down -
Check convergence, which is the real test.
Terminal window terraform planNo changes. Your infrastructure matches the configuration.That line says something strong: the API read back the resources the way it accepted them. If a single value came back in another form, Terraform would propose a phantom change here, and you would have the same problem on the real cloud.
-
Look at what the emulator actually served.
Terminal window feint statusprovider routes driven by a clientscaleway 193 12exoscale 104 0outscale 100 0The right-hand column counts the routes a real client went through during your session: twelve here, the ones Terraform called to create then read back your two resources.
-
Destroy everything.
Terminal window feint downDestroy complete! Resources: 2 destroyed.feint: discarding 1 resource(s) (started without --state); `feint snapshot save <name>` before stopping would have kept themThe second line is not an error: the emulator reports that it is discarding a resource left in memory, and tells you how you would have kept it. An emulator that vanished silently with your data would be more annoying.
Break the lab on purpose
A testing guide must show a failure, otherwise it teaches nothing about
diagnosis. The lab has just been destroyed by feint down: the emulator is
stopped, and feint up starts it again. Open main.tf, replace the server
type (DEV1-S) with a value that does not exist, DEV1-XXL for instance,
then run the whole stack again:
feint upThe provider refuses, with the exact message could not find a server type associated with DEV1-XXL in zone fr-par-1, and the final line
feint: terraform apply: exit status 1. The emulator is what refused: the
catalogue is a closed list, and a missing type is rejected the way Scaleway
would. Note what happened before the refusal: Terraform creates resources in
dependency order, so the IP address was already created when the server
failed. This is a partial apply, and it leaves something to clean up,
exactly as on a real cloud. terraform state list returns only
scaleway_instance_ip.web, and the emulator keeps running after the
failure.
Restore the original value with git checkout -- main.tf, then destroy what
remains:
feint downDestroy complete! Resources: 1 destroyed.The order matters: this exercise is played after step 7. Replayed while the
lab is still running, the type change targets a server that already exists, and
the error is a different message (cannot change server type), with no IP
created before the failure.
A nonexistent image identifier, on the other hand, would pass, and that is a deliberate limit the limits page explains.
That is already a useful lesson: this lab proves your configuration is well formed, not that every value it names exists somewhere.
What this lab proves
A lab is only worth what it actually establishes. Four findings are demonstrated by the steps above:
- The real Terraform provider can talk to the emulator, in its pinned version
2.81.0. - Your configuration creates then reads back its resources consistently.
- The state converges: the second plan is empty.
- Destruction works, and the cleanup is complete.
What it does not prove
The limits matter as much as the proofs, because they say where what the emulator can guarantee stops. Three things are not established:
- No machine started. This lab runs in control-plane mode: the API describes a server, nothing runs behind it. The real machines guide shows the other half.
- The values are not the real cloud's: neither pricing, nor quotas, nor available capacity.
- Nothing was authenticated. The exported credentials are well formed and fictitious, and the emulator verifies no signature.
Key takeaways
- A successful
applyis not enough: the test that matters is a secondterraform planthat answers "No changes". - Feint emulates the provider's control plane on your machine: the real Terraform provider runs, with no account and no access key.
- The
feint up,terraform plan,feint downcycle creates, checks convergence, then destroys without leftovers. - The lab proves the configuration is well formed and converges, not that the values it names exist at the real provider, nor that a machine started.
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
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
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Operating a cloud environment day to day
Continue the course: Wiring the official Scaleway, Outscale and Exoscale CLIs
A new full quiz with random questions
Work again only on the questions you missed