Skip to content

Commit

Permalink
Merge pull request #15 from calind/values-as-yaml
Browse files Browse the repository at this point in the history
helm_chart: allow specifying values as raw yaml
  • Loading branch information
mcuadros authored Sep 4, 2017
2 parents eb2ce6d + 4507b3b commit 193c3ef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion helm/resource_chart.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (
"path/filepath"
"strings"

"github.com/ghodss/yaml"
"github.com/hashicorp/terraform/helper/schema"
"gopkg.in/yaml.v1"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/downloader"
"k8s.io/helm/pkg/getter"
@@ -54,6 +54,11 @@ func resourceChart() *schema.Resource {
Optional: true,
Description: "Specify the exact chart version to install. If this is not specified, the latest version is installed.",
},
"raw_values": {
Type: schema.TypeString,
Optional: true,
Description: "Set raw yaml file to pass to helm.",
},
"value": {
Type: schema.TypeSet,
Optional: true,
@@ -325,6 +330,13 @@ func getChart(d *schema.ResourceData, m *Meta) (c *chart.Chart, path string, err
func getValues(d *schema.ResourceData) ([]byte, error) {
base := map[string]interface{}{}

raw_values := d.Get("raw_values").(string)
if raw_values != "" {
if err := yaml.Unmarshal([]byte(raw_values), &base); err != nil {
return nil, err
}
}

for _, raw := range d.Get("value").(*schema.Set).List() {
value := raw.(map[string]interface{})

0 comments on commit 193c3ef

Please sign in to comment.