Skip to content

Latest commit

 

History

History
696 lines (533 loc) · 27.6 KB

port_action.md

File metadata and controls

696 lines (533 loc) · 27.6 KB
page_title subcategory description
port_action Resource - terraform-provider-port-labs
Action resource Docs for the Action resource can be found here https://docs.getport.io/create-self-service-experiences/. Example Usage hcl resource "port_action" "create_microservice" { title = "Create Microservice" identifier = "create-microservice" icon = "Terraform" self_service_trigger = { operation = "CREATE" blueprint_identifier = port_blueprint.microservice.identifier user_properties = { string_props = { myStringIdentifier = { title = "My String Identifier" required = true format = "entity" blueprint = port_blueprint.parent.identifier dataset = { combinator = "and" rules = [{ property = "$title" operator = "contains" value = { jq_query = "\"specificValue\"" } }] } } } number_props = { myNumberIdentifier = { title = "My Number Identifier" required = true maximum = 100 minimum = 0 } } boolean_props = { myBooleanIdentifier = { title = "My Boolean Identifier" required = true } } object_props = { myObjectIdentifier = { title = "My Object Identifier" required = true } } array_props = { myArrayIdentifier = { title = "My Array Identifier" required = true string_items = { format = "entity" blueprint = port_blueprint.parent.identifier dataset = jsonencode({ combinator = "and" rules = [{ property = "$title" operator = "contains" value = "specificValue" }] }) } } } } } kafka_method = { payload = jsonencode({ runId: "{{.run.id}}" }) } } 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 "portaction" "deletetemporarymicroservice" { title = "Delete Temporary Microservice" identifier = "delete-temp-microservice" icon = "Terraform" automationtrigger = { timerpropertyexpiredevent = { blueprintidentifier = portblueprint.microservice.identifier propertyidentifier = "ttl" } } kafka_method = { payload = jsonencode({ runId: "{{.run.id}}" }) } } ``` Example Usage With Condition ```hcl resource "portaction" "createmicroservice" { title = "Create Microservice" identifier = "create-microservice" icon = "Terraform" selfservicetrigger = { operation = "CREATE" blueprintidentifier = portblueprint.microservice.identifier condition = jsonencode({ type = "SEARCH" combinator = "and" rules = [ { property = "$title" operator = "!=" value = "Test" } ] }) userproperties = { stringprops = { myStringIdentifier = { title = "My String Identifier" required = true } } } } kafka_method = { payload = jsonencode({ runId: "{{.run.id}}" }) } ```

port_action (Resource)

Action resource

Docs for the Action resource can be found here.

Example Usage

resource "port_action" "create_microservice" {
	title = "Create Microservice"
	identifier = "create-microservice"
	icon = "Terraform"
	self_service_trigger = {
		operation = "CREATE"
		blueprint_identifier = port_blueprint.microservice.identifier
		user_properties = {
			string_props = {
				myStringIdentifier = {
					title = "My String Identifier"
					required = true
                    format = "entity"
                    blueprint = port_blueprint.parent.identifier
                    dataset = {
                        combinator = "and"
                        rules = [{
                            property = "$title"
                            operator = "contains"
                            value = {
                                jq_query = "\"specificValue\""
                            }
                        }]
                    }
				}
			}
			number_props = {
				myNumberIdentifier = {
					title = "My Number Identifier"
					required = true
					maximum = 100
					minimum = 0
				}
			}
			boolean_props = {
				myBooleanIdentifier = {
					title = "My Boolean Identifier"
					required = true
				}
			}
			object_props = {
				myObjectIdentifier = {
					title = "My Object Identifier"
					required = true
				}
			}
			array_props = {
				myArrayIdentifier = {
					title = "My Array Identifier"
					required = true
					string_items = {
						format = "entity"
                        blueprint = port_blueprint.parent.identifier
                        dataset = jsonencode({
                            combinator = "and"
                            rules = [{
                                property = "$title"
                                operator = "contains"
                                value    = "specificValue"
                            }]
                        })
					}
				}
			}
		}
	}
	kafka_method = {
		payload = jsonencode({
		  runId: "{{.run.id}}"
		})
	}
}

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.

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}}"
		})
	}
}

Example Usage With Condition

