1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-16 11:09:33 +02:00
sap-jenkins-library/pkg/terraform/terraform.go
Christian Volk 90d5ab7ca2
feat(terraformExecute): pass tf outputs to cpe (#3241)
* feat(terraformExecute): pass tf outputs to cpe

* cleanup

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-04 10:28:41 +01:00

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
}