action

package
v2.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceMarkdownDescription = `


# 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\""
                            }
                        }]
                    }
                    sort = {
                        property = "$updatedAt"
                        order = "DESC"
                    }
				}
			}
			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"
                            }]
                        })
					}
                    sort = {
                        property = "$updatedAt"
                        order = "DESC"
                    }
				}
			}
		}
	}
	kafka_method = {
		payload = jsonencode({
		  runId: "{{"{{.run.id}}"}}"
		})
	}
}` + "\n```" + `

## 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}}"}}"
		})
	}
}
` + "\n```" + `

## Example Usage With Condition

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

`

Functions

func ActionSchema

func ActionSchema() map[string]schema.Attribute

func ArrayPropertySchema

func ArrayPropertySchema() schema.Attribute

func BooleanPropertySchema

func BooleanPropertySchema() schema.Attribute

func MetadataProperties

func MetadataProperties() map[string]schema.Attribute

func NewActionResource

func NewActionResource() resource.Resource

func NumberPropertySchema

func NumberPropertySchema() schema.Attribute

func ObjectPropertySchema

func ObjectPropertySchema() schema.Attribute

func StringBooleanOrJQTemplateValidator

func StringBooleanOrJQTemplateValidator() []validator.String

func StringPropertySchema

func StringPropertySchema() schema.Attribute

Types

type ActionModel

type ActionModel struct {
	ID                          types.String                      `tfsdk:"id"`
	Identifier                  types.String                      `tfsdk:"identifier"`
	Blueprint                   types.String                      `tfsdk:"blueprint"`
	Title                       types.String                      `tfsdk:"title"`
	Icon                        types.String                      `tfsdk:"icon"`
	Description                 types.String                      `tfsdk:"description"`
	SelfServiceTrigger          *SelfServiceTriggerModel          `tfsdk:"self_service_trigger"`
	AutomationTrigger           *AutomationTriggerModel           `tfsdk:"automation_trigger"`
	KafkaMethod                 *KafkaMethodModel                 `tfsdk:"kafka_method"`
	WebhookMethod               *WebhookMethodModel               `tfsdk:"webhook_method"`
	GithubMethod                *GithubMethodModel                `tfsdk:"github_method"`
	GitlabMethod                *GitlabMethodModel                `tfsdk:"gitlab_method"`
	AzureMethod                 *AzureMethodModel                 `tfsdk:"azure_method"`
	UpsertEntityMethod          *UpsertEntityMethodModel          `tfsdk:"upsert_entity_method"`
	RequiredApproval            types.String                      `tfsdk:"required_approval"`
	ApprovalWebhookNotification *ApprovalWebhookNotificationModel `tfsdk:"approval_webhook_notification"`
	ApprovalEmailNotification   types.Object                      `tfsdk:"approval_email_notification"`
	Publish                     types.Bool                        `tfsdk:"publish"`
}

type ActionResource

type ActionResource struct {
	// contains filtered or unexported fields
}

func (*ActionResource) Configure

func (*ActionResource) Create

func (*ActionResource) Delete

func (*ActionResource) ImportState

func (*ActionResource) Metadata

func (*ActionResource) Read

func (*ActionResource) Schema

func (*ActionResource) Update

func (*ActionResource) ValidateConfig

type ActionTitle added in v2.9.0

type ActionTitle struct {
	Title          types.String `tfsdk:"title"`
	Description    types.String `tfsdk:"description"`
	Visible        types.Bool   `tfsdk:"visible"`
	VisibleJqQuery types.String `tfsdk:"visible_jq_query"`
}

type ActionValidationModel

