Terraform Associate Practice Exam

Session length

1 / 400

Which command is primarily used to create a new resource in Terraform?

terraform plan

terraform apply

The command primarily used to create a new resource in Terraform is `terraform apply`. This command is responsible for applying the planned changes that Terraform generates based on the configuration files you have defined. When you run `terraform apply`, Terraform will create, modify, or delete resources in your cloud provider's environment to match the desired state specified in your configuration files.

Before actually applying any changes, `terraform apply` may prompt the user to confirm the execution of the planned actions. This provides an opportunity to review changes before they are implemented. If the resources do not already exist, this command will create them, effectively setting up the infrastructure that your Terraform configuration describes.

The other commands serve different purposes. For instance, `terraform plan` generates an execution plan that shows what actions Terraform will take but does not actually create any resources. `terraform init` is used to initialize a Terraform working directory and prepare it for other commands, while `terraform destroy` is intended to remove existing resources rather than create them. Thus, `terraform apply` is the correct answer for creating new resources in Terraform.

Get further explanation with Examzify DeepDiveBeta

terraform init

terraform destroy

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy