Closed3

Terraform

gnllagnlla

インストール

brew install tfenv

tfenv install latest

tfenv use 1.2.6
gnllagnlla

Quick start tutorial

provision an NGINX server using Docker

open -a Docker

mkdir learn-terraform-docker-container

cd learn-terraform-docker-container

touch main.tf
main.tf
terraform {
  required_providers {
    docker = {
      source  = "kreuzwerker/docker"
      version = "~> 2.13.0"
    }
  }
}

provider "docker" {}

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

resource "docker_container" "nginx" {
  image = docker_image.nginx.latest
  name  = "tutorial"
  ports {
    internal = 80
    external = 8000
  }
}
terraform init

terraform apply

terraform destroy
このスクラップは2022/08/02にクローズされました