type ActionValidationModel struct {
	ID                          types.String `tfsdk:"id"`
	Identifier                  types.String `tfsdk:"identifier"`
	Blueprint                   types.String `tfsdk:"blueprint"`
	Title                       types.String `tfsdk:"title"`
	Icon                        types.String `tfsdk:"icon"`
	Description                 types.String `tfsdk:"description"`
	SelfServiceTrigger          types.Object `tfsdk:"self_service_trigger"`
	AutomationTrigger           types.Object `tfsdk:"automation_trigger"`
	KafkaMethod                 types.Object `tfsdk:"kafka_method"`
	WebhookMethod               types.Object `tfsdk:"webhook_method"`
	GithubMethod                types.Object `tfsdk:"github_method"`
	GitlabMethod                types.Object `tfsdk:"gitlab_method"`
	AzureMethod                 types.Object `tfsdk:"azure_method"`
	UpsertEntityMethod          types.Object `tfsdk:"upsert_entity_method"`
	RequiredApproval            types.String `tfsdk:"required_approval"`
	ApprovalWebhookNotification types.Object `tfsdk:"approval_webhook_notification"`
	ApprovalEmailNotification   types.Object `tfsdk:"approval_email_notification"`
	Publish                     types.Bool   `tfsdk:"publish"`
}

ActionValidationModel is a model used for the validation of ActionModel resources

type AnyEntityChangeEventModel

type AnyEntityChangeEventModel struct {
	BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"`
}

type AnyRunChangeEvent added in v2.0.21

type AnyRunChangeEvent struct {
	ActionIdentifier types.String `tfsdk:"action_identifier"`
}

type ApprovalWebhookNotificationModel

type ApprovalWebhookNotificationModel struct {
	Url    types.String `tfsdk:"url"`
	Format types.String `tfsdk:"format"`
}

type ArrayPropModel

type ArrayPropModel struct {
	Title           types.String `tfsdk:"title"`
	Icon            types.String `tfsdk:"icon"`
	Description     types.String `tfsdk:"description"`
	Required        types.Bool   `tfsdk:"required"`
	DependsOn       types.List   `tfsdk:"depends_on"`
	DefaultJqQuery  types.String `tfsdk:"default_jq_query"`
	Visible         types.Bool   `tfsdk:"visible"`
	VisibleJqQuery  types.String `tfsdk:"visible_jq_query"`
	Disabled        types.Bool   `tfsdk:"disabled"`
	DisabledJqQuery types.String `tfsdk:"disabled_jq_query"`

	MaxItems     types.Int64        `tfsdk:"max_items"`
	MinItems     types.Int64        `tfsdk:"min_items"`
	StringItems  *StringItems       `tfsdk:"string_items"`
	NumberItems  *NumberItems       `tfsdk:"number_items"`
	BooleanItems *BooleanItems      `tfsdk:"boolean_items"`
	ObjectItems  *ObjectItems       `tfsdk:"object_items"`
	Sort         *EntitiesSortModel `tfsdk:"sort"`
}

type ArrayPropValidationModel

type ArrayPropValidationModel struct {
	Title    string
	Required *bool
}

ArrayPropValidationModel is a model used for the validation of StringPropModel resources

func (*ArrayPropValidationModel) FromTerraform5Value

func (e *ArrayPropValidationModel) FromTerraform5Value(val tftypes.Value) error

type AutomationTriggerModel added in v2.0.8

type AutomationTriggerModel struct {
	EntityCreatedEvent        *EntityCreatedEventModel        `tfsdk:"entity_created_event"`
	EntityUpdatedEvent        *EntityUpdatedEventModel        `tfsdk:"entity_updated_event"`
	EntityDeletedEvent        *EntityDeletedEventModel        `tfsdk:"entity_deleted_event"`
	AnyEntityChangeEvent      *AnyEntityChangeEventModel      `tfsdk:"any_entity_change_event"`
	TimerPropertyExpiredEvent *TimerPropertyExpiredEventModel `tfsdk:"timer_property_expired_event"`
	RunCreatedEvent           *RunCreatedEvent                `tfsdk:"run_created_event"`
	RunUpdatedEvent           *RunUpdatedEvent                `tfsdk:"run_updated_event"`
	AnyRunChangeEvent         *AnyRunChangeEvent              `tfsdk:"any_run_change_event"`
	JqCondition               *JqConditionModel               `tfsdk:"jq_condition"`
}

