Category: Kubernetes, Terraform, container, Hashicorp

by Using the configuration file you describe to Terraform what components are needed.

We will start by creating a very simple Terraform file that will pull down the image from Docker Hub and start the container.

To start with we need to set up the environment: Now, we need to create variable file: With the following content: Then we need to create a Terraform script in order to download the latest Ghost image and run container using described variables: With the following content: Next step would be to initialize new Terraform configuration: And validate main.tf file: Then we need to generate and see dev execution plan: Here are some useful flags for plan:-out=path: Writes a plan file to the given path. This can be used as input to the apply command.-var foo=bar: This sets a variable in the Terraform configuration.

Related Articles