diff --git a/docs/resources/blueprint.md b/docs/resources/blueprint.md
index 9c53efe9..20340185 100644
--- a/docs/resources/blueprint.md
+++ b/docs/resources/blueprint.md
@@ -27,7 +27,6 @@ Port blueprint
- `changelog_destination` (Block List, Max: 1) Blueprints changelog destination, Supports WEBHOOK and KAFKA (see [below for nested schema](#nestedblock--changelog_destination))
- `data_source` (String, Deprecated) The data source for entities of this blueprint
- `description` (String) The description of the blueprint
-- `formula_properties` (Block Set) A property that is calculated by a formula (see [below for nested schema](#nestedblock--formula_properties))
- `mirror_properties` (Block Set) When two Blueprints are connected via a Relation, a new set of properties becomes available to Entities in the source Blueprint. (see [below for nested schema](#nestedblock--mirror_properties))
- `relations` (Block Set) The blueprints that are connected to this blueprint (see [below for nested schema](#nestedblock--relations))
@@ -71,20 +70,6 @@ Optional:
- `url` (String) Required when selecting type WEBHOOK. The URL to which the changelog is dispatched
-
-
-### Nested Schema for `formula_properties`
-
-Required:
-
-- `formula` (String) The path of the realtions towards the property
-- `identifier` (String) The identifier of the property
-
-Optional:
-
-- `title` (String) The name of this property
-
-
### Nested Schema for `mirror_properties`
diff --git a/port/cli/models.go b/port/cli/models.go
index 08b280b5..d6f17372 100644
--- a/port/cli/models.go
+++ b/port/cli/models.go
@@ -22,7 +22,7 @@ type (
Identifier string `json:"identifier,omitempty"`
Title string `json:"title"`
Blueprint string `json:"blueprint"`
- Team string `json:"team,omitempty"`
+ Team []string `json:"team,omitempty"`
Properties map[string]interface{} `json:"properties"`
Relations map[string]string `json:"relations"`
// TODO: add the rest of the fields.
@@ -48,12 +48,6 @@ type (
Path string `json:"path,omitempty"`
}
- BlueprintFormulaProperty struct {
- Identifier string `json:"identifier,omitempty"`
- Title string `json:"title,omitempty"`
- Formula string `json:"formula,omitempty"`
- }
-
BlueprintSchema struct {
Properties map[string]BlueprintProperty `json:"properties"`
Required []string `json:"required,omitempty"`
@@ -73,15 +67,14 @@ type (
Blueprint struct {
Meta
- Identifier string `json:"identifier,omitempty"`
- Title string `json:"title"`
- Icon string `json:"icon"`
- Description string `json:"description"`
- Schema BlueprintSchema `json:"schema"`
- FormulaProperties map[string]BlueprintFormulaProperty `json:"formulaProperties"`
- MirrorProperties map[string]BlueprintMirrorProperty `json:"mirrorProperties"`
- ChangelogDestination *ChangelogDestination `json:"changelogDestination,omitempty"`
- Relations map[string]Relation `json:"relations"`
+ Identifier string `json:"identifier,omitempty"`
+ Title string `json:"title"`
+ Icon string `json:"icon"`
+ Description string `json:"description"`
+ Schema BlueprintSchema `json:"schema"`
+ MirrorProperties map[string]BlueprintMirrorProperty `json:"mirrorProperties"`
+ ChangelogDestination *ChangelogDestination `json:"changelogDestination,omitempty"`
+ Relations map[string]Relation `json:"relations"`
}
Action struct {
diff --git a/port/resource_port_blueprint.go b/port/resource_port_blueprint.go
index 1789c47e..5a20a8e7 100644
--- a/port/resource_port_blueprint.go
+++ b/port/resource_port_blueprint.go
@@ -182,30 +182,6 @@ func newBlueprintResource() *schema.Resource {
},
Optional: true,
},
- "formula_properties": {
- Type: schema.TypeSet,
- Description: "A property that is calculated by a formula",
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "identifier": {
- Type: schema.TypeString,
- Required: true,
- Description: "The identifier of the property",
- },
- "title": {
- Type: schema.TypeString,
- Optional: true,
- Description: "The name of this property",
- },
- "formula": {
- Type: schema.TypeString,
- Required: true,
- Description: "The path of the realtions towards the property",
- },
- },
- },
- Optional: true,
- },
"changelog_destination": {
Type: schema.TypeList,
MinItems: 1,
@@ -279,10 +255,7 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
id := (i.(map[string]interface{}))["identifier"].(string)
return schema.HashString(id)
}}
- formula_properties := schema.Set{F: func(i interface{}) int {
- id := (i.(map[string]interface{}))["identifier"].(string)
- return schema.HashString(id)
- }}
+
mirror_properties := schema.Set{F: func(i interface{}) int {
id := (i.(map[string]interface{}))["identifier"].(string)
return schema.HashString(id)
@@ -334,17 +307,8 @@ func writeBlueprintFieldsToResource(d *schema.ResourceData, b *cli.Blueprint) {
mirror_properties.Add(p)
}
- for k, v := range b.FormulaProperties {
- p := map[string]interface{}{}
- p["identifier"] = k
- p["title"] = v.Title
- p["formula"] = v.Formula
- formula_properties.Add(p)
- }
-
d.Set("properties", &properties)
d.Set("mirror_properties", &mirror_properties)
- d.Set("formula_properties", &formula_properties)
}
func blueprintResourceToBody(d *schema.ResourceData) (*cli.Blueprint, error) {
@@ -362,7 +326,6 @@ func blueprintResourceToBody(d *schema.ResourceData) (*cli.Blueprint, error) {
b.Description = d.Get("description").(string)
props := d.Get("properties").(*schema.Set)
mirror_props := d.Get("mirror_properties").(*schema.Set)
- formula_props := d.Get("formula_properties").(*schema.Set)
if changelogDestination, ok := d.GetOk("changelog_destination"); ok {
if b.ChangelogDestination == nil {
@@ -461,19 +424,6 @@ func blueprintResourceToBody(d *schema.ResourceData) (*cli.Blueprint, error) {
mirror_properties[p["identifier"].(string)] = propFields
}
- formula_properties := make(map[string]cli.BlueprintFormulaProperty, formula_props.Len())
- for _, prop := range formula_props.List() {
- p := prop.(map[string]interface{})
- propFields := cli.BlueprintFormulaProperty{}
- if t, ok := p["title"]; ok && t != "" {
- propFields.Title = t.(string)
- }
- if f, ok := p["formula"]; ok && f != "" {
- propFields.Formula = f.(string)
- }
- formula_properties[p["identifier"].(string)] = propFields
- }
-
rels := d.Get("relations").(*schema.Set)
relations := make(map[string]cli.Relation, props.Len())
for _, rel := range rels.List() {
@@ -497,7 +447,6 @@ func blueprintResourceToBody(d *schema.ResourceData) (*cli.Blueprint, error) {
b.Schema = cli.BlueprintSchema{Properties: properties, Required: required}
b.Relations = relations
- b.FormulaProperties = formula_properties
b.MirrorProperties = mirror_properties
return b, nil
}
diff --git a/port/resource_port_blueprint_test.go b/port/resource_port_blueprint_test.go
index a9a4bdcb..4dec5b0c 100644
--- a/port/resource_port_blueprint_test.go
+++ b/port/resource_port_blueprint_test.go
@@ -181,10 +181,6 @@ func TestAccPortBlueprintUpdate(t *testing.T) {
b = "blue"
}
}
- formula_properties {
- identifier = "formula_id"
- formula = "{{$identifier}}formula"
- }
}
`, identifier)
var testAccActionConfigUpdate = fmt.Sprintf(`
@@ -203,10 +199,6 @@ func TestAccPortBlueprintUpdate(t *testing.T) {
type = "number"
title = "num"
}
- formula_properties {
- identifier = "formula_id"
- formula = "{{$identifier}}formula-updated"
- }
}
`, identifier)
var testAccActionConfigUpdateAgain = fmt.Sprintf(`
@@ -233,7 +225,6 @@ func TestAccPortBlueprintUpdate(t *testing.T) {
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.0.title", "text"),
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.0.required", "true"),
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.0.icon", "Terraform"),
- resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "formula_properties.0.formula", "{{$identifier}}formula"),
),
},
{
@@ -243,7 +234,6 @@ func TestAccPortBlueprintUpdate(t *testing.T) {
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.0.title", "num"),
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.1.title", "text"),
resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "properties.1.required", "false"),
- resource.TestCheckResourceAttr("port-labs_blueprint.microservice1", "formula_properties.0.formula", "{{$identifier}}formula-updated"),
),
},
{
diff --git a/port/resource_port_entity.go b/port/resource_port_entity.go
index f320b7d3..8ef6a410 100644
--- a/port/resource_port_entity.go
+++ b/port/resource_port_entity.go
@@ -165,7 +165,8 @@ func entityResourceToBody(d *schema.ResourceData, bp *cli.Blueprint) (*cli.Entit
e.Title = d.Get("title").(string)
e.Blueprint = d.Get("blueprint").(string)
if team, ok := d.GetOk("team"); ok {
- e.Team = team.(string)
+ teams := []string{team.(string)}
+ e.Team = teams
}
rels := d.Get("relations").(*schema.Set)
relations := make(map[string]string)
@@ -199,7 +200,9 @@ func writeEntityComputedFieldsToResource(d *schema.ResourceData, e *cli.Entity)
func writeEntityFieldsToResource(d *schema.ResourceData, e *cli.Entity) {
d.SetId(e.Identifier)
d.Set("title", e.Title)
- d.Set("team", e.Team)
+ if len(e.Team) > 0 {
+ d.Set("team", e.Team[0])
+ }
d.Set("created_at", e.CreatedAt.String())
d.Set("created_by", e.CreatedBy)
d.Set("updated_at", e.UpdatedAt.String())