What you will learn
- Write HCL resources
- Configure providers
- Use variables and outputs
New to this? Start here
The basics, in plain English
Terraform files are written in a simple language called HCL. In it you declare resources, and a provider plugin translates those into real API calls to your cloud, like AWS or Google Cloud.
- HCL
- HashiCorp Configuration Language: the readable syntax Terraform files are written in.
- Resource
- One thing you want to create, like a server, a bucket, or a database.
- Provider
- A plugin that knows how to talk to a specific cloud (AWS, Azure, GCP).
- Variable
- A placeholder so the same config works with different values per environment.
- Output
- A value Terraform reports back after creating things, like a server’s address.
01
HCL
Terraform uses HCL to declare resources. Providers (AWS, GCP, etc.) translate them into API calls. Variables parametrize, outputs expose values.
Try it yourself
hcl
resource "aws_s3_bucket" "logs" {↳Declare an S3 bucket resource, referenced locally as “logs”. bucket = "my-app-logs"↳The actual bucket name in AWS.}↳End of the resource block.output "bucket" {↳Expose a value after apply. value = aws_s3_bucket.logs.id↳Output the created bucket’s ID.}↳End of the output block.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.