Interested to try out various Terraform commands and see how they work?
Welcome to our Terraform playground!
It is the perfect place to get hands-on experience with Terraform almost instantly! No need to rent servers or install complicated software. You get access to everything in your web browser.
What is Terraform?
Terraform is an infrastructure provisioning tool. It helps automate the process of creating and managing infrastructure using configuration files.
To provision infrastructure in Terraform, we follow three main steps: write, plan & apply.
- Writing: In the writing stage, we define the infrastructure we want in a Terraform configuration file.
- Planning: After writing our Terraform configuration, we use the "terraform plan" command to preview the changes that will be made to our infrastructure. We use this step to verify that the changes are correct before applying them.
- Applying: The final step in the process is to use the "terraform apply" command to apply the changes defined in the execution plan. This will create/change the infrastructure to match the desired state defined in the configuration file.
Terraform consists of two essential parts: the core & the providers.
- Core: Terraform is powered by an engine called Terraform core. The core is the Terraform binary (program) that provides all the basic functionality.
- Providers: Terraform uses providers (plugins) to interact with different infrastructure providers, such as AWS, Azure, or Google Cloud. The providers handle all the logic required to authenticate with the providers and make API requests on our behalf. They also handle timeouts and errors that may occur during resource management.
Our playground includes Visual Studio Code (a code editor) and comes pre-installed with Terraform.
In this playground, you can practice using Terraform without worrying about making mistakes. If you do happen to make a mistake, or if anything breaks, don’t worry! You can simply restart the playground and start over.
Getting Started With the Playground
Before you can start working with Terraform, you have first to initialize Terraform. cd into the terraform-projects directory and run terraform init. After Terraform is successfully initialized, you can start working with it.
Here are some examples of commands you can try in the playground:
- terraform plan: This will show you what changes Terraform will make to apply the plan.
- terraform apply: This will apply the execution plan and create the resources in your infrastructure.
- terraform list: This will display a list of resources that are managed by Terraform.
- terraform show: This will show you the details of the resources you have created.
- terraform destroy: This will destroy the resources that you have created.
To view all Terraform commands, run terraform -help.
Note that you can use the playground for 1 hour. If required, you can extend the usage by 15 minutes by clicking on the icon next to the timer icon.
So, give it a try and see what you can create with Terraform!