@@ -54,12 +54,12 @@ func newBlueprintResource() *schema.Resource {
54
54
Schema : map [string ]* schema.Schema {
55
55
"identifier" : {
56
56
Type : schema .TypeString ,
57
- Optional : true ,
57
+ Required : true ,
58
58
Description : "The identifier of the relation" ,
59
59
},
60
60
"title" : {
61
61
Type : schema .TypeString ,
62
- Required : true ,
62
+ Optional : true ,
63
63
Description : "The display name of the relation" ,
64
64
},
65
65
"target" : {
@@ -326,6 +326,11 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
326
326
return schema .HashString (id )
327
327
}}
328
328
329
+ relations := schema.Set {F : func (i interface {}) int {
330
+ id := (i .(map [string ]interface {}))["identifier" ].(string )
331
+ return schema .HashString (id )
332
+ }}
333
+
329
334
mirrorPoperties := schema.Set {F : func (i interface {}) int {
330
335
id := (i .(map [string ]interface {}))["identifier" ].(string )
331
336
return schema .HashString (id )
@@ -335,6 +340,7 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
335
340
id := (i .(map [string ]interface {}))["identifier" ].(string )
336
341
return schema .HashString (id )
337
342
}}
343
+
338
344
for k , v := range b .Schema .Properties {
339
345
p := map [string ]interface {}{}
340
346
p ["identifier" ] = k
@@ -376,6 +382,16 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
376
382
properties .Add (p )
377
383
}
378
384
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
+
379
395
for k , v := range b .MirrorProperties {
380
396
p := map [string ]interface {}{}
381
397
p ["identifier" ] = k
@@ -402,6 +418,7 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
402
418
d .Set ("properties" , & properties )
403
419
d .Set ("mirror_properties" , & mirrorPoperties )
404
420
d .Set ("calculation_properties" , & calculationProperties )
421
+ d .Set ("relations" , & relations )
405
422
}
406
423
407
424
func blueprintResourceToBody (d * schema.ResourceData ) (* cli.Blueprint , error ) {
0 commit comments