Build, change, and destroy Docker infrastructure using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
Learn how infrastructure as code lets you safely build, change, and manage infrastructure. Try Terraform.
9min
Install Terraform
Install Terraform on Mac, Linux, or Windows by downloading the binary or using a package manager (Homebrew or Chocolatey). Then create a Docker container locally by following a quick-start tutorial to check that Terraform installed correctly.
10min
Build Infrastructure - Terraform Docker Example
Go through each block of your Docker infrastructure, format your Terraform configuration, and review your infrastructure state.
4min
Change Infrastructure
Modify Docker container configuration to use a different external port. Plan and apply the changes to re-provision a new container that reflects the new configuration. Learn how Terraform handles infrastructure change management.
2min
Destroy Infrastructure
Destroy the Docker container you created in the previous tutorials. Evaluate the plan and confirm the destruction.
4min
Define Input Variables
Declare your Docker container name as a variable. Reference the variable in Terraform configuration. Define variables using command line flags, environment variables, .tfvars files or default values.
5min
Query Data with Outputs
Declare output values to display a Docker containers name and ID. Display all outputs and query specific outputs. Define what data stored in Terraform state is relevant to the operator or end user.