0
0
Terraformcloud~30 mins

Resource types and names in Terraform - Mini Project: Build & Apply

Choose your learning style9 modes available
Terraform Resource Types and Names
📖 Scenario: You are setting up a simple cloud infrastructure using Terraform. You need to define resources with correct types and names to create a virtual machine and a storage bucket.
🎯 Goal: Build a Terraform configuration that defines an aws_instance resource named web_server and an aws_s3_bucket resource named app_bucket.
📋 What You'll Learn
Create an aws_instance resource with the name web_server.
Create an aws_s3_bucket resource with the name app_bucket.
Use valid Terraform syntax for resource blocks.
Use the exact resource types and names as specified.
💡 Why This Matters
🌍 Real World
Terraform is widely used to automate cloud infrastructure setup. Defining resources with correct types and names is the first step to managing cloud services like virtual machines and storage.
💼 Career
Cloud engineers and DevOps professionals use Terraform daily to create and maintain infrastructure as code, ensuring consistent and repeatable deployments.
Progress0 / 4 steps
1
Create an AWS instance resource
Create a Terraform resource block for an AWS instance with the resource type aws_instance and the resource name web_server. Set the ami attribute to "ami-12345678" and the instance_type attribute to "t2.micro".
Terraform
Need a hint?

Use the resource keyword, then the resource type aws_instance, followed by the resource name web_server in quotes.

2
Create an S3 bucket resource
Add a Terraform resource block for an AWS S3 bucket with the resource type aws_s3_bucket and the resource name app_bucket. Set the bucket attribute to "my-app-bucket".
Terraform
Need a hint?

Use the resource keyword with type aws_s3_bucket and name app_bucket. Set the bucket attribute inside.

3
Add tags to the AWS instance
Inside the aws_instance resource named web_server, add a tags block with a tag Name set to "WebServerInstance".
Terraform
Need a hint?

Use a tags block with key-value pairs inside the aws_instance resource.

4
Add versioning to the S3 bucket
Inside the aws_s3_bucket resource named app_bucket, add a versioning block with enabled set to true.
Terraform
Need a hint?

Use a versioning block inside the aws_s3_bucket resource with enabled = true.