DevPath · Learn to code ESPTEN

Deployment, environments and secrets

Infrastructure as code

The problem of "configuring by hand"

Creating servers, networks and databases by clicking buttons in a web console is fast the first time... and a disaster the tenth: nobody remembers what was touched, there's no way to reproduce it and recreating the environment after a failure is an odyssey.

Infrastructure as code (IaC)

IaC describes the infrastructure in text files that are versioned in Git, just like the code. Tools like Terraform or Pulumi read that description and create (or update) the real resources.

# Terraform: you declare WHAT you want, not HOW to create it
resource "google_cloud_run_service" "api" {
  name     = "my-api"
  location = "europe-west1"
}

Advantages:

DNS, domains and HTTPS

For people to type myapp.com and reach your server you need:

# Check which IP a domain resolves to
dig +short myapp.com

All of this —domains, DNS, certificates— can also be declared with IaC, so that your complete infrastructure fits, reproducible, in a repository.

Put this into practice

DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.

Start free in the app →
← Environments, configuration and secretsView the module →