When you specify a module from the Terraform Registry with a version constraint, what happens if a newer version that satisfies the constraint is released?
Think about how version constraints work in package managers.
Terraform Registry modules support version constraints. When you run terraform init, Terraform fetches the latest module version that matches the constraint, automatically upgrading if a newer compatible version exists.
Which of the following is the correct way to specify a module source from the Terraform Registry for the module networking/vpc/aws version 3.2.0?
Terraform Registry modules use a short source address format.
The correct source format for Terraform Registry modules is namespace/module_name/provider. The version is specified separately with the version argument.
You include two modules from the Terraform Registry in your configuration, both named database/mysql/aws, but with different versions: 1.0.0 and 2.0.0. What is the expected behavior during terraform plan and apply?
Consider how Terraform identifies modules by their source and version.
Terraform allows multiple instances of the same module with different versions by treating each as a separate module instance. Resources are managed independently.
What is the best security practice when using modules from the Terraform Registry in your infrastructure code?
Think about stability and predictability in infrastructure code.
Pinning module versions ensures your infrastructure does not unexpectedly change due to module updates, which is critical for security and stability.
If a Terraform Registry module declares a provider dependency (for example, AWS), how does Terraform handle the provider configuration when you use that module in your root configuration?
Think about how Terraform shares providers between root and modules.
Terraform expects the root configuration to configure providers. Modules declare provider requirements but do not configure them; they use the root's provider configuration.