Skip to content

Commit ee91250

Browse files
authored
Merge pull request #89 from port-labs/PORT-5186-add-display-condition-property-in-terraform
PORT-5186-add-display-condition-property-in-terraform
2 parents 33195db + e1acd0a commit ee91250

File tree

13 files changed

+370
-48
lines changed

13 files changed

+370
-48
lines changed

docs/index.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
---
2-
32
# generated by https://github.com/hashicorp/terraform-plugin-docs
4-
53
page_title: "port-labs Provider"
64
subcategory: ""
75
description: |-
8-
Interact with Port-labs
6+
Interact with Port-labs
7+
---
98

109
# port-labs Provider
1110

12-
[getport.io](https://getport.io)
13-
1411
Interact with Port-labs
1512

16-
<!-- schema generated by tfplugindocs -->
17-
18-
## Schema
1913

20-
### Required
2114

22-
- `client_id` (String) Client ID for Port-labs (environment: `PORT_CLIENT_ID`)
23-
- `secret` (String, Sensitive) Client Secret for Port-labs (environment: `PORT_CLIENT_SECRET`)
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
2417

2518
### Optional
2619

27-
- `base_url` (String) Base URL for Port-labs (environment: `PORT_BASE_URL`)
20+
- `base_url` (String)
21+
- `client_id` (String) Client ID for Port-labs
22+
- `secret` (String, Sensitive) Client Secret for Port-labs
23+
- `token` (String, Sensitive) Token for Port-labs

docs/resources/port_action.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Optional:
133133
- `required` (Boolean) Whether the property is required
134134
- `string_items` (Attributes) The items of the array property (see [below for nested schema](#nestedatt--user_properties--array_props--string_items))
135135
- `title` (String) The title of the property
136+
- `visible` (Boolean) The visibility of the array property
137+
- `visible_jq_query` (String) The visibility condition jq query of the array property
136138

137139
<a id="nestedatt--user_properties--array_props--boolean_items"></a>
138140
### Nested Schema for `user_properties.array_props.boolean_items`
@@ -217,6 +219,8 @@ Optional:
217219
- `icon` (String) The icon of the property
218220
- `required` (Boolean) Whether the property is required
219221
- `title` (String) The title of the property
222+
- `visible` (Boolean) The visibility of the boolean property
223+
- `visible_jq_query` (String) The visibility condition jq query of the boolean property
220224

221225
<a id="nestedatt--user_properties--boolean_props--dataset"></a>
222226
### Nested Schema for `user_properties.boolean_props.dataset`
@@ -267,6 +271,8 @@ Optional:
267271
- `minimum` (Number) The max of the number property
268272
- `required` (Boolean) Whether the property is required
269273
- `title` (String) The title of the property
274+
- `visible` (Boolean) The visibility of the number property
275+
- `visible_jq_query` (String) The visibility condition jq query of the number property
270276

271277
<a id="nestedatt--user_properties--number_props--dataset"></a>
272278
### Nested Schema for `user_properties.number_props.dataset`
@@ -314,6 +320,8 @@ Optional:
314320
- `icon` (String) The icon of the property
315321
- `required` (Boolean) Whether the property is required
316322
- `title` (String) The title of the property
323+
- `visible` (Boolean) The visibility of the object property
324+
- `visible_jq_query` (String) The visibility condition jq query of the object property
317325

318326
<a id="nestedatt--user_properties--object_props--dataset"></a>
319327
### Nested Schema for `user_properties.object_props.dataset`
@@ -368,6 +376,8 @@ Optional:
368376
- `pattern` (String) The pattern of the string property
369377
- `required` (Boolean) Whether the property is required
370378
- `title` (String) The title of the property
379+
- `visible` (Boolean) The visibility of the string property
380+
- `visible_jq_query` (String) The visibility condition jq query of the string property
371381

372382
<a id="nestedatt--user_properties--string_props--dataset"></a>
373383
### Nested Schema for `user_properties.string_props.dataset`

docs/resources/port_team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Team resource
2222
### Optional
2323

2424
- `description` (String) The description of the team
25-
- `users` (List of String) The users of the team
25+
- `users` (Set of String) The users of the team
2626

2727
### Read-Only
2828

internal/cli/models.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ type (
2121
}
2222
Entity struct {
2323
Meta
24-
Identifier string `json:"identifier,omitempty"`
25-
Title string `json:"title"`
26-
Blueprint string `json:"blueprint"`
27-
Team []string `json:"team,omitempty"`
28-
Properties map[string]interface{} `json:"properties"`
29-
Relations map[string]interface{} `json:"relations"`
24+
Identifier string `json:"identifier,omitempty"`
25+
Title string `json:"title"`
26+
Blueprint string `json:"blueprint"`
27+
Team []string `json:"team,omitempty"`
28+
Properties map[string]any `json:"properties"`
29+
Relations map[string]any `json:"relations"`
3030
// TODO: add the rest of the fields.
3131
}
3232

@@ -35,7 +35,7 @@ type (
3535
Title *string `json:"title,omitempty"`
3636
Identifier string `json:"identifier,omitempty"`
3737
Items map[string]any `json:"items,omitempty"`
38-
Default interface{} `json:"default,omitempty"`
38+
Default any `json:"default,omitempty"`
3939
Icon *string `json:"icon,omitempty"`
4040
Format *string `json:"format,omitempty"`
4141
MaxLength *int `json:"maxLength,omitempty"`
@@ -47,7 +47,7 @@ type (
4747
Description *string `json:"description,omitempty"`
4848
Blueprint *string `json:"blueprint,omitempty"`
4949
Pattern *string `json:"pattern,omitempty"`
50-
Enum []interface{} `json:"enum,omitempty"`
50+
Enum []any `json:"enum,omitempty"`
5151
Spec *string `json:"spec,omitempty"`
5252
SpecAuthentication *SpecAuthentication `json:"specAuthentication,omitempty"`
5353
EnumColors map[string]string `json:"enumColors,omitempty"`
@@ -58,7 +58,7 @@ type (
5858
Title *string `json:"title,omitempty"`
5959
Identifier string `json:"identifier,omitempty"`
6060
Items map[string]any `json:"items,omitempty"`
61-
Default interface{} `json:"default,omitempty"`
61+
Default any `json:"default,omitempty"`
6262
Icon *string `json:"icon,omitempty"`
6363
Format *string `json:"format,omitempty"`
6464
MaxLength *int `json:"maxLength,omitempty"`
@@ -70,13 +70,14 @@ type (
7070
Description *string `json:"description,omitempty"`
7171
Blueprint *string `json:"blueprint,omitempty"`
7272
Pattern *string `json:"pattern,omitempty"`
73-
Enum interface{} `json:"enum,omitempty"`
73+
Enum any `json:"enum,omitempty"`
7474
Spec *string `json:"spec,omitempty"`
7575
SpecAuthentication *SpecAuthentication `json:"specAuthentication,omitempty"`
7676
EnumColors map[string]string `json:"enumColors,omitempty"`
7777
DependsOn []string `json:"dependsOn,omitempty"`
7878
Dataset *Dataset `json:"dataset,omitempty"`
7979
Encryption *string `json:"encryption,omitempty"`
80+
Visible any `json:"visible,omitempty"`
8081
}
8182

8283
SpecAuthentication struct {
@@ -104,7 +105,7 @@ type (
104105
Title *string `json:"title,omitempty"`
105106
Identifier string `json:"identifier,omitempty"`
106107
Calculation string `json:"calculation,omitempty"`
107-
Default interface{} `json:"default,omitempty"`
108+
Default any `json:"default,omitempty"`
108109
Icon *string `json:"icon,omitempty"`
109110
Format *string `json:"format,omitempty"`
110111
Description *string `json:"description,omitempty"`

port/action/array.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ func arrayPropResourceToBody(ctx context.Context, d *ActionModel, props map[stri
174174
return err
175175
}
176176

177+
if !prop.Visible.IsNull() {
178+
property.Visible = prop.Visible.ValueBoolPointer()
179+
}
180+
181+
if !prop.VisibleJqQuery.IsNull() {
182+
VisibleJqQueryMap := map[string]string{
183+
"jqQuery": prop.VisibleJqQuery.ValueString(),
184+
}
185+
property.Visible = VisibleJqQueryMap
186+
}
187+
177188
props[propIdentifier] = property
178189
}
179190

port/action/boolean.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ func booleanPropResourceToBody(ctx context.Context, d *ActionModel, props map[st
5353
property.Dataset = actionDataSetToPortBody(prop.Dataset)
5454
}
5555

56+
if !prop.Visible.IsNull() {
57+
property.Visible = prop.Visible.ValueBoolPointer()
58+
}
59+
60+
if !prop.VisibleJqQuery.IsNull() {
61+
VisibleJqQueryMap := map[string]string{
62+
"jqQuery": prop.VisibleJqQuery.ValueString(),
63+
}
64+
property.Visible = VisibleJqQueryMap
65+
}
66+
5667
props[propIdentifier] = property
5768
}
5869
if prop.Required.ValueBool() {

port/action/model.go

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,74 +51,89 @@ type GitlabMethodModel struct {
5151
type StringPropModel struct {
5252
Title types.String `tfsdk:"title"`
5353
Icon types.String `tfsdk:"icon"`
54-
Blueprint types.String `tfsdk:"blueprint"`
5554
Description types.String `tfsdk:"description"`
56-
Default types.String `tfsdk:"default"`
5755
Required types.Bool `tfsdk:"required"`
58-
Format types.String `tfsdk:"format"`
59-
MaxLength types.Int64 `tfsdk:"max_length"`
60-
MinLength types.Int64 `tfsdk:"min_length"`
61-
Pattern types.String `tfsdk:"pattern"`
62-
Enum types.List `tfsdk:"enum"`
6356
DependsOn types.List `tfsdk:"depends_on"`
6457
Dataset *DatasetModel `tfsdk:"dataset"`
6558
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
66-
EnumJqQuery types.String `tfsdk:"enum_jq_query"`
67-
Encryption types.String `tfsdk:"encryption"`
59+
Visible types.Bool `tfsdk:"visible"`
60+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
61+
62+
Default types.String `tfsdk:"default"`
63+
Blueprint types.String `tfsdk:"blueprint"`
64+
Format types.String `tfsdk:"format"`
65+
MaxLength types.Int64 `tfsdk:"max_length"`
66+
MinLength types.Int64 `tfsdk:"min_length"`
67+
Pattern types.String `tfsdk:"pattern"`
68+
Enum types.List `tfsdk:"enum"`
69+
EnumJqQuery types.String `tfsdk:"enum_jq_query"`
70+
Encryption types.String `tfsdk:"encryption"`
6871
}
6972

7073
type NumberPropModel struct {
7174
Title types.String `tfsdk:"title"`
7275
Icon types.String `tfsdk:"icon"`
7376
Description types.String `tfsdk:"description"`
74-
Default types.Float64 `tfsdk:"default"`
7577
Required types.Bool `tfsdk:"required"`
76-
Maximum types.Float64 `tfsdk:"maximum"`
77-
Minimum types.Float64 `tfsdk:"minimum"`
78-
Enum types.List `tfsdk:"enum"`
7978
DependsOn types.List `tfsdk:"depends_on"`
8079
Dataset *DatasetModel `tfsdk:"dataset"`
8180
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
82-
EnumJqQuery types.String `tfsdk:"enum_jq_query"`
81+
Visible types.Bool `tfsdk:"visible"`
82+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
83+
84+
Default types.Float64 `tfsdk:"default"`
85+
Maximum types.Float64 `tfsdk:"maximum"`
86+
Minimum types.Float64 `tfsdk:"minimum"`
87+
Enum types.List `tfsdk:"enum"`
88+
EnumJqQuery types.String `tfsdk:"enum_jq_query"`
8389
}
8490

8591
type BooleanPropModel struct {
8692
Title types.String `tfsdk:"title"`
8793
Icon types.String `tfsdk:"icon"`
8894
Description types.String `tfsdk:"description"`
89-
Default types.Bool `tfsdk:"default"`
9095
Required types.Bool `tfsdk:"required"`
9196
DependsOn types.List `tfsdk:"depends_on"`
9297
Dataset *DatasetModel `tfsdk:"dataset"`
9398
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
99+
Visible types.Bool `tfsdk:"visible"`
100+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
101+
102+
Default types.Bool `tfsdk:"default"`
94103
}
95104

96105
type ArrayPropModel struct {
97106
Title types.String `tfsdk:"title"`
98107
Icon types.String `tfsdk:"icon"`
99108
Description types.String `tfsdk:"description"`
100-
MaxItems types.Int64 `tfsdk:"max_items"`
101-
MinItems types.Int64 `tfsdk:"min_items"`
102109
Required types.Bool `tfsdk:"required"`
103-
StringItems *StringItems `tfsdk:"string_items"`
104-
NumberItems *NumberItems `tfsdk:"number_items"`
105-
BooleanItems *BooleanItems `tfsdk:"boolean_items"`
106-
ObjectItems *ObjectItems `tfsdk:"object_items"`
107110
DependsOn types.List `tfsdk:"depends_on"`
108111
Dataset *DatasetModel `tfsdk:"dataset"`
109112
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
113+
Visible types.Bool `tfsdk:"visible"`
114+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
115+
116+
MaxItems types.Int64 `tfsdk:"max_items"`
117+
MinItems types.Int64 `tfsdk:"min_items"`
118+
StringItems *StringItems `tfsdk:"string_items"`
119+
NumberItems *NumberItems `tfsdk:"number_items"`
120+
BooleanItems *BooleanItems `tfsdk:"boolean_items"`
121+
ObjectItems *ObjectItems `tfsdk:"object_items"`
110122
}
111123

112124
type ObjectPropModel struct {
113125
Title types.String `tfsdk:"title"`
114126
Icon types.String `tfsdk:"icon"`
115127
Description types.String `tfsdk:"description"`
116128
Required types.Bool `tfsdk:"required"`
117-
Default types.String `tfsdk:"default"`
118129
DependsOn types.List `tfsdk:"depends_on"`
119130
Dataset *DatasetModel `tfsdk:"dataset"`
120131
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
121-
Encryption types.String `tfsdk:"encryption"`
132+
Visible types.Bool `tfsdk:"visible"`
133+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
134+
135+
Default types.String `tfsdk:"default"`
136+
Encryption types.String `tfsdk:"encryption"`
122137
}
123138

124139
type StringItems struct {

port/action/number.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ func numberPropResourceToBody(ctx context.Context, state *ActionModel, props map
8585
property.Dataset = actionDataSetToPortBody(prop.Dataset)
8686
}
8787

88+
if !prop.Visible.IsNull() {
89+
property.Visible = prop.Visible.ValueBoolPointer()
90+
}
91+
92+
if !prop.VisibleJqQuery.IsNull() {
93+
VisibleJqQueryMap := map[string]string{
94+
"jqQuery": prop.VisibleJqQuery.ValueString(),
95+
}
96+
property.Visible = VisibleJqQueryMap
97+
}
98+
8899
props[propIdentifier] = property
89100
}
90101
if prop.Required.ValueBool() {

port/action/object.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ func objectPropResourceToBody(ctx context.Context, d *ActionModel, props map[str
6767
property.Dataset = actionDataSetToPortBody(prop.Dataset)
6868
}
6969

70+
if !prop.Visible.IsNull() {
71+
property.Visible = prop.Visible.ValueBoolPointer()
72+
}
73+
74+
if !prop.VisibleJqQuery.IsNull() {
75+
VisibleJqQueryMap := map[string]string{
76+
"jqQuery": prop.VisibleJqQuery.ValueString(),
77+
}
78+
property.Visible = VisibleJqQueryMap
79+
}
80+
7081
props[propIdentifier] = property
7182
}
7283

0 commit comments

Comments
 (0)