Complete the code to initialize Terraform before applying changes.
terraform [1]Terraform must be initialized with terraform init to download providers and set up the working directory before applying any changes.
Complete the code to preview infrastructure changes without applying them.
terraform [1]terraform plan shows what changes Terraform will make without applying them. This helps catch mistakes early.
Fix the error in the Terraform configuration to ensure resource names are unique.
resource "aws_instance" "[1]" { ami = "ami-12345678" instance_type = "t2.micro" }
The resource name must be a unique identifier like webserver. Using generic names like 'resource' or 'aws_instance' causes conflicts.
Fill both blanks to create a variable with a default value and use it in the resource.
variable "[1]" { type = string default = "t2.micro" } resource "aws_instance" "example" { ami = "ami-12345678" instance_type = var.[2] }
The variable name instance_type is declared and then referenced as var.instance_type in the resource to set the instance type.
Fill all three blanks to output the public IP of an AWS instance after deployment.
output "[1]" { value = aws_instance.[2].[3] }
The output named instance_ip shows the public_ip attribute of the AWS instance named example.