> For the complete documentation index, see [llms.txt](https://www.terraform-best-practices.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.terraform-best-practices.com/id/examples/terraform/large-size-infrastructure-with-terraform.md).

# Penggunaan Terraform Untuk Infrastruktur Skala Besar

Sumber: <https://github.com/antonbabenko/terraform-best-practices/tree/master/examples/large-terraform>

Contoh di atas berisi kode sebagai ilustrasi struktur konfigurasi Terraform untuk infrastruktur ukuran besar yang mengandung hal berikut:

* 2 akun AWS
* 2 wilayah
* 2 lingkungan terpisah (`prod` dan `stage` yang tidak berbagi apa pun). Setiap lingkungan hidup di akun yang berbeda dan menjangkau sumber daya di 2 wilayah
* Setiap lingkungan menggunakan versi yang berbeda dari modul infrastruktur siap pakai (`alb`) yang berasal dari [Terraform Registry](https://registry.terraform.io/)
* Setiap lingkungan menggunakan versi yang sama dari modul internal `modules/network` yang bersumber dari direktori lokal.

{% hint style="info" %}
Pada proyek besar seperti yang dijabarkan di atas, manfaat dari penggunaan Terragrunt menjadi sangat jelas. Lihat Contoh struktur kode pada Terragrunt .
{% endhint %}

{% hint style="success" %}

* Sangat cocok untuk proyek dengan infrastruktur yang terpisah secara logis (akun AWS berbeda)
* Cocok ketika tidak ada kebutuhan untuk mengubah sumber daya bersama antar akun AWS (satu lingkungan = satu akun AWS = satu berkas keadaan)
* Bagus ketika tidak ada kebutuhan mengorkestrasi perubahan antar lingkungan
* Bagus ketika sumber daya infrastruktur sengaja dibedakan untuk setiap lingkungan dan tidak bisa digeneralisasi (Contoh beberapa sumber daya tidak ada di satu lingkungan atau beberapa wilayah)
  {% endhint %}

{% hint style="warning" %}
Seiring berkembangnya proyek, akan menjadi lebih sulit untuk menjaga supaya lingkungan-lingkungan tersebut mutakhir. Pertimbangkan untuk menggunakan modul infrastruktur (siap pakai atau internal) untuk pekerjaan yang berulang.
{% endhint %}

##


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.terraform-best-practices.com/id/examples/terraform/large-size-infrastructure-with-terraform.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
