config: simplify

This commit is contained in:
Mitchell Hashimoto 2014-05-24 13:58:33 -07:00
parent dac18c823a
commit bdeb278728
1 changed files with 3 additions and 7 deletions

View File

@ -68,16 +68,12 @@ func (r *Resource) Id() string {
// ResourceGraph returns a dependency graph of the resources from this // ResourceGraph returns a dependency graph of the resources from this
// Terraform configuration. // Terraform configuration.
func (c *Config) ResourceGraph() *depgraph.Graph { func (c *Config) ResourceGraph() *depgraph.Graph {
resource2Noun := func(r *Resource) *depgraph.Noun { nouns := make(map[string]*depgraph.Noun)
return &depgraph.Noun{ for _, r := range c.Resources {
noun := &depgraph.Noun{
Name: r.Id(), Name: r.Id(),
Meta: r, Meta: r,
} }
}
nouns := make(map[string]*depgraph.Noun)
for _, r := range c.Resources {
noun := resource2Noun(r)
nouns[noun.Name] = noun nouns[noun.Name] = noun
} }