diff --git a/parser.go b/parser.go index 151ae88..53e4eb8 100644 --- a/parser.go +++ b/parser.go @@ -35,7 +35,16 @@ func (s *state) outputs() []*Output { for _, m := range s.Modules { for k, v := range m.Outputs { - o, _ := NewOutput(k, v) + var o *Output; + switch v := v.(type) { + case map[string]interface{}: + o, _ = NewOutput(k, v["value"].(string)) + case string: + o, _ = NewOutput(k, v) + default: + o, _ = NewOutput(k, "") + } + inst = append(inst, o) } } @@ -68,7 +77,7 @@ func (s *state) resources() []*Resource { type moduleState struct { ResourceStates map[string]resourceState `json:"resources"` - Outputs map[string]string `json:"outputs"` + Outputs map[string]interface{} `json:"outputs"` } // resourceKeys returns a sorted slice of the key names of the resources in this diff --git a/parser_test.go b/parser_test.go index 2579d73..3e47ad4 100644 --- a/parser_test.go +++ b/parser_test.go @@ -18,9 +18,14 @@ const exampleStateFile = ` "path": [ "root" ], - "outputs": { - "datacenter": "mydc" - }, + "outputs": { + "olddatacenter": "<0.7_format", + "datacenter": { + "sensitive": false, + "type": "string", + "value": "mydc" + } + }, "resources": { "aws_instance.one.0": { "type": "aws_instance", @@ -124,7 +129,7 @@ const exampleStateFile = ` const expectedListOutput = ` { - "all": {"datacenter": "mydc"}, + "all": {"datacenter": "mydc", "olddatacenter": "<0.7_format"}, "one": ["10.0.0.1", "10.0.1.1"], "two": ["50.0.0.1"], "three": ["192.168.0.3"],