We are currently unable to define aggregate properties for the
_team
system blueprint via the Terraform Provider.
Example Terraform resource:
resource "port_aggregation_properties" "team-aggregations" {
blueprint_identifier = "_team"
properties = {
metric_avg_deployment_frequency = {
target_blueprint_identifier = "github-repository"
title = "Deployment Frequency"
method = {
average_by_property = {
average_of = "total"
measure_time_by = "$createdAt"
property = "metric_avg_deployment_frequency"
}
}
path_filter = [
{
from_blueprint = "github-repository"
path = ["$team"]
}
]
}
}
}
When running
terraform apply
this generates the following error:
│ Error: failed to create aggregation properties
│ with module.data-model.port_aggregation_properties.team-aggregations,
│ on data-model/teams.tf line 50, in resource "port_aggregation_properties" "team-aggregations":
│ 50: resource "port_aggregation_properties" "team-aggregations" {
│ failed to create blueprint, got:
│ {"ok":false,"error":"protected_blueprint_violation","message":"The property
│ size of Team blueprint cannot be modified","details":{"blueprint":"Team"}}
The
size
property is not under our control - it's part of the system blueprint.
We cannot add the
size
aggregation to the Terraform resource, as the Terraform provider then attempts to create it - when it already exists:
resource "port_aggregation_properties" "team-aggregations" {
blueprint_identifier = "_team"
properties = {
# This aggregation is defined by Port - as part of the _team system-managed blueprint
size = {
target_blueprint_identifier = "_user"
title = "Size"
method = {
count_entities = true
}
}
# ...etc
}
}
│ Error: aggregation property already exists
│ with module.data-model.port_aggregation_properties.team-aggregations,
│ on data-model/teams.tf line 50, in resource "port_aggregation_properties" "team-aggregations":
│ 50: resource "port_aggregation_properties" "team-aggregations" {
│ size