In this post, we are going to see about the steps achieve Container(Docker) as a Code using Terraform CLI and Terraform Cloud.
We are going to use Docker provider in Terraform Registry to create docker images & docker containers.
Using Terraform CLI:
Step 1 : Write the code
Kindly create a file with using any of the file editor (say vi, nano gedit, etc.,) and enter the below contents and save the file with a name (In our case, docker_provider.tf,docker_resources.tf,variables.tf & outputs.tf)
Step 2 : Terraform Execution
Kindly execute the below commands to create a docker image and docker container.