Your First Resource
A resource block declares a piece of infrastructure you want Terraform to manage. Its two labels are the resource type and a local name you choose:
resource "aws_s3_bucket" "example" {
bucket = "my-unique-bucket-name"
}
aws_s3_bucket— the type, provided by the AWS provider.example— your name for it, used to reference it elsewhere (aws_s3_bucket.example.id).
Each mini lesson opens with your configuration as the one before it left it. Every run starts from a clean sandbox, like a CI job, so no state carries between runs.
Interview prep
Two things to be fluent in before a first infra interview.
What's the difference between validate and plan?
validate is an offline syntax/consistency check. plan resolves the provider and computes the diff between your configuration and reality, printing what it would add/change/destroy — still without making any changes.
In resource "aws_s3_bucket" "first", what are the two labels?
The first is the resource type (aws_s3_bucket, provided by the AWS provider); the second is your local name (first), used to reference the resource elsewhere as aws_s3_bucket.first.<attr>.