nerdexam
GIAC

GSEC · Question #258

Which Terraform command should be run immediately after creating a new configuration file for a cloud-based virtual machine?

The correct answer is A. Init. The first Terraform command after creating a new configuration is 'init', which prepares the working directory and downloads required providers and modules.

Cloud, Web, and Application Security

Question

Which Terraform command should be run immediately after creating a new configuration file for a cloud-based virtual machine?

Options

  • AInit
  • BBuild
  • CApply
  • DCommit

How the community answered

(48 responses)
  • A
    73% (35)
  • B
    4% (2)
  • C
    17% (8)
  • D
    6% (3)

Why each option

The first Terraform command after creating a new configuration is 'init', which prepares the working directory and downloads required providers and modules.

AInitCorrect

'terraform init' initializes the working directory by downloading and installing the provider plugins and modules declared in the configuration. It must be run before any other Terraform commands because it sets up the backend and the dependency lock file required for planning and applying changes.

BBuild

'build' is not a valid Terraform CLI subcommand and does not exist in the Terraform workflow.

CApply

'terraform apply' provisions infrastructure but cannot run successfully before 'terraform init' has initialized the providers and configured the backend.

DCommit

'commit' is a Git version control command and is not part of the Terraform CLI workflow.

Concept tested: Terraform workflow initialization command

Source: https://developer.hashicorp.com/terraform/cli/commands/init

Topics

#Terraform#IaC#cloud provisioning#terraform init

Community Discussion

No community discussion yet for this question.

Full GSEC Practice