terraform: clear docs for devs

This commit is contained in:
Mitchell Hashimoto 2016-08-24 18:44:54 -07:00
parent 3376611ad0
commit 73f7c04159
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A

View File

@ -254,6 +254,14 @@ func (s *State) IsRemote() bool {
func (s *State) Validate() error {
var result error
// !!!! FOR DEVELOPERS !!!!
//
// Any errors returned from this Validate function will BLOCK TERRAFORM
// from loading a state file. Therefore, this should only contain checks
// that are only resolvable through manual intervention.
//
// !!!! FOR DEVELOPERS !!!!
// Make sure there are no duplicate module states. We open a new
// block here so we can use basic variable names and future validations
// can do the same.
@ -1607,6 +1615,11 @@ func ReadState(src io.Reader) (*State, error) {
panic("resulting state in load not set, assertion failed")
}
// Validate the state file is valid
if err := result.Validate(); err != nil {
return nil, err
}
return result, nil
}