> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration Directory

> This lesson explores the structure and naming conventions of the Terraform configuration directory for better project organization and configuration management.

In this lesson, we explore the structure and naming conventions of the Terraform configuration directory to optimize project organization and enhance configuration management.

Previously, we worked with a single configuration file named local.tf located in the terraform-local-file directory. Below is an example demonstrating how to list the files in this directory along with the contents of local.tf:

```bash theme={null}
[terraform-local-file]$ ls /root/terraform-local-file
local.tf
```

```hcl theme={null}
resource "local_file" "pet" {
  filename = "/root/pets.txt"
  content  = "We love pets!"
}
```

Terraform supports splitting configuration across multiple files. For instance, you can create an additional file named cat.tf that introduces a new resource using the same local\_file provider:

```plaintext theme={null}
[terraform-local-file]$ ls /root/terraform-local-file
local.tf  # Note: cat.tf is now also present in the directory.
```

```hcl theme={null}
resource "local_file" "cat" {
  filename = "/root/cat.txt"
  content  = "My favorite pet is Mr. Whiskers"
}
```

<Callout icon="lightbulb" color="#1CB2FE">
  When you apply your configuration, Terraform automatically processes every file in the directory with the .tf extension. This ensures that both pets.txt and cat.txt will be created as specified.
</Callout>

It is also common practice to consolidate resource definitions into one configuration file, often named main.tf. To further organize your configuration, you can use additional files such as:

| File         | Purpose                                  |
| ------------ | ---------------------------------------- |
| variables.tf | To define input variables                |
| outputs.tf   | To specify outputs for the configuration |
| providers.tf | To configure provider settings           |

These topics will be discussed in detail later in the lesson.

Now, let's continue with practical exercises to explore working with providers.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/terraform-basics-training-course/module/df2660a4-c959-4fa7-bfa8-0700885b598e/lesson/9d45dfd4-cf12-4da1-81d0-11b37cd4ef50" />

  <Card title="Practice Lab" icon="installation" cta="Learn more" href="https://learn.kodekloud.com/user/courses/terraform-basics-training-course/module/df2660a4-c959-4fa7-bfa8-0700885b598e/lesson/d4fa4075-6b74-4223-afc4-ee20d1163098" />
</CardGroup>
