Skip to main content
A complete walkthrough: define a compute instance in Terraform, apply it, connect over SSH, and serve a web page with Nginx.
New to the provider? Run through the Quickstart and Authentication first — this guide assumes Terraform is installed and STRETTCH_CLOUD_API_KEY is set.

What you’ll build

  • A compute instance with a public IP
  • SSH access with your own key
  • Nginx serving a page over HTTP
1

Set up the project

Create a new directory with three files:
2

Provide your credentials

Set your API key and keep your SSH public key handy:
Don’t have an SSH key yet? Generate one with ssh-keygen, then your public key is at ~/.ssh/id_ed25519.pub. See SSH Keys for the full walkthrough.
3

Initialize and apply

Download the provider and create the instance, passing your public key in:
Review the plan, type yes, and Terraform prints the public_ip when the instance is up.
4

Connect over SSH

Strettch Cloud exposes SSH on port 222. Connect as root:
5

Install Nginx

On the instance, install and start Nginx:
Replace the default page with your own:
6

Verify

Open http://<your-public-ip> in a browser — you’ll see your page. Your web server is live, defined entirely in Terraform.
7

Tear it down

When you’re finished, destroy everything you created:

Make it repeatable

Because the whole server is now described in code, you can:
  • Version it — commit main.tf, variables.tf, and outputs.tf to Git.
  • Review changes — run terraform plan before every change to see exactly what will happen.
  • Reproduce it — apply the same files to stand up an identical instance any time, or for a second environment.
Avoid hardcoding image, region, or specification. Look them up as data sources instead — see Look up catalog values in the Quickstart.

Next steps

Resources & data sources

The full catalog of what the provider can manage.

Full reference

Every argument and attribute on the Terraform Registry.