type AzureMethodModel

type AzureMethodModel struct {
	Org     types.String `tfsdk:"org"`
	Webhook types.String `tfsdk:"webhook"`
	Payload types.String `tfsdk:"payload"`
}

type BooleanItems

type BooleanItems struct {
	Default types.List `tfsdk:"default"`
}

type BooleanPropModel

type BooleanPropModel struct {
	Title           types.String `tfsdk:"title"`
	Icon            types.String `tfsdk:"icon"`
	Description     types.String `tfsdk:"description"`
	Required        types.Bool   `tfsdk:"required"`
	DependsOn       types.List   `tfsdk:"depends_on"`
	Default         types.Bool   `tfsdk:"default"`
	DefaultJqQuery  types.String `tfsdk:"default_jq_query"`
	Visible         types.Bool   `tfsdk:"visible"`
	VisibleJqQuery  types.String `tfsdk:"visible_jq_query"`
	Disabled        types.Bool   `tfsdk:"disabled"`
	DisabledJqQuery types.String `tfsdk:"disabled_jq_query"`
}

type BooleanPropValidationModel

type BooleanPropValidationModel struct {
	Title    string
	Required *bool
}

BooleanPropValidationModel is a model used for the validation of StringPropModel resources

func (*BooleanPropValidationModel) FromTerraform5Value

func (e *BooleanPropValidationModel) FromTerraform5Value(val tftypes.Value) error

type DatasetModel

type DatasetModel struct {
	Combinator types.String `tfsdk:"combinator"`
	Rules      []Rule       `tfsdk:"rules"`
}

type EntitiesSortModel added in v2.0.20

type EntitiesSortModel struct {
	Property types.String `tfsdk:"property"`
	Order    types.String `tfsdk:"order"`
}

type EntityCreatedEventModel

type EntityCreatedEventModel struct {
	BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"`
}

type EntityDeletedEventModel

type EntityDeletedEventModel struct {
	BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"`
}

type EntityUpdatedEventModel

type EntityUpdatedEventModel struct {
	BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"`
}

type GithubMethodModel

type GithubMethodModel struct {
	Org                  types.String `tfsdk:"org"`
	Repo                 types.String `tfsdk:"repo"`
	Workflow             types.String `tfsdk:"workflow"`
	WorkflowInputs       types.String `tfsdk:"workflow_inputs"`
	ReportWorkflowStatus types.String `tfsdk:"report_workflow_status"`
}

type GitlabMethodModel

type GitlabMethodModel struct {
	ProjectName       types.String `tfsdk:"project_name"`
	GroupName         types.String `tfsdk:"group_name"`
	DefaultRef        types.String `tfsdk:"default_ref"`
	PipelineVariables types.String `tfsdk:"pipeline_variables"`
}

type JqConditionModel

type JqConditionModel struct {
	Expressions []types.String `tfsdk:"expressions"`
	Combinator  types.String   `tfsdk:"combinator"`
}

type KafkaMethodModel

type KafkaMethodModel struct {
	Payload types.String `tfsdk:"payload"`
}

type MappingModel added in v2.0.8

type MappingModel struct {
	Properties types.String   `tfsdk:"properties"`
	Relations  types.String   `tfsdk:"relations"`
	Identifier types.String   `tfsdk:"identifier"`
	Teams      []types.String `tfsdk:"teams"`
	TeamsJQ    types.String   `tfsdk:"teams_jq"`
	Icon       types.String   `tfsdk:"icon"`
}

type NumberItems

type NumberItems struct {
	Default     types.List   `tfsdk:"default"`
	Enum        types.List   `tfsdk:"enum"`
	EnumJqQuery types.String `tfsdk:"enum_jq_query"`
}

