Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Terraform in Yandex Cloud
  • Getting started
    • Overview
    • Providers
    • Resources
    • Data sources
    • Modules
    • States
  • Solution library
  1. Concepts
  2. Modules

Modules

Written by
Yandex Cloud
Updated at August 7, 2025

Modules in Terraform are a code organization tool that allows you to break down a larger infrastructure into smaller, manageable parts.

A module is a separate file with code describing a specific part of your infrastructure. It may contain resources, variables, input parameters, and other elements you need to create and manage infrastructure.

Terraform modules offer multiple benefits:

  • Code reuse. You can use modules across different projects, which eliminates code duplication and streamlines development.
  • Code organization. Splitting infrastructure into modules improves code organization and readability.
  • Testing. You can test each module independently, which simplifies debugging and improves infrastructure reliability.

To create a module, follow these steps:

  1. Create a new .tf or .tf.json file.
  2. Define input parameters for calling the module.
  3. Describe resources and configurations the module should create.
  4. Call the module from the main configuration file using the module command.

Module use case:

module "vpc" {
  source = "./modules/vpc"

  cidr_block = "10.0.0.0/16"
}

In this example, we call the vpc module located in the ./modules/vpc file. The module accepts the cidr_block input parameter defining the IP address range for the cloud network.

See alsoSee also

Yandex Cloud Terraform modules

Was the article helpful?

Previous
Data sources
Next
States
© 2025 Direct Cursus Technology L.L.C.