This lesson uses Terraform v0.13. Ensure you download the correct version for your operating system.
Installing Terraform 0.13 on Linux
Follow these steps to install Terraform 0.13 on a Linux system:- Open your terminal.
- Download the Terraform 0.13 binary.
- Unzip the downloaded file.
- Move the Terraform executable to
/usr/local/binso that it is accessible from anywhere. - Verify the installation by checking the Terraform version.
Working with Terraform
After installing Terraform, you can begin deploying resources using configuration files written in the HashiCorp Configuration Language (HCL). These files have a.tf extension and can be edited with any text editor or IDE.
For example, consider the following HCL snippet that defines an AWS EC2 instance resource:
Understanding Terraform Resources
A resource in Terraform represents an object managed by the tool. This can range from local files to virtual machines, cloud services, and beyond. Here’s a quick overview of some common resource types:| Resource Type | Description | Example |
|---|---|---|
| EC2 Instance | Virtual machine on AWS | aws_instance |
| S3 Bucket | Cloud storage on AWS | aws_s3_bucket |
| IAM Role | Access management in AWS | aws_iam_role |
Getting Started with Simple Resources
In the initial sections of this lesson, we focus on two simple resource types:- A local file resource.
- A special resource called a random pet.
With these basic concepts in hand, you’re now ready to explore more advanced Terraform configurations and resource management techniques.