Hướng dẫn thử thách
1 / 110
-replace option in apply
### Giai đoạn: Nền Tảng & Khái Niệm Cốt Lõi
**-replace option in apply**
The `-replace` flag in Terraform is used with the apply or plan command to force the replacement of a specific resource by tainting the resources. This flag instructs Terraform to delete and recreate the specified resource instead of updating it in place. It's useful when you need to regenerate a resource completely, such as when certain attributes can't be modified after creation. The flag is typically used when Terraform can't automatically detect that a resource needs replacement, or when you want to force a replacement for testing or troubleshooting purposes. While powerful, this flag should be used cautiously, especially with stateful resources, as it can lead to data loss. It's often employed in scenarios where in-place updates are not sufficient to achieve the desired configuration state of a resource.
### Khái niệm cốt lõi:
1. **This flag instructs Terraform to delete and recreate the specified resource instead of updating it in place**
2. **While powerful, this flag should be used cautiously, especially with stateful resources, as it can lead to data loss**
### Tài liệu tham khảo chính thống:
- [Forcing Re-creation of Resources](https://developer.hashicorp.com/terraform/cli/state/taint) (official)
- [Terraform Taint, Untaint, Replace – How to Use It (Examples)](https://spacelift.io/blog/terraform-taint) (article)
- [Terraform Taint Is Bad Actually - Use Replace Instead](https://www.youtube.com/watch?v=v_T1fuYGjV0) (video)
Nhiệm vụ của bạn
Viết giải pháp của bạn cho bài học **-replace option in apply** vào trình soạn thảo bên cạnh. Bấm **Chạy Thử Nghiệm** (hoặc nhấn `Ctrl+Enter`) để thực thi và ghi nhận hoàn thành kỹ năng trên Roadmap.
### Kỹ năng cần đạt:
- `-replace`
- `option`
- `Engineering`
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.swift
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