Learn how infrastructure as code lets you safely build, change, and manage infrastructure. Try 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.
Go through each block of your Docker infrastructure, format your Terraform configuration, and review your infrastructure state.
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.
Destroy the Docker container you created in the previous tutorials. Evaluate the plan and confirm the destruction.
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.
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.