Skip to content

Commit f12ec6b

Browse files
add description prop to relation model (#179)
* add description prop to relation model
1 parent 757b655 commit f12ec6b

20 files changed

+46
-43
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Setting up your developer workspace:
44

55
* Have [golang](https://go.dev/doc/install) installed
6+
* Have `wget` installed
67
* Run `make dev-setup`
78

89
## Verifying your contribution:
@@ -28,7 +29,7 @@ Expose the following environment variables:
2829

2930
`PORT_CLIENT_SECRET`
3031

31-
`PORT_BASE_URL` - Optional
32+
`PORT_BASE_URL` - Optional, Port API url
3233

3334
Then run:
3435

docs/data-sources/port_search.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,3 @@ Read-Only:
225225
- `identifier` (String)
226226
- `level` (String)
227227
- `status` (String)
228-
229-

docs/resources/port_action.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ Optional:
343343
- `entity_deleted_event` (Attributes) Entity deleted event trigger (see [below for nested schema](#nestedatt--automation_trigger--entity_deleted_event))
344344
- `entity_updated_event` (Attributes) Entity updated event trigger (see [below for nested schema](#nestedatt--automation_trigger--entity_updated_event))
345345
- `jq_condition` (Attributes) JQ condition for automation trigger (see [below for nested schema](#nestedatt--automation_trigger--jq_condition))
346+
- `run_updated_event` (Attributes) Run updated event trigger (see [below for nested schema](#nestedatt--automation_trigger--run_updated_event))
346347
- `timer_property_expired_event` (Attributes) Timer property expired event trigger (see [below for nested schema](#nestedatt--automation_trigger--timer_property_expired_event))
347348

348349
<a id="nestedatt--automation_trigger--any_entity_change_event"></a>
@@ -389,6 +390,14 @@ Optional:
389390
- `combinator` (String) The combinator of the condition
390391

391392

393+
<a id="nestedatt--automation_trigger--run_updated_event"></a>
394+
### Nested Schema for `automation_trigger.run_updated_event`
395+
396+
Required:
397+
398+
- `action_identifier` (String) The action identifier of the updated run
399+
400+
392401
<a id="nestedatt--automation_trigger--timer_property_expired_event"></a>
393402
### Nested Schema for `automation_trigger.timer_property_expired_event`
394403

@@ -685,5 +694,3 @@ Optional:
685694
- `headers` (Map of String) The HTTP headers for invoking the action. They should be encoded as a key-value object to a string using [jsonencode](https://developer.hashicorp.com/terraform/language/functions/jsonencode). Learn about how to [define the action payload](https://docs.getport.io/create-self-service-experiences/setup-backend/#define-the-actions-payload).
686695
- `method` (String) The HTTP method to invoke the action
687696
- `synchronized` (String) Synchronize the action
688-
689-

docs/resources/port_action_permissions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,3 @@ Optional:
265265
- `roles` (List of String) The roles with execution permission
266266
- `teams` (List of String) The teams with execution permission
267267
- `users` (List of String) The users with execution permission
268-
269-

docs/resources/port_aggregation_properties.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,5 +645,3 @@ Optional:
645645

646646
- `average_of` (String) The time periods to calculate the average of, e.g. hour, day, week, month
647647
- `measure_time_by` (String) The property name on which to calculate the the time periods, e.g. $createdAt, $updated_at or any other date property
648-
649-

docs/resources/port_blueprint.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ Required:
476476

477477
Optional:
478478

479+
- `description` (String) The description of the relation
479480
- `many` (Boolean) The many of the relation
480481
- `required` (Boolean) The required of the relation
481482
- `title` (String) The title of the relation
@@ -499,5 +500,3 @@ Required:
499500
Optional:
500501

501502
- `agent` (Boolean) The agent of the webhook changelog destination
502-
503-

docs/resources/port_blueprint_permissions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,5 +450,3 @@ Optional:
450450
- `roles` (List of String) Roles with update specific relation permissions
451451
- `teams` (List of String) Teams with update specific relation permissions
452452
- `users` (List of String) Users with update specific relation permissions
453-
454-

docs/resources/port_entity.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,3 @@ Optional:
6767

6868
- `many_relations` (Map of List of String) The many relation of the entity
6969
- `single_relations` (Map of String) The single relation of the entity
70-
71-

docs/resources/port_integration.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,3 @@ Required:
128128
Optional:
129129

130130
- `agent` (Boolean) The agent of the webhook changelog destination
131-
132-

docs/resources/port_page.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,5 +481,3 @@ terraform import port_page.home_page "\$home"
481481
- `id` (String) The ID of this resource.
482482
- `updated_at` (String) The last update date of the page
483483
- `updated_by` (String) The last updater of the page
484-
485-

docs/resources/port_page_permissions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,3 @@ Optional:
121121
- `roles` (List of String) The roles with read permission
122122
- `teams` (List of String) The teams with read permission
123123
- `users` (List of String) The users with read permission
124-
125-

docs/resources/port_scorecard.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,5 +475,3 @@ Required:
475475

476476
- `color` (String) The color of the level
477477
- `title` (String) The title of the level
478-
479-

docs/resources/port_team.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@ Team resource
3030
- `id` (String) The ID of this resource.
3131
- `provider_name` (String) The provider of the team
3232
- `updated_at` (String) The last update date of the team
33-
34-

docs/resources/port_webhook.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,3 @@ Optional:
7575
- `signature_algorithm` (String) The signature algorithm of the webhook
7676
- `signature_header_name` (String) The signature header name of the webhook
7777
- `signature_prefix` (String) The signature prefix of the webhook
78-
79-

internal/cli/models.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,12 @@ type (
318318
}
319319

320320
Relation struct {
321-
Identifier *string `json:"identifier,omitempty"`
322-
Title *string `json:"title,omitempty"`
323-
Target *string `json:"target,omitempty"`
324-
Required *bool `json:"required,omitempty"`
325-
Many *bool `json:"many,omitempty"`
321+
Identifier *string `json:"identifier,omitempty"`
322+
Title *string `json:"title,omitempty"`
323+
Description *string `json:"description,omitempty"`
324+
Target *string `json:"target,omitempty"`
325+
Required *bool `json:"required,omitempty"`
326+
Many *bool `json:"many,omitempty"`
326327
}
327328

328329
Scorecard struct {

port/blueprint/model.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ type PropertiesModel struct {
102102
}
103103

104104
type RelationModel struct {
105-
Target types.String `tfsdk:"target"`
106-
Title types.String `tfsdk:"title"`
107-
Required types.Bool `tfsdk:"required"`
108-
Many types.Bool `tfsdk:"many"`
105+
Target types.String `tfsdk:"target"`
106+
Title types.String `tfsdk:"title"`
107+
Description types.String `tfsdk:"description"`
108+
Required types.Bool `tfsdk:"required"`
109+
Many types.Bool `tfsdk:"many"`
109110
}
110111

111112
type MirrorPropertyModel struct {

port/blueprint/readStateToPortBody.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package blueprint
22

33
import (
44
"context"
5+
56
"github.com/port-labs/terraform-provider-port-labs/v2/internal/cli"
67
)
78

@@ -62,6 +63,11 @@ func relationsResourceToBody(state *BlueprintModel) map[string]cli.Relation {
6263
relationProp.Required = &required
6364
}
6465

66+
if !prop.Description.IsNull() {
67+
description := prop.Description.ValueString()
68+
relationProp.Description = &description
69+
}
70+
6571
relations[identifier] = relationProp
6672
}
6773

port/blueprint/resource_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ package blueprint_test
33
import (
44
"context"
55
"fmt"
6-
"github.com/port-labs/terraform-provider-port-labs/v2/internal/cli"
7-
"github.com/port-labs/terraform-provider-port-labs/v2/internal/consts"
8-
"github.com/port-labs/terraform-provider-port-labs/v2/version"
96
"net/http"
107
"os"
118
"regexp"
129
"strconv"
1310
"testing"
1411
"time"
1512

13+
"github.com/port-labs/terraform-provider-port-labs/v2/internal/cli"
14+
"github.com/port-labs/terraform-provider-port-labs/v2/internal/consts"
15+
"github.com/port-labs/terraform-provider-port-labs/v2/version"
16+
1617
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1718
"github.com/port-labs/terraform-provider-port-labs/v2/internal/acctest"
1819
"github.com/port-labs/terraform-provider-port-labs/v2/internal/utils"
@@ -409,12 +410,14 @@ func TestAccPortBlueprintWithRelation(t *testing.T) {
409410
Config: acctest.ProviderConfig + testAccActionConfigCreate,
410411
Check: resource.ComposeTestCheckFunc(
411412
resource.TestCheckResourceAttr("port_blueprint.microservice1", "title", "TF Provider Test BP2"),
413+
resource.TestCheckNoResourceAttr("port_blueprint.microservice1", "description"),
412414
resource.TestCheckResourceAttr("port_blueprint.microservice1", "identifier", identifier1),
413415
resource.TestCheckResourceAttr("port_blueprint.microservice1", "icon", "Terraform"),
414416
resource.TestCheckResourceAttr("port_blueprint.microservice2", "title", "TF Provider Test BP3"),
415417
resource.TestCheckResourceAttr("port_blueprint.microservice2", "identifier", identifier2),
416418
resource.TestCheckResourceAttr("port_blueprint.microservice2", "icon", "Terraform"),
417419
resource.TestCheckResourceAttr("port_blueprint.microservice2", "relations.test-rel.title", "Test Relation"),
420+
resource.TestCheckNoResourceAttr("port_blueprint.microservice2", "description"),
418421
resource.TestCheckResourceAttr("port_blueprint.microservice2", "relations.test-rel.target", identifier1),
419422
),
420423
},
@@ -625,6 +628,7 @@ func TestAccPortBlueprintWithMirrorProperty(t *testing.T) {
625628
relations = {
626629
"test-rel" = {
627630
title = "Test Relation"
631+
description = "Test Relation"
628632
target = port_blueprint.microservice1.identifier
629633
}
630634
}
@@ -638,6 +642,7 @@ func TestAccPortBlueprintWithMirrorProperty(t *testing.T) {
638642
Config: acctest.ProviderConfig + testAccActionConfigCreate,
639643
Check: resource.ComposeTestCheckFunc(
640644
resource.TestCheckResourceAttr("port_blueprint.microservice2", "relations.test-rel.title", "Test Relation"),
645+
resource.TestCheckResourceAttr("port_blueprint.microservice2", "relations.test-rel.description", "Test Relation"),
641646
resource.TestCheckResourceAttr("port_blueprint.microservice2", "relations.test-rel.target", identifier1),
642647
resource.TestCheckResourceAttr("port_blueprint.microservice2", "mirror_properties.mirror-for-microservice1.title", "Mirror for microservice1"),
643648
resource.TestCheckResourceAttr("port_blueprint.microservice2", "mirror_properties.mirror-for-microservice1.path", "test-rel.$identifier"),

port/blueprint/schema.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ func BlueprintSchema() map[string]schema.Attribute {
372372
MarkdownDescription: "The title of the relation",
373373
Optional: true,
374374
},
375+
"description": schema.StringAttribute{
376+
MarkdownDescription: "The description of the relation",
377+
Optional: true,
378+
},
375379
"target": schema.StringAttribute{
376380
MarkdownDescription: "The target of the relation",
377381
Required: true,

port/blueprint/updatePropertiesToState.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ func addRelationsToState(b *cli.Blueprint, bm *BlueprintModel) {
177177
}
178178

179179
relationModel := &RelationModel{
180-
Target: types.StringValue(*v.Target),
181-
Title: flex.GoStringToFramework(v.Title),
182-
Many: flex.GoBoolToFramework(v.Many),
183-
Required: flex.GoBoolToFramework(v.Required),
180+
Target: types.StringValue(*v.Target),
181+
Title: flex.GoStringToFramework(v.Title),
182+
Description: flex.GoStringToFramework(v.Description),
183+
Many: flex.GoBoolToFramework(v.Many),
184+
Required: flex.GoBoolToFramework(v.Required),
184185
}
185186

186187
bm.Relations[k] = *relationModel

0 commit comments

Comments
 (0)