Complete the code to initialize a Terraform working directory.
terraform [1]The terraform init command initializes the working directory containing Terraform configuration files. It downloads necessary provider plugins and prepares the environment.
Complete the code to create an execution plan without applying changes.
terraform [1]The terraform plan command shows the changes Terraform will make to your infrastructure without applying them. It helps review changes safely.
Fix the error in the backend configuration block to enable remote state storage.
terraform {
backend "[1]" {
bucket = "my-terraform-state"
region = "us-west-2"
}
}The backend type s3 configures Terraform to store state files in an AWS S3 bucket, enabling team collaboration and remote state management.
Fill both blanks to configure a workspace and select it for isolated environments.
terraform [1] [2]
Use terraform workspace select to switch to an existing workspace. Workspaces allow managing multiple environments like dev and prod separately.
Fill all three blanks to output the value of an instance's public IP after apply.
output "instance_ip" { value = [1].[2].[3] }
This output block references the public_ip attribute of the my_server resource of type aws_instance. It shows the public IP after deployment.