العودة إلى الدورة

قفل الحالة (State Locking): منع الكوارث

احتراف البنية التحتية كبرمجيات (Terraform & OpenTofu)

One Person at a Time

What if two engineers run tofu apply at the exact same second? They might corrupt the state file.

The Solution: Locking

When using S3, you can use DynamoDB to 'lock' the state.

  • When Engineer A starts a plan, OpenTofu puts a 'lock' in DynamoDB.
  • If Engineer B tries to run a plan, it will fail and say: "State is locked by Engineer A".

This is mandatory for professional infrastructure.