{"push_id":1112735499,"size":1,"distinct_size":1,"ref":"refs/heads/f-state-safety","head":"c3e40ef78787f076b19d8642b2d00ae896ee13ae","before":"fde0a2ba8fee3d5e761b117194dd0d4341165904","commits":[{"sha":"c3e40ef78787f076b19d8642b2d00ae896ee13ae","author":{"email":"a1bdfbfb01322b54f9edf8cea8f328c9384b211a@degeneration.co.uk","name":"Martin Atkins"},"message":"state: Check for lineage mismatches when writing\n\nAccidentally losing a state with resources in it can be anywhere from\nannoying to catastrophic. A common cause of such a problem is accidentally\nclobbering a remote state with an unrelated local state or vice-versa.\n\nHere we introduce safety checks that exploit the new \"lineage\" concept\nto ensure that once a state location is established it can only be\nupdated with new states from the same lineage as the initial state.\n\nWe also make the remote state caching mechanism treat a lineage mismatch\nas a confict, thus ensuring that automatic state syncing will stop if\nthe user manages to get into a broken, mismatched state.\n\nAs a special exception, we allow *empty* states to be \"clobbered\"\nregardless of lineage. This enables remote state to be configured\neasily in the common case where earlier user actions have implicitly\ncaused an empty local state to be created, and also allows the remote\nstate left behind from a config that has been destroyed to be overwritten\nby a new, unrelated state from a different config.\n\nThe priority here is preventing actions that should never occur, so the\nUX has not been polished. Later we may wish to make changes at higher\nlevels of abstraction to either prevent these situations from arising\nin the first place (e.g. making remote configuration automatic based on\nconfig) or giving the user more guidance on resolution.","distinct":true,"url":"https://api.github.com/repos/hashicorp/terraform/commits/c3e40ef78787f076b19d8642b2d00ae896ee13ae"}]}