At the end of all of these steps, we obtain the following directory tree:
To apply this Terraform configuration, you have to navigate in a command terminal to the MyApp folder containing the Terraform configuration and then execute the following Terraform workflow commands:
terraform init
terraform plan -out=app.tfplan
terraform apply app.tfplan
When executing the terraform init command, Terraform will get the module's code and hence integrate its configuration with that of the application, as shown in the following screenshot:
Finally, at the end of the execution of the terraform apply command, the value of the output is displayed in the terminal, as shown in the following screenshot:
Our Terraform configuration has therefore retrieved the output of the module and used it as the output of our main code.
In this recipe, we have shown the basics of the creation of a Terraform module and its local use. In this chapter, we will see how to generate the structure...