Files
nexus/wiki/sources/ctp-topic-48-terraform-vs-terragrunt.md
2026-04-20 00:02:56 +08:00

50 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "CTP Topic 48 Terraform vs Terragrunt"
type: source
tags: [Terraform, Terragrunt, IaC, CTP]
date: 2026-04-14
---
## Source File
- [[raw/Cloud & DevOps/Public-Cloud-Learning-Sessions/03_Terraform/ctp-topic-48-terraform-vs-terragrunt.md]]
## Summary
- 核心主题Terraform 与 Terragrunt 的对比与选型
- 问题域基础设施即代码IaC工具选择企业级多环境部署管理
- 方法/机制Terraform 提供声明式配置和状态管理Terragrunt 作为包装器实现 DRY 原则和变量复用
- 结论/价值Terraform 适合单一环境Terragrunt 适合多环境企业级部署
## Key Claims
- Terraform 是云无关的基础设施即代码工具,通过状态文件将期望状态与实际环境关联
- Terragrunt 是 Terraform 的轻量级包装器,遵循 DRY 原则实现配置复用
- Terragrunt 可以重复使用信息而无需硬编码值,管理 provider 和 remote state 块
- Terraform Enterprise 是包含工作区的 CI 平台
- Gruntwork 提供预构建可定制模块和 Terraform 原生 AWS Landing Zone
## Key Quotes
> "Terraform 是 Golang 应用程序,用于跨各种环境配置、变更和版本控制资源"
> "Terragrunt 提供一种可重复使用信息而不硬编码值的方式"
## Key Concepts
- [[Terraform]]:基础设施即代码工具,通过声明式配置定义云资源
- [[Terragrunt]]Terraform 的包装工具,提供模块化和变量共享
- [[Infrastructure as Code (IaC)]]:通过代码实现基础设施管理的一致性和版本控制
- [[State File]]Terraform 用于将期望状态关联到实际环境的文件
## Key Entities
- [[HashiCorp]]Terraform 的开发商
- [[Gruntwork]]:提供预构建 Terraform 模块和 Landing Zone
- [[Atlantis]]:集成 Terraform 与 GitHub 的开源 CI/CD 工具
## Connections
- [[Terraform]] ← wraps ← [[Terragrunt]]
- [[Terragrunt]] ← uses ← [[Infrastructure as Code (IaC)]]
- [[Gruntwork Landing Zone]] ← built_with ← [[Terraform]]
## Contradictions
-
---
## 相关资源
- NAS: /volume2/work/Public Cloud Learning Sessions/CTP _ Topic 48_ Terraform vs Terragrunt.mp4