converge icon indicating copy to clipboard operation
converge copied to clipboard

support custom structs in Preparers

Open ryane opened this issue 9 years ago • 0 comments

As a resource developer, I'd like to be able to read hcl into a custom type in my Preparer.

As an example, the docker.network resource supports network settings like

ipam_config {
  subnet  = "192.168.123.0/24"
  gateway = "192.168.123.1"
}

Rather than using a map[string]string, I'd like to use a struct:

type IPAMConfig struct {
  Subnet  string `hcl:"subnet"`
  Gateway string `hcl:"gateway"`
}

and read it in from the Preparer:

type Preparer struct {
...
  IPAMConfig []IPAMConfig `hcl:"ipam_config"`
...
}

ryane avatar Nov 03 '16 18:11 ryane