@@ -54,12 +54,12 @@ func newBlueprintResource() *schema.Resource {
5454 Schema : map [string ]* schema.Schema {
5555 "identifier" : {
5656 Type : schema .TypeString ,
57- Optional : true ,
57+ Required : true ,
5858 Description : "The identifier of the relation" ,
5959 },
6060 "title" : {
6161 Type : schema .TypeString ,
62- Required : true ,
62+ Optional : true ,
6363 Description : "The display name of the relation" ,
6464 },
6565 "target" : {
@@ -326,6 +326,11 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
326326 return schema .HashString (id )
327327 }}
328328
329+ relations := schema.Set {F : func (i interface {}) int {
330+ id := (i .(map [string ]interface {}))["identifier" ].(string )
331+ return schema .HashString (id )
332+ }}
333+
329334 mirrorPoperties := schema.Set {F : func (i interface {}) int {
330335 id := (i .(map [string ]interface {}))["identifier" ].(string )
331336 return schema .HashString (id )
@@ -335,6 +340,7 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
335340 id := (i .(map [string ]interface {}))["identifier" ].(string )
336341 return schema .HashString (id )
337342 }}
343+
338344 for k , v := range b .Schema .Properties {
339345 p := map [string ]interface {}{}
340346 p ["identifier" ] = k
@@ -376,6 +382,16 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
376382 properties .Add (p )
377383 }
378384
385+ for k , v := range b .Relations {
386+ p := map [string ]interface {}{}
387+ p ["identifier" ] = k
388+ p ["title" ] = v .Title
389+ p ["target" ] = v .Target
390+ p ["required" ] = v .Required
391+ p ["many" ] = v .Many
392+ relations .Add (p )
393+ }
394+
379395 for k , v := range b .MirrorProperties {
380396 p := map [string ]interface {}{}
381397 p ["identifier" ] = k
@@ -402,6 +418,7 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
402418 d .Set ("properties" , & properties )
403419 d .Set ("mirror_properties" , & mirrorPoperties )
404420 d .Set ("calculation_properties" , & calculationProperties )
421+ d .Set ("relations" , & relations )
405422}
406423
407424func blueprintResourceToBody (d * schema.ResourceData ) (* cli.Blueprint , error ) {
0 commit comments