How would you output returned values from a child module in the Terraform CLI output?
A. Declare the output in the root configuration
B. Declare the output in the child module
C. Declare the output in both the root and child module
D. None of the above
Explanation: To output returned values from a child module in the Terraform CLI output, you need to declare the output in both the child module and the root module. The child module output will return the value to the root module, and the root module output will display the value in the CLI.
Which command must you first run before performing further Terraform operations in a working directory?
A. terraform import
B. terraform workspace
C. terraform plan
D. terraform init
Explanation: terraform init is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It initializes a working directory containing Terraform configuration files and downloads any required providers and modules. The other commands are used for different purposes, such as importing existing resources, switching between workspaces, generating execution plans, etc.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
A. With a tab
B. With two spaces
C. With four spaces
D. With three spaces
Explanation: This is the Terraform style convention for indenting a nesting level compared to the one above it. The other options are not consistent with the Terraform style guide.
When does Terraform create the .terraform.lock.hc1 file?
A. After your first terraform plan
B. After your first terraform apply
C. After your first terraform init
D. When you enable state locking
Explanation: Terraform creates the .terraform.lock.hcl file after the first terraform init command. This lock file ensures that the dependencies for your project are consistent across different runs by locking the versions of the providers and modules used.
Which method for sharing Terraform modules fulfills the following criteria:
Keeps the module configurations confidential within your organization.
Supports Terraform's semantic version constraints.
Provides a browsable directory of your modules.
A. A Git repository containing your modules.
B. Public Terraform module registry.
C. A subfolder within your workspace.
D. HCP Terraform/Terraform Cloud private registry
Explanation:
Confidentiality: Using HCP Terraform/Terraform Cloud’s private registry keeps the
module configurations within your organization, ensuring privacy and access
control.
Version Constraints: The private registry supports semantic versioning, allowing
you to manage versions of your modules as Terraform does natively.
Browsable Directory: The private registry offers a user interface to browse
modules, making it easy for users within the organization to locate and manage
modules.
This setup aligns with HashiCorp’s design for private registry support in Terraform,
meeting all listed requirements for secure, version-controlled, and searchable module
storage.
Page 1 out of 39 Pages |