Complete the code to declare a variable for the AWS region.
variable "region" { type = [1] }
The variable type for AWS region should be string because regions are text values.
Complete the code to assign a default value to the variable.
variable "instance_type" { type = string default = [1] }
The default value must be a string literal, so it needs quotes: "t2.micro".
Fix the error in referencing the variable in the resource block.
resource "aws_instance" "example" { ami = "ami-123456" instance_type = [1] }
var. prefix.variable.instance_type.To use a variable in Terraform, prefix it with var. like var.instance_type.
Fill both blanks to define a variable with a description and a default value.
variable "environment" { description = [1] default = [2] }
The description must be a quoted string, and the default value must also be a quoted string.
Fill all three blanks to use variables for region, instance type, and count in the resource.
resource "aws_instance" "web" { ami = "ami-0c55b159cbfafe1f0" instance_type = [1] count = [2] availability_zone = [3] }
var.region for availability zone.var. prefix.Use var.instance_type for instance type, var.count for count, and var.availability_zone for availability zone variables.