It is a tool that is used for building, changing and versioning infrastructure safely and effectively. Using the configuration file you describe to Terraform what components are needed. Terraform then goes and generates an execution plan describing what the desired state should be. And then it goes and executes and builds it. Terraform manages all this through a state file. Now there are two flavors of Terraform:
Terraform supports a wide variety of cloud and infrastructure platforms. This includes AWS, OpenStack, Azure, GCP, Kubernetes and much more.
The syntax of Terraform configurations is called HashiCorp Configuration Language (HCL). It is meant to strike a balance between being human-readable and editable, and being machine-friendly. For machine-friendliness, Terraform can also read JSON configurations.
The Terraform language uses configuration files that are named with .tf
file extension. There is also a JSON-based variant of the language that is named with the .tf.json
file extension.
We will start by creating a very simple Terraform file that will pull down the image from Docker Hub and start the container. In addition, we will use input variables. They serve as parameters for a Terraform file. A variable block configures a single input variable for a Terraform module. Each block declares a single variable. And we will create a map to specify different environment variables based on conditions.
This allows us to dynamically deploy infrastructure configurations based on information we pass to the deployment.
To start with we need to set up the environment:
mkdir terraform/
cd terraform/
#terraform #infrastructure #serverless #cloud-computing #docker #devops #infrastructure-as-code #aws