terraform: sort dependencies of resource state [GH-928]

This commit is contained in:
Mitchell Hashimoto 2015-02-17 11:47:53 -08:00
parent 1752c93e0c
commit c2f3f0594d
2 changed files with 16 additions and 0 deletions

View File

@ -35,6 +35,7 @@ BUG FIXES:
* core: Fix crash that could occur when there are exactly zero providers
installed on a system. [GH-786]
* core: JSON TF configurations can configure provisioners. [GH-807]
* core: Sort `depends_on` in state to prevent unnecessary file changes. [GH-928]
* command/apply: Won't try to initialize modules in some cases when
no arguments are given. [GH-780]
* command/apply: Fix regression where user variables weren't asked [GH-736]

View File

@ -156,6 +156,11 @@ func (s *State) prune() {
// sort sorts the modules
func (s *State) sort() {
sort.Sort(moduleStateSort(s.Modules))
// Allow modules to be sorted
for _, m := range s.Modules {
m.sort()
}
}
func (s *State) GoString() string {
@ -347,6 +352,12 @@ func (m *ModuleState) prune() {
}
}
func (m *ModuleState) sort() {
for _, v := range m.Resources {
v.sort()
}
}
func (m *ModuleState) GoString() string {
return fmt.Sprintf("*%#v", *m)
}
@ -515,6 +526,10 @@ func (r *ResourceState) prune() {
r.Tainted = r.Tainted[:n]
}
func (r *ResourceState) sort() {
sort.Strings(r.Dependencies)
}
func (s *ResourceState) GoString() string {
return fmt.Sprintf("*%#v", *s)
}