Documentation
¶
Index ¶
- Variables
- func NewWebhookResource() resource.Resource
- func WebhookMappingSchema() map[string]schema.Attribute
- func WebhookSchema() map[string]schema.Attribute
- func WebhookSecuritySchema() map[string]schema.Attribute
- type EntityModel
- type MappingsModel
- type OperationModel
- type SecurityModel
- type WebhookModel
- type WebhookResource
- func (r *WebhookResource) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *WebhookResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *WebhookResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *WebhookResource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *WebhookResource) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- func (r *WebhookResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *WebhookResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *WebhookResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Constants ¶
This section is empty.
Variables ¶
View Source
var ResourceMarkdownDescription = `
# Webhook resource
Webhook resource can be used to create webhooks integrations in Port.
## Example Usage
` + "```hcl" + `
resource "port_blueprint" "author" {
title = "Author"
icon = "User"
identifier = "author"
properties = {
string_props = {
"name" = {
type = "string"
title = "Name"
}
}
}
}
resource "port_blueprint" "team" {
title = "Team"
icon = "Team"
identifier = "team"
properties = {
string_props = {
"name" = {
type = "string"
title = "Team Name"
}
}
}
}
resource "port_blueprint" "microservice" {
title = "TF test microservice"
icon = "Terraform"
identifier = "microservice"
properties = {
string_props = {
"url" = {
type = "string"
title = "URL"
}
}
}
relations = {
"author" = {
title = "Author"
target = port_blueprint.author.identifier
}
"team" = {
title = "Team"
target = port_blueprint.team.identifier
}
}
}
resource "port_webhook" "create_pr" {
identifier = "pr_webhook"
title = "Webhook with mixed relations"
icon = "Terraform"
enabled = true
mappings = [
{
blueprint = port_blueprint.microservice.identifier
operation = { "type" = "create" }
filter = ".headers.\"x-github-event\" == \"pull_request\""
entity = {
identifier = ".body.pull_request.id | tostring"
title = ".body.pull_request.title"
properties = {
url = ".body.pull_request.html_url"
}
relations = {
# Complex object relation with search query
author = jsonencode({
combinator = "'and'",
rules = [
{
property = "'$identifier'"
operator = "'='"
value = ".body.pull_request.user.login | tostring"
}
]
})
# Simple string relation
team = ".body.repository.owner.login | tostring"
}
}
}
]
depends_on = [
port_blueprint.microservice,
port_blueprint.author,
port_blueprint.team
]
}
# Example with complex identifier using search query
resource "port_webhook" "complex_identifier" {
identifier = "complex_identifier_webhook"
title = "Webhook with complex identifier"
icon = "Terraform"
enabled = true
mappings = [
{
blueprint = port_blueprint.microservice.identifier
operation = { "type" = "create" }
filter = ".headers.\"x-github-event\" == \"push\""
entity = {
# Complex identifier using search query to find entity by ARN
identifier = jsonencode({
combinator = "'and'",
rules = [
{
property = "'arn'"
operator = "'='"
value = ".body.resources[0]"
}
]
})
title = ".body.repository.name"
properties = {
url = ".body.repository.html_url"
}
}
}
]
depends_on = [
port_blueprint.microservice
]
}
` + "\n```" + `
## Notes
- When using object format for relations, ` + "`combinator`, `property`" + ` and ` + "`operator`" + ` fields should be enclosed in single quotes, while ` + "`value`" + ` should not have quotes as it's a JQ expression. The single quotes are required because these fields contain literal string values that must be passed as-is to the Port API, whereas ` + "`value`" + ` contains a JQ expression that should be evaluated dynamically.
- The ` + "`identifier`" + ` field supports both simple JQ expressions (strings) and complex search query objects. When using search query objects, the structure must include ` + "`combinator`" + ` and ` + "`rules`" + ` fields, and each rule must have ` + "`property`" + `, ` + "`operator`" + `, and ` + "`value`" + ` fields.
- For all available operators, see the [Port comparison operators documentation](https://docs.port.io/search-and-query/comparison-operators).
`
Functions ¶
func NewWebhookResource ¶
func WebhookMappingSchema ¶
func WebhookSchema ¶
func WebhookSecuritySchema ¶
Types ¶
type EntityModel ¶
type MappingsModel ¶
type MappingsModel struct {
Blueprint types.String `tfsdk:"blueprint"`
Filter types.String `tfsdk:"filter"`
Operation *OperationModel `tfsdk:"operation"`
ItemsToParse types.String `tfsdk:"items_to_parse"`
Entity *EntityModel `tfsdk:"entity"`
}
type OperationModel ¶ added in v2.4.0
type SecurityModel ¶
type SecurityModel struct {
Secret types.String `tfsdk:"secret"`
SignatureHeaderName types.String `tfsdk:"signature_header_name"`
SignatureAlgorithm types.String `tfsdk:"signature_algorithm"`
SignaturePrefix types.String `tfsdk:"signature_prefix"`
RequestIdentifierPath types.String `tfsdk:"request_identifier_path"`
}
type WebhookModel ¶
type WebhookModel struct {
ID types.String `tfsdk:"id"`
Icon types.String `tfsdk:"icon"`
Identifier types.String `tfsdk:"identifier"`
Title types.String `tfsdk:"title"`
Description types.String `tfsdk:"description"`
Enabled types.Bool `tfsdk:"enabled"`
WebhookKey types.String `tfsdk:"webhook_key"`
Url types.String `tfsdk:"url"`
Security *SecurityModel `tfsdk:"security"`
Mappings []MappingsModel `tfsdk:"mappings"`
CreatedAt types.String `tfsdk:"created_at"`
CreatedBy types.String `tfsdk:"created_by"`
UpdatedAt types.String `tfsdk:"updated_at"`
UpdatedBy types.String `tfsdk:"updated_by"`
}
type WebhookResource ¶
type WebhookResource struct {
// contains filtered or unexported fields
}
func (*WebhookResource) Configure ¶
func (r *WebhookResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (*WebhookResource) Create ¶
func (r *WebhookResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (*WebhookResource) Delete ¶
func (r *WebhookResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (*WebhookResource) ImportState ¶
func (r *WebhookResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
func (*WebhookResource) Metadata ¶
func (r *WebhookResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (*WebhookResource) Read ¶
func (r *WebhookResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (*WebhookResource) Schema ¶
func (r *WebhookResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
func (*WebhookResource) Update ¶
func (r *WebhookResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Click to show internal directories.
Click to hide internal directories.