Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
talsabagport committed Apr 30, 2024
1 parent 8d21b9a commit 12ffb73
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 166 deletions.
164 changes: 18 additions & 146 deletions docs/resources/port_action.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,6 @@ description: |-
})
}
}
Example Usage with Automation trigger
Port allows setting an automation trigger to an action, for executing an action based on event occurred to an entity in Port.
hcl
resource "port_action" "delete_temporary_microservice" {
title = "Delete Temporary Microservice"
identifier = "delete-temp-microservice"
icon = "Terraform"
automation_trigger = {
timer_property_expired_event = {
blueprint_identifier = port_blueprint.microservice.identifier
property_identifier = "ttl"
}
}
kafka_method = {
payload = jsonencode({
runId: "{{.run.id}}"
})
}
}
---

# port_action (Resource)
Expand All @@ -124,16 +104,16 @@ resource "port_action" "create_microservice" {
required = true
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
}
}
number_props = {
Expand Down Expand Up @@ -163,14 +143,14 @@ resource "port_action" "create_microservice" {
string_items = {
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
}
}
}
Expand All @@ -184,29 +164,6 @@ resource "port_action" "create_microservice" {
}
```

## Example Usage with Automation trigger

Port allows setting an automation trigger to an action, for executing an action based on event occurred to an entity in Port.

```hcl
resource "port_action" "delete_temporary_microservice" {
title = "Delete Temporary Microservice"
identifier = "delete-temp-microservice"
icon = "Terraform"
automation_trigger = {
timer_property_expired_event = {
blueprint_identifier = port_blueprint.microservice.identifier
property_identifier = "ttl"
}
}
kafka_method = {
payload = jsonencode({
runId: "{{.run.id}}"
})
}
}
```



<!-- schema generated by tfplugindocs -->
Expand All @@ -220,7 +177,6 @@ resource "port_action" "delete_temporary_microservice" {

- `approval_email_notification` (Object) The email notification of the approval (see [below for nested schema](#nestedatt--approval_email_notification))
- `approval_webhook_notification` (Attributes) The webhook notification of the approval (see [below for nested schema](#nestedatt--approval_webhook_notification))
- `automation_trigger` (Attributes) Automation trigger for the action (see [below for nested schema](#nestedatt--automation_trigger))
- `azure_method` (Attributes) Azure DevOps invocation method (see [below for nested schema](#nestedatt--azure_method))
- `blueprint` (String, Deprecated) The blueprint identifier the action relates to
- `description` (String) Description
Expand All @@ -232,7 +188,6 @@ resource "port_action" "delete_temporary_microservice" {
- `required_approval` (Boolean) Require approval before invoking the action
- `self_service_trigger` (Attributes) Self service trigger for the action (see [below for nested schema](#nestedatt--self_service_trigger))
- `title` (String) Title
- `upsert_entity_method` (Attributes) Upsert Entity invocation method (see [below for nested schema](#nestedatt--upsert_entity_method))
- `webhook_method` (Attributes) Webhook invocation method (see [below for nested schema](#nestedatt--webhook_method))

### Read-Only
Expand All @@ -258,72 +213,6 @@ Optional:
- `format` (String) The format to invoke the webhook


<a id="nestedatt--automation_trigger"></a>
### Nested Schema for `automation_trigger`

Optional:

- `any_entity_change_event` (Attributes) Any entity change event trigger (see [below for nested schema](#nestedatt--automation_trigger--any_entity_change_event))
- `entity_created_event` (Attributes) Entity created event trigger (see [below for nested schema](#nestedatt--automation_trigger--entity_created_event))
- `entity_deleted_event` (Attributes) Entity deleted event trigger (see [below for nested schema](#nestedatt--automation_trigger--entity_deleted_event))
- `entity_updated_event` (Attributes) Entity updated event trigger (see [below for nested schema](#nestedatt--automation_trigger--entity_updated_event))
- `jq_condition` (Attributes) JQ condition for automation trigger (see [below for nested schema](#nestedatt--automation_trigger--jq_condition))
- `timer_property_expired_event` (Attributes) Timer property expired event trigger (see [below for nested schema](#nestedatt--automation_trigger--timer_property_expired_event))

<a id="nestedatt--automation_trigger--any_entity_change_event"></a>
### Nested Schema for `automation_trigger.any_entity_change_event`

Required:

- `blueprint_identifier` (String) The blueprint identifier of the changed entity


<a id="nestedatt--automation_trigger--entity_created_event"></a>
### Nested Schema for `automation_trigger.entity_created_event`

Required:

- `blueprint_identifier` (String) The blueprint identifier of the created entity


<a id="nestedatt--automation_trigger--entity_deleted_event"></a>
### Nested Schema for `automation_trigger.entity_deleted_event`

Required:

- `blueprint_identifier` (String) The blueprint identifier of the deleted entity


<a id="nestedatt--automation_trigger--entity_updated_event"></a>
### Nested Schema for `automation_trigger.entity_updated_event`

Required:

- `blueprint_identifier` (String) The blueprint identifier of the updated entity


<a id="nestedatt--automation_trigger--jq_condition"></a>
### Nested Schema for `automation_trigger.jq_condition`

Required:

- `expressions` (List of String) The jq expressions of the condition

Optional:

- `combinator` (String) The combinator of the condition


<a id="nestedatt--automation_trigger--timer_property_expired_event"></a>
### Nested Schema for `automation_trigger.timer_property_expired_event`

Required:

- `blueprint_identifier` (String) The blueprint identifier of the expired timer property
- `property_identifier` (String) The property identifier of the expired timer property



<a id="nestedatt--azure_method"></a>
### Nested Schema for `azure_method`

Expand Down Expand Up @@ -570,23 +459,6 @@ Optional:



<a id="nestedatt--upsert_entity_method"></a>
### Nested Schema for `upsert_entity_method`

Required:

- `blueprint_identifier` (String) Required when selecting type Upsert Entity. The blueprint identifier of the entity for the upsert
- `identifier` (String) Required when selecting type Upsert Entity. The entity identifier for the upsert

Optional:

- `icon` (String) The icon of the entity
- `properties` (String) The properties of the entity (key-value object encoded to a string)
- `relations` (String) The relations of the entity (key-value object encoded to a string)
- `teams` (List of String) The teams the entity belongs to
- `title` (String) The title of the entity


<a id="nestedatt--webhook_method"></a>
### Nested Schema for `webhook_method`

Expand Down
2 changes: 0 additions & 2 deletions port/action-permissions/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ func TestAccPortActionWithEmptyFieldsExpectDefaultsToApply(t *testing.T) {
var testAccActionPermissionsConfigCreate = testAccCreateBlueprintAndActionConfig(blueprintIdentifier, actionIdentifier) + `
resource "port_action_permissions" "create_microservice_permissions" {
action_identifier = port_action.create_microservice.identifier
blueprint_identifier = port_blueprint.microservice.identifier
permissions = {
"execute": {}
"approve": {}
Expand All @@ -511,7 +510,6 @@ func TestAccPortActionWithEmptyFieldsExpectDefaultsToApply(t *testing.T) {
Config: testAccActionPermissionsConfigCreate,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("port_action_permissions.create_microservice_permissions", "action_identifier", actionIdentifier),
resource.TestCheckResourceAttr("port_action_permissions.create_microservice_permissions", "blueprint_identifier", blueprintIdentifier),
resource.TestCheckResourceAttr("port_action_permissions.create_microservice_permissions", "permissions.execute.roles.#", "0"),
resource.TestCheckResourceAttr("port_action_permissions.create_microservice_permissions", "permissions.execute.users.#", "0"),
resource.TestCheckResourceAttr("port_action_permissions.create_microservice_permissions", "permissions.execute.teams.#", "0"),
Expand Down
36 changes: 18 additions & 18 deletions port/action/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,16 +1039,16 @@ resource "port_action" "create_microservice" {
required = true
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
dataset = {
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = {
jq_query = "\"specificValue\""
}
}]
}
}
}
number_props = {
Expand Down Expand Up @@ -1078,14 +1078,14 @@ resource "port_action" "create_microservice" {
string_items = {
format = "entity"
blueprint = port_blueprint.parent.identifier
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
dataset = jsonencode({
combinator = "and"
rules = [{
property = "$title"
operator = "contains"
value = "specificValue"
}]
})
}
}
}
Expand Down

0 comments on commit 12ffb73

Please sign in to comment.