• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Tutorials

Skip to main contentTutorials

Get Started

  • AWS
  • Azure
  • Docker
  • GCP
  • OCI
  • Terraform Cloud

Fundamentals

  • CLI
  • Configuration Language
  • Modules
  • Provision
  • State
  • Terraform Cloud

Use Cases

  • Applications
  • AWS Services
  • Azure Services
  • HashiCorp Products
  • IT/SaaS Providers
  • Kubernetes
  • Machine Images
  • Networking
  • Policy
  • Security

Certification Prep

  • Associate Prep (002)
  • Associate Prep (003)
  • Associate Tutorials (002)
  • Associate Tutorials (003)

Production

  • Automate Terraform
  • Enterprise Patterns
  • Terraform Enterprise

Integrations

  • CDK for Terraform
  • Community Providers
  • Custom Framework Providers
  • Custom SDK Providers
  • Secrets

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Tutorials
  4. Modules

Reuse Configuration with Modules

Create and use Terraform modules to organize your configuration. Host a static website in AWS using two modules: one from the Terraform Registry and one you will build yourself. Organize configuration using directories and workspaces.

Start
10 tutorials
  •  
    7min
    Modules Overview
    Read about how Terraform modules make configuration easier to organize, understand, reuse, and share. Learn about the directory structure of a module, and how to call them.
    • Terraform
  •  
    12min
    Use Registry Modules in Configuration
    Use modules from the public Terraform Registry to define an Amazon VPC containing two EC2 instances. Select module and root input and output variables, install the modules, and apply the configuration.
    • Terraform
    • Interactive
  •  
    15min
    Build and Use a Local Module
    Write a local module to create an Amazon S3 bucket hosting a static website. Create a module directory, write the module configuration, variables, and outputs, and call the module from a root configuration.
    • Terraform
    • Interactive
  •  
    16min
    Customize Modules with Object Attributes
    Refactor a local module to organize related attributes with objects and make some attributes optional for module users.
    • Terraform
  •  
    7min
    Share Modules in the Private Registry
    Import modules to share securely in Terraform Cloud's free private registry. Fork an example module, tag a version-controlled release, deploy the module into the registry, and use it in a configuration.
    • Terraform
  •  
    5min
    Add Public Providers and Modules to your Private Registry
    Curate modules and providers in your private registry. Track approved modules and providers for your organization's use.
    • Terraform
  •  
    18min
    Refactor Monolithic Terraform Configuration
    Deploy development and production versions of an S3-hosted static website. Separate their configuration into files, directories, and workspaces, and explore the architectural trade-offs of each approach.
    • Terraform
    • Interactive
  •  
    17min
    Module Creation - Recommended Pattern
    Learn the architectural recommendations for module creation distilled from engagements with large enterprises using Terraform. Use Terraform module best practices to scope, build, improve and consume Terraform modules.
    • Terraform
  •  
    14min
    Use Configuration to Move Resources
    Use the configuration-driven workflow to change Terraform resource IDs. Refactor configuration to move resources into modules using the `moved` block.
    • Terraform
  •  
    9min
    Create and Use No-Code Modules
    Use Terraform Cloud no-code modules to let users provision resources without writing Terraform configuration.
    • Terraform
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)