The easiest way to start experimenting with Terraform is by deploying local resources in Docker. To install Docker on Mac, run brew install docker first.

Here’s the code I used to deploy an Nginx dontainer on my Mac:

terraform {
  required_providers {
    docker = {
      source  = "kreuzwerker/docker"
      version = "3.0.2"

provider "docker" {
    host = "unix:///var/run/docker.sock"

resource "docker_image" "nginx" {
  name         = "nginx:latest"
  keep_locally = false

resource "docker_container" "nginx" {
  image = docker_image.nginx.image_id
  name  = "tutorial"
  ports {
    internal = 80
    external = 8000
terraform apply

To verify, go to http://localhost:8000 to see the Nginx test page.

You can also run docker ps to see your running containers.

CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS                  NAMES
2a719d839dfa   2a4fbb36e966   "/docker-entrypoint.…"   7 minutes ago   Up 7 minutes>80/tcp   tutorial

If you are looking for an easy way to host a simple website, I recommend hosting Hugo on S3.