mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-16 11:09:33 +02:00
90d5ab7ca2
* feat(terraformExecute): pass tf outputs to cpe * cleanup Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
29 lines
556 B
Go
29 lines
556 B
Go
package terraform
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type TerraformOutput struct {
|
|
Sensitive bool `json:"sensitive"`
|
|
ObjType interface{} `json:"type"`
|
|
Value interface{} `json:"value"`
|
|
}
|
|
|
|
func ReadOutputs(tfOutputJson string) (map[string]interface{}, error) {
|
|
var objmap map[string]TerraformOutput
|
|
err := json.Unmarshal([]byte(tfOutputJson), &objmap)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
retmap := make(map[string]interface{})
|
|
|
|
for tfoutvarname, tfoutvar := range objmap {
|
|
retmap[tfoutvarname] = tfoutvar.Value
|
|
}
|
|
|
|
return retmap, nil
|
|
}
|