module
What is module?
module: A reusable package of resources called from another configuration. The unit of composition and reuse in Terraform. A module in Terraform is a reusable package of resources. You call it from your configuration with inputs, and it creates a coherent set of infrastructure, such as a complete network or a database with its backups and firewall rules.
Frequently asked questions about module
How is module used in practice?
Modules let you define a pattern once and use it in every environment. Staging and production can call the same module with different sizes, so they stay consistent.
What should you keep in mind with module?
Public modules from the Terraform Registry can save a lot of work for common setups, but pin their version and read what they create. For your own modules, keep the inputs small and the purpose clear. A module with fifty variables is often a sign it tries to cover too many cases, and copying a little configuration is sometimes simpler than an over-general module.
What does an example of module look like?
module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "5.0.0" cidr = "10.0.0.0/16" } At a glance
| Category | Terraform |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |