Use pessimistic locking when accessing Terraform state
Previously Terraform states were accessed with an optimistic lock, which retries if an update fails due to concurrent modification. This worked as intended when the file data was stored on the state record itself, however storing individual versions separately means the state record is never updated when creating a new version, giving no opportunity for it to become stale and therefore defeating the locking. In some circumstances this could lead to the same version being created twice, which fails a unique constraint. Explicitly locking the record should force the caller to wait until the previous update has finished, at which point it will see the newly created version (and not attempt to create it again). Changelog: fixed
Showing
Please register or sign in to comment