type NumberPropModel

type NumberPropModel struct {
	Title           types.String  `tfsdk:"title"`
	Icon            types.String  `tfsdk:"icon"`
	Description     types.String  `tfsdk:"description"`
	Required        types.Bool    `tfsdk:"required"`
	DependsOn       types.List    `tfsdk:"depends_on"`
	Default         types.Float64 `tfsdk:"default"`
	DefaultJqQuery  types.String  `tfsdk:"default_jq_query"`
	Visible         types.Bool    `tfsdk:"visible"`
	VisibleJqQuery  types.String  `tfsdk:"visible_jq_query"`
	Disabled        types.Bool    `tfsdk:"disabled"`
	DisabledJqQuery types.String  `tfsdk:"disabled_jq_query"`

	Maximum     types.Float64 `tfsdk:"maximum"`
	Minimum     types.Float64 `tfsdk:"minimum"`
	Enum        types.List    `tfsdk:"enum"`
	EnumColors  types.Map     `tfsdk:"enum_colors"`
	EnumJqQuery types.String  `tfsdk:"enum_jq_query"`
}

type NumberPropValidationModel

type NumberPropValidationModel struct {
	Title    string
	Required *bool
}

NumberPropValidationModel is a model used for the validation of StringPropModel resources

func (*NumberPropValidationModel) FromTerraform5Value

func (e *NumberPropValidationModel) FromTerraform5Value(val tftypes.Value) error

type ObjectItems

type ObjectItems struct {
	Default types.List `tfsdk:"default"`
}

type ObjectPropModel

type ObjectPropModel struct {
	Title           types.String `tfsdk:"title"`
	Icon            types.String `tfsdk:"icon"`
	Description     types.String `tfsdk:"description"`
	Required        types.Bool   `tfsdk:"required"`
	DependsOn       types.List   `tfsdk:"depends_on"`
	DefaultJqQuery  types.String `tfsdk:"default_jq_query"`
	Visible         types.Bool   `tfsdk:"visible"`
	VisibleJqQuery  types.String `tfsdk:"visible_jq_query"`
	Disabled        types.Bool   `tfsdk:"disabled"`
	DisabledJqQuery types.String `tfsdk:"disabled_jq_query"`

	Default    types.String `tfsdk:"default"`
	Encryption types.String `tfsdk:"encryption"`
}

type ObjectPropValidationModel

type ObjectPropValidationModel struct {
	Title    string
	Required *bool
}

ObjectPropValidationModel is a model used for the validation of StringPropModel resources

func (*ObjectPropValidationModel) FromTerraform5Value

func (e *ObjectPropValidationModel) FromTerraform5Value(val tftypes.Value) error

type Rule

type Rule struct {
	Blueprint types.String `tfsdk:"blueprint"`
	Property  types.String `tfsdk:"property"`
	Operator  types.String `tfsdk:"operator"`
	Value     *Value       `tfsdk:"value"`
}

type RunCreatedEvent added in v2.0.21

type RunCreatedEvent struct {
	ActionIdentifier types.String `tfsdk:"action_identifier"`
}

type RunUpdatedEvent added in v2.0.17

type RunUpdatedEvent struct {
	ActionIdentifier types.String `tfsdk:"action_identifier"`
}

type SelfServiceTriggerModel

type SelfServiceTriggerModel struct {
	BlueprintIdentifier types.String           `tfsdk:"blueprint_identifier"`
	Operation           types.String           `tfsdk:"operation"`
	UserProperties      *UserPropertiesModel   `tfsdk:"user_properties"`
	Titles              map[string]ActionTitle `tfsdk:"titles"`
	RequiredJqQuery     types.String           `tfsdk:"required_jq_query"`
	OrderProperties     types.List             `tfsdk:"order_properties"`
	Steps               []Step                 `tfsdk:"steps"`
	Condition           types.String           `tfsdk:"condition"`
}