resource "port_action" "create_microservice" {
	title = "Create Microservice"
	identifier = "create-microservice"
	icon = "Terraform"
	self_service_trigger = {
		operation = "CREATE"
		blueprint_identifier = port_blueprint.microservice.identifier
		condition = jsonencode({
			type = "SEARCH"
			combinator = "and"
			rules = [
				{
					property = "$title"
					operator = "!="
					value = "Test"
				}
			]
		})
		user_properties = {
			string_props = {
				myStringIdentifier = {
					title = "My String Identifier"
					required = true
				}
			}
		}
	}
	kafka_method = {
		payload = jsonencode({
		  runId: "{{.run.id}}"
		})
	}
	

Schema

Required

  • identifier (String) Identifier

Optional

  • approval_email_notification (Object) The email notification of the approval (see below for nested schema)
  • approval_webhook_notification (Attributes) The webhook notification of the approval (see below for nested schema)
  • automation_trigger (Attributes) Automation trigger for the action (see below for nested schema)
  • azure_method (Attributes) Azure DevOps invocation method (see below for nested schema)
  • blueprint (String, Deprecated) The blueprint identifier the action relates to
  • description (String) Description
  • github_method (Attributes) GitHub invocation method (see below for nested schema)
  • gitlab_method (Attributes) Gitlab invocation method (see below for nested schema)
  • icon (String) Icon
  • kafka_method (Attributes) Kafka invocation method (see below for nested schema)
  • publish (Boolean) Publish action
  • required_approval (String) Require approval before invoking the action. Can be one of "true", "false", "ANY" or "ALL"
  • self_service_trigger (Attributes) Self service trigger for the action (see below for nested schema)
  • title (String) Title
  • upsert_entity_method (Attributes) Upsert Entity invocation method (see below for nested schema)
  • webhook_method (Attributes) Webhook invocation method (see below for nested schema)

Read-Only

  • id (String) The ID of this resource.

Nested Schema for approval_email_notification

Optional:

Nested Schema for approval_webhook_notification

Required:

  • url (String) The URL to invoke the webhook

Optional:

  • format (String) The format to invoke the webhook

Nested Schema for automation_trigger

Optional:

Nested Schema for automation_trigger.any_entity_change_event

Required:

  • blueprint_identifier (String) The blueprint identifier of the changed entity

Nested Schema for automation_trigger.entity_created_event

Required:

  • blueprint_identifier (String) The blueprint identifier of the created entity

Nested Schema for automation_trigger.entity_deleted_event

Required:

  • blueprint_identifier (String) The blueprint identifier of the deleted entity

Nested Schema for automation_trigger.entity_updated_event

Required:

  • blueprint_identifier (String) The blueprint identifier of the updated entity

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

Nested Schema for automation_trigger.run_updated_event

Required:

  • action_identifier (String) The action identifier of the updated run

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

Nested Schema for azure_method

Required:

  • org (String) Required when selecting type AZURE. The Azure org that the workflow belongs to
  • webhook (String) Required when selecting type AZURE. The Azure webhook that the workflow belongs to

Optional:

Nested Schema for github_method

Required:

  • org (String) Required when selecting type GITHUB. The GitHub org that the workflow belongs to
  • repo (String) Required when selecting type GITHUB. The GitHub repo that the workflow belongs to
  • workflow (String) The GitHub workflow that the action belongs to

Optional:

  • report_workflow_status (String) Report the workflow status when invoking the action
  • workflow_inputs (String) The GitHub workflow inputs should be in JSON format, encoded as a string. Use jsonencode to encode arrays or objects. Learn about how to define the action payload.

Nested Schema for gitlab_method

Required:

  • group_name (String) Required when selecting type GITLAB. The GitLab group name that the workflow belongs to
  • project_name (String) Required when selecting type GITLAB. The GitLab project name that the workflow belongs to

Optional:

  • default_ref (String) The default ref of the action
  • pipeline_variables (String) The Gitlab pipeline variables should be in JSON format, encoded as a string. Use jsonencode to encode arrays or objects. Learn about how to define the action payload.

Nested Schema for kafka_method

Optional:

Nested Schema for self_service_trigger

Required:

  • operation (String) The operation type of the action

Optional:

  • blueprint_identifier (String) The ID of the blueprint
  • condition (String) The condition field allows you to define rules using Port's search & query syntax to determine which entities the action will be available for.
  • order_properties (List of String) Order properties
  • required_jq_query (String) The required jq query of the property
  • user_properties (Attributes) User properties (see below for nested schema)

Nested Schema for self_service_trigger.user_properties

Optional:

Nested Schema for self_service_trigger.user_properties.array_props

Optional:

  • boolean_items (Attributes) The items of the array property (see below for nested schema)
  • default_jq_query (String) The default jq query of the array property
  • depends_on (List of String) The properties that this property depends on
  • description (String) The description of the property
  • icon (String) The icon of the property
  • max_items (Number) The max items of the array property
  • min_items (Number) The min items of the array property
  • number_items (Attributes) The items of the array property (see below for nested schema)
  • object_items (Attributes) The items of the array property (see below for nested schema)
  • required (Boolean) Whether the property is required, by default not required, this property can't be set at the same time if required_jq_query is set, and only supports true as value
  • string_items (Attributes) The items of the array property (see below for nested schema)
  • title (String) The title of the property
  • visible (Boolean) The visibility of the array property
  • visible_jq_query (String) The visibility condition jq query of the array property

Nested Schema for self_service_trigger.user_properties.array_props.visible_jq_query

Optional:

  • default (List of Boolean) The default of the items

Nested Schema for self_service_trigger.user_properties.array_props.visible_jq_query

Optional:

  • default (List of Number) The default of the items
  • enum (List of Number) The enum of the items
  • enum_jq_query (String) The enum jq query of the number items

Nested Schema for self_service_trigger.user_properties.array_props.visible_jq_query

Optional:

  • default (List of Map of String) The default of the items

Nested Schema for self_service_trigger.user_properties.array_props.visible_jq_query

Optional:

  • blueprint (String) The blueprint identifier the property relates to
  • dataset (String) The dataset of an the entity-format items
  • default (List of String) The default of the items
  • enum (List of String) The enum of the items
  • enum_jq_query (String) The enum jq query of the string items
  • format (String) The format of the items

Nested Schema for self_service_trigger.user_properties.boolean_props

Optional:

  • default (Boolean) The default of the boolean property
  • default_jq_query (String) The default jq query of the boolean property
  • depends_on (List of String) The properties that this property depends on
  • description (String) The description of the property
  • icon (String) The icon of the property
  • required (Boolean) Whether the property is required, by default not required, this property can't be set at the same time if required_jq_query is set, and only supports true as value
  • title (String) The title of the property
  • visible (Boolean) The visibility of the boolean property
  • visible_jq_query (String) The visibility condition jq query of the boolean property

Nested Schema for self_service_trigger.user_properties.number_props

Optional:

  • default (Number) The default of the number property
  • default_jq_query (String) The default jq query of the number property
  • depends_on (List of String) The properties that this property depends on
  • description (String) The description of the property
  • enum (List of Number) The enum of the number property
  • enum_jq_query (String) The enum jq query of the string property
  • icon (String) The icon of the property
  • maximum (Number) The min of the number property
  • minimum (Number) The max of the number property
  • required (Boolean) Whether the property is required, by default not required, this property can't be set at the same time if required_jq_query is set, and only supports true as value
  • title (String) The title of the property
  • visible (Boolean) The visibility of the number property
  • visible_jq_query (String) The visibility condition jq query of the number property

Nested Schema for self_service_trigger.user_properties.object_props

Optional:

  • default (String) The default of the object property
  • default_jq_query (String) The default jq query of the object property
  • depends_on (List of String) The properties that this property depends on
  • description (String) The description of the property
  • encryption (String) The algorithm to encrypt the property with
  • icon (String) The icon of the property
  • required (Boolean) Whether the property is required, by default not required, this property can't be set at the same time if required_jq_query is set, and only supports true as value
  • title (String) The title of the property
  • visible (Boolean) The visibility of the object property
  • visible_jq_query (String) The visibility condition jq query of the object property

Nested Schema for self_service_trigger.user_properties.string_props

Optional:

  • blueprint (String) The blueprint identifier the string property relates to
  • dataset (Attributes) The dataset of an the entity-format property (see below for nested schema)
  • default (String) The default of the string property
  • default_jq_query (String) The default jq query of the string property
  • depends_on (List of String) The properties that this property depends on
  • description (String) The description of the property
  • encryption (String) The algorithm to encrypt the property with
  • enum (List of String) The enum of the string property
  • enum_jq_query (String) The enum jq query of the string property
  • format (String) The format of the string property
  • icon (String) The icon of the property
  • max_length (Number) The max length of the string property
  • min_length (Number) The min length of the string property
  • pattern (String) The pattern of the string property
  • required (Boolean) Whether the property is required, by default not required, this property can't be set at the same time if required_jq_query is set, and only supports true as value
  • title (String) The title of the property
  • visible (Boolean) The visibility of the string property
  • visible_jq_query (String) The visibility condition jq query of the string property

Nested Schema for self_service_trigger.user_properties.string_props.visible_jq_query

Required:

  • combinator (String) The combinator of the dataset
  • rules (Attributes List) The rules of the dataset (see below for nested schema)

Nested Schema for self_service_trigger.user_properties.string_props.visible_jq_query.rules

Required:

Optional:

  • blueprint (String) The blueprint identifier of the rule
  • property (String) The property identifier of the rule

Nested Schema for self_service_trigger.user_properties.string_props.visible_jq_query.rules.property

Optional:

  • jq_query (String)

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

Optional:

  • mapping (Attributes) Upsert Entity invocation method (see below for nested schema)
  • title (String) The title of the entity

Nested Schema for upsert_entity_method.mapping

Optional:

  • icon (String) The icon of the entity
  • identifier (String) Required when selecting type Upsert Entity. The entity identifier for the upsert
  • 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

Nested Schema for webhook_method

Required:

  • url (String) Required when selecting type WEBHOOK. The URL to invoke the action

Optional:

  • agent (String) Use the agent to invoke the action
  • body (String) The Webhook body should be in JSON format, encoded as a string. Use jsonencode to encode arrays or objects. Learn about how to define the action payload.
  • 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. Learn about how to define the action payload.
  • method (String) The HTTP method to invoke the action
  • synchronized (String) Synchronize the action