Which of the following is not a valid source path for specifying a module?
Correct Answer:
B
Terraform modules are referenced by specifying a source location. This location can be a URL or a file path. However, specifying query parameters such as ?version=vl.6.0 directly within the source path is not a valid or supported method for specifying a module version in Terraform. Instead, version constraints are specified using the version argument within the module block, not as part of the source string.
References
= This clarification is based on Terraform's official documentation regarding module usage, which outlines the correct methods for specifying module sources and versions.
You add a new provider to your configuration and immediately run terraform apply in the CD using the local backend. Why does the apply fail?
Correct Answer:
C
The reason why the apply fails after adding a new provider to the configuration and immediately running terraform apply in the CD using the local backend is because Terraform needs to install the necessary plugins first. Terraform providers are plugins that Terraform uses to interact with various cloud services and other APIs. Each provider has a source address that determines where to download it from. When Terraform encounters a new provider in the configuration, it needs to run terraform init first to install the provider plugins in a local directory. Without the plugins, Terraform cannot
communicate with the provider and perform the desired actions. References = [Provider Requirements], [Provider Installation]
What does terraform import do?
Correct Answer:
A
The terraform import command is used to import existing infrastructure into your Terraform state. This command takes the existing resource and associates it with a resource defined in your Terraform configuration, updating the state file accordingly. It does not generate configuration for the resource, only the state.
Any user can publish modules to the public Terraform Module Registry.
Correct Answer:
A
The Terraform Registry allows any user to publish and share modules. Published modules support versioning, automatically generate documentation, allow browsing version histories, show examples and READMEs, and more. Public modules are managed via Git and GitHub, and publishing a module takes only a few minutes. Once a module is published, releasing a new version of a module is as simple as pushing a properly formed Git tag1.
References = The information can be verified from the Terraform Registry documentation on Publishing Modules provided by HashiCorp Developer1.
How does Terraform determine dependencies between resources?
Correct Answer:
B
This is how Terraform determines dependencies between resources, by using the references between them in the configuration files and other factors that affect the order of operations.