Skip to content

Commit e08e593

Browse files
authored
Merge pull request #298 from port-labs/task_t4iypz/view-action-runs-permission-terraform
2 parents 55e4cc7 + a1b4091 commit e08e593

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

docs/resources/port_action.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ resource "port_action" "create_microservice" {
318318
- `github_method` (Attributes) GitHub invocation method (see [below for nested schema](#nestedatt--github_method))
319319
- `gitlab_method` (Attributes) Gitlab invocation method (see [below for nested schema](#nestedatt--gitlab_method))
320320
- `icon` (String) Icon
321+
- `is_view_run_access` (Boolean) Whether members can view the runs of this action
321322
- `kafka_method` (Attributes) Kafka invocation method (see [below for nested schema](#nestedatt--kafka_method))
322323
- `publish` (Boolean) Publish action
323324
- `required_approval` (String) Require approval before invoking the action. Can be one of "true", "false", "ANY" or "ALL"

internal/cli/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ type (
292292
RequiredApproval any `json:"requiredApproval,omitempty"`
293293
ApprovalNotification *ApprovalNotification `json:"approvalNotification,omitempty"`
294294
Publish *bool `json:"publish,omitempty"`
295+
IsViewRunAccess *bool `json:"isViewRunAccess,omitempty"`
295296
}
296297

297298
ActionExecutePermissions struct {

port/action/actionStateToPortBody.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ func actionStateToPortBody(ctx context.Context, data *ActionModel) (*cli.Action,
7979
}
8080
}
8181

82+
if !data.IsViewRunAccess.IsNull() {
83+
action.IsViewRunAccess = data.IsViewRunAccess.ValueBoolPointer()
84+
}
85+
8286
return action, nil
8387
}
8488

port/action/model.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,17 @@ func (e *ArrayPropValidationModel) FromTerraform5Value(val tftypes.Value) error
182182
}
183183

184184
type NumberPropModel struct {
185-
Title types.String `tfsdk:"title"`
186-
Icon types.String `tfsdk:"icon"`
187-
Description types.String `tfsdk:"description"`
188-
Required types.Bool `tfsdk:"required"`
189-
DependsOn types.List `tfsdk:"depends_on"`
185+
Title types.String `tfsdk:"title"`
186+
Icon types.String `tfsdk:"icon"`
187+
Description types.String `tfsdk:"description"`
188+
Required types.Bool `tfsdk:"required"`
189+
DependsOn types.List `tfsdk:"depends_on"`
190190
Default types.Float64 `tfsdk:"default"`
191-
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
192-
Visible types.Bool `tfsdk:"visible"`
193-
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
194-
Disabled types.Bool `tfsdk:"disabled"`
195-
DisabledJqQuery types.String `tfsdk:"disabled_jq_query"`
191+
DefaultJqQuery types.String `tfsdk:"default_jq_query"`
192+
Visible types.Bool `tfsdk:"visible"`
193+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
194+
Disabled types.Bool `tfsdk:"disabled"`
195+
DisabledJqQuery types.String `tfsdk:"disabled_jq_query"`
196196

197197
Maximum types.Float64 `tfsdk:"maximum"`
198198
Minimum types.Float64 `tfsdk:"minimum"`
@@ -289,10 +289,10 @@ type UserPropertiesModel struct {
289289
}
290290

291291
type Step struct {
292-
Title types.String `tfsdk:"title"`
293-
Order []types.String `tfsdk:"order"`
294-
Visible types.Bool `tfsdk:"visible"`
295-
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
292+
Title types.String `tfsdk:"title"`
293+
Order []types.String `tfsdk:"order"`
294+
Visible types.Bool `tfsdk:"visible"`
295+
VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
296296
}
297297

298298
type ActionTitle struct {
@@ -436,6 +436,7 @@ type ActionModel struct {
436436
ApprovalWebhookNotification *ApprovalWebhookNotificationModel `tfsdk:"approval_webhook_notification"`
437437
ApprovalEmailNotification types.Object `tfsdk:"approval_email_notification"`
438438
Publish types.Bool `tfsdk:"publish"`
439+
IsViewRunAccess types.Bool `tfsdk:"is_view_run_access"`
439440
}
440441

441442
// ActionValidationModel is a model used for the validation of ActionModel resources
@@ -458,4 +459,5 @@ type ActionValidationModel struct {
458459
ApprovalWebhookNotification types.Object `tfsdk:"approval_webhook_notification"`
459460
ApprovalEmailNotification types.Object `tfsdk:"approval_email_notification"`
460461
Publish types.Bool `tfsdk:"publish"`
462+
IsViewRunAccess types.Bool `tfsdk:"is_view_run_access"`
461463
}

port/action/refreshActionState.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ func (r *ActionResource) refreshActionState(ctx context.Context, state *ActionMo
525525
}
526526
}
527527
state.Publish = flex.GoBoolToFramework(a.Publish)
528+
state.IsViewRunAccess = flex.GoBoolToFramework(a.IsViewRunAccess)
528529

529530
return nil
530531
}

port/action/schema.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ func ActionSchema() map[string]schema.Attribute {
530530
Computed: true,
531531
Default: booldefault.StaticBool(true),
532532
},
533+
"is_view_run_access": schema.BoolAttribute{
534+
MarkdownDescription: "Whether members can view the runs of this action",
535+
Optional: true,
536+
},
533537
}
534538
}
535539

0 commit comments

Comments
 (0)