Using Terraform CLI, how do you download module source codes in order to be able to look at how the module is implemented and copy the examples easily?
Experience Level: Junior
Tags: Terraform
Answer
Run the following command:
terraform init -from-module source
Example:
terraform init -from-module Azure/vnet/azurerm
The code above will download source codes of the module Azure/vnet/azurerm.
Related Terraform job interview questions
You modified your Terraform configuration and switched from local backend to remote backend by modifying main.tf file. What do you need to migrate the local state to the remote backend?
Terraform JuniorUsing Terraform CLI, how you upgrade all referenced modules and providers to versions allowed within configured constraints?
Terraform JuniorWhat does 'terraform init' command do?
Terraform JuniorWhat is the first Terraform CLI command that you need to execute after you pull Terraform configuration from your version control system?
Terraform JuniorHow do you get a version of Terraform CLI that you have currently installed?
Terraform Junior