type Step added in v2.0.23

type Step struct {
	Title types.String   `tfsdk:"title"`
	Order []types.String `tfsdk:"order"`
}

type StringItems

type StringItems struct {
	Blueprint   types.String `tfsdk:"blueprint"`
	Format      types.String `tfsdk:"format"`
	Default     types.List   `tfsdk:"default"`
	Enum        types.List   `tfsdk:"enum"`
	EnumJqQuery types.String `tfsdk:"enum_jq_query"`
	Dataset     types.String `tfsdk:"dataset"`
}

type StringPropModel

type StringPropModel struct {
	Title           types.String  `tfsdk:"title"`
	Icon            types.String  `tfsdk:"icon"`
	Description     types.String  `tfsdk:"description"`
	Required        types.Bool    `tfsdk:"required"`
	DependsOn       types.List    `tfsdk:"depends_on"`
	Dataset         *DatasetModel `tfsdk:"dataset"`
	DefaultJqQuery  types.String  `tfsdk:"default_jq_query"`
	Visible         types.Bool    `tfsdk:"visible"`
	VisibleJqQuery  types.String  `tfsdk:"visible_jq_query"`
	Disabled        types.Bool    `tfsdk:"disabled"`
	DisabledJqQuery types.String  `tfsdk:"disabled_jq_query"`

	Default        types.String       `tfsdk:"default"`
	Blueprint      types.String       `tfsdk:"blueprint"`
	Format         types.String       `tfsdk:"format"`
	MaxLength      types.Int64        `tfsdk:"max_length"`
	MinLength      types.Int64        `tfsdk:"min_length"`
	Pattern        types.String       `tfsdk:"pattern"`
	PatternJqQuery types.String       `tfsdk:"pattern_jq_query"`
	Enum           types.List         `tfsdk:"enum"`
	EnumColors     types.Map          `tfsdk:"enum_colors"`
	EnumJqQuery    types.String       `tfsdk:"enum_jq_query"`
	Encryption     types.String       `tfsdk:"encryption"`
	Sort           *EntitiesSortModel `tfsdk:"sort"`
}

type StringPropValidationModel

type StringPropValidationModel struct {
	Title    string
	Required *bool
}

StringPropValidationModel is a model used for the validation of StringPropModel resources

func (*StringPropValidationModel) FromTerraform5Value

func (e *StringPropValidationModel) FromTerraform5Value(val tftypes.Value) error

type TimerPropertyExpiredEventModel

type TimerPropertyExpiredEventModel struct {
	BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"`
	PropertyIdentifier  types.String `tfsdk:"property_identifier"`
}

type UpsertEntityMethodModel added in v2.0.8

type UpsertEntityMethodModel struct {
	Title               types.String  `tfsdk:"title"`
	BlueprintIdentifier types.String  `tfsdk:"blueprint_identifier"`
	Mapping             *MappingModel `tfsdk:"mapping"`
}

type UserPropertiesModel

type UserPropertiesModel struct {
	StringProps  map[string]StringPropModel  `tfsdk:"string_props"`
	NumberProps  map[string]NumberPropModel  `tfsdk:"number_props"`
	BooleanProps map[string]BooleanPropModel `tfsdk:"boolean_props"`
	ArrayProps   map[string]ArrayPropModel   `tfsdk:"array_props"`
	ObjectProps  map[string]ObjectPropModel  `tfsdk:"object_props"`
}

type Value

type Value struct {
	JqQuery types.String `tfsdk:"jq_query"`
}

type WebhookMethodModel

type WebhookMethodModel struct {
	Url          types.String `tfsdk:"url"`
	Agent        types.String `tfsdk:"agent"`
	Synchronized types.String `tfsdk:"synchronized"`
	Method       types.String `tfsdk:"method"`
	Headers      types.Map    `tfsdk:"headers"`
	Body         types.String `tfsdk:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL