Skip to main content
Groups organize related objects into collections for easier management, bulk operations, and access control. Use them to group devices by location, role, or any other criteria.

Group Types

Infrahub provides two types of groups:
TypeDescriptionUse Case
Standard GroupStatic membership defined manuallyProduction devices, critical infrastructure
Dynamic GroupMembership based on query filtersAll routers, devices in Atlanta, etc.

Creating Standard Groups

Standard groups have fixed membership that you manage manually.
  1. Navigate to Groups
  2. Click Add Group
  3. Set group properties:
    • Name: Descriptive name (e.g., “Production Routers”)
    • Description: Purpose of the group
    • Label: Optional display label
  4. Add members:
    • Click Add Members
    • Select objects to include
    • Click Save
  5. Click Save

Creating Dynamic Groups

Dynamic groups automatically include objects matching filter criteria.
Dynamic groups are currently in development. The API may change.
  1. Navigate to Groups
  2. Click Add Group
  3. Select Dynamic Group
  4. Set:
    • Name: Group name
    • Description: Purpose
    • Object Type: Kind to filter (e.g., InfraDevice)
    • Filters: Criteria for membership
      • Attribute filters (e.g., status = active)
      • Relationship filters (e.g., site = Atlanta)
  5. Click Save
Members are automatically added/removed as objects match the filters.

Managing Group Membership

Adding Members

  1. Open the group detail page
  2. Click Members tab
  3. Click Add Members
  4. Select objects to add
  5. Click Save

Removing Members

  1. Open the group detail page
  2. Click Members tab
  3. Select members to remove
  4. Click Remove
  5. Confirm removal

Querying Groups

Get All Groups

query {
  CoreStandardGroup {
    edges {
      node {
        id
        name { value }
        description { value }
        members {
          count
          edges {
            node {
              id
              display_label
            }
          }
        }
      }
    }
  }
}

Get Group Members

query {
  CoreStandardGroup(name__value: "production-routers") {
    edges {
      node {
        members {
          edges {
            node {
              ... on InfraDevice {
                id
                name { value }
                site {
                  node {
                    name { value }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Find Groups for an Object

query {
  InfraDevice(name__value: "router-01") {
    edges {
      node {
        member_of_groups {
          edges {
            node {
              name { value }
              description { value }
            }
          }
        }
      }
    }
  }
}

Group Actions

Groups support actions that run on all members.

Creating Group Actions

mutation {
  CoreGroupActionCreate(
    data: {
      name: { value: "backup-configs" }
      description: { value: "Backup device configurations" }
      group: { id: "<group-uuid>" }
      action_type: { value: "transformation" }
      transformation: { id: "<transformation-uuid>" }
    }
  ) {
    ok
    object {
      id
    }
  }
}
When triggered, the action runs the transformation for each group member.

Triggering Group Actions

mutation {
  CoreGroupActionRun(
    data: {
      id: "<action-uuid>"
    }
  ) {
    ok
    task_id
  }
}
The action executes asynchronously. Track progress using the returned task_id.

Group Permissions

Groups integrate with Infrahub’s permission system for access control.

Grant Group Access

mutation {
  CoreAccountGroupCreate(
    data: {
      name: { value: "network-admins" }
      members: [
        { id: "<account-1-uuid>" },
        { id: "<account-2-uuid>" }
      ]
      permissions: [
        {
          object_group: { id: "<object-group-uuid>" }
          permission: { value: "read_write" }
        }
      ]
    }
  ) {
    ok
  }
}
Members of network-admins can now read/write objects in the specified object group.

Use Cases

Geographic Grouping

Group devices by location:
# Atlanta devices
atl_group = await client.create(
    kind="CoreStandardGroup",
    name="atlanta-infrastructure",
    members=[d.id for d in await client.all(
        kind="InfraDevice",
        site__name__value="atl1"
    )]
)

Role-Based Grouping

Group devices by function:
# Edge routers
edge_group = await client.create(
    kind="CoreStandardGroup",
    name="edge-routers",
    members=[d.id for d in await client.all(
        kind="InfraDevice",
        role__name__value="edge-router"
    )]
)

Maintenance Windows

Group devices with shared maintenance schedules:
# Weekly maintenance group
maint_group = await client.create(
    kind="CoreStandardGroup",
    name="sunday-maintenance",
    description="Devices with Sunday maintenance window"
)

Compliance Grouping

Group devices by compliance requirements:
# PCI-DSS scope
pci_group = await client.create(
    kind="CoreStandardGroup",
    name="pci-dss-scope",
    description="Devices in PCI-DSS scope"
)

Best Practices

  1. Use descriptive names: Make group purpose clear from the name
  2. Document purpose: Use description to explain membership criteria
  3. Prefer dynamic groups: Automatically maintain membership when possible
  4. Avoid overlapping groups: Clear boundaries reduce confusion
  5. Limit group size: Very large groups (1000+ members) may impact performance
  6. Use groups for permissions: Easier than managing individual object access
  7. Review membership: Periodically audit group membership for accuracy

Next Steps

Build docs developers (and LLMs) love