1. Registry
  2. Packages
  3. Newrelic Provider
  4. API Docs
  5. getTeamsHierarchyLevels
Viewing docs for New Relic v5.80.4
published on Tuesday, Oct 27, 2026 by Pulumi
newrelic logo newrelic logo
Viewing docs for New Relic v5.80.4
published on Tuesday, Oct 27, 2026 by Pulumi

    Use this data source to retrieve the GUIDs and display names of all Teams hierarchy level entities in your New Relic organisation.

    Hierarchy levels define the organisational tiers shown in the Teams UI (for example, “Division” and “Squad”). Their GUIDs are required when configuring the ordered hierarchy in newrelic.TeamsOrganizationSettings.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const all = newrelic.getTeamsHierarchyLevels({});
    const org = new newrelic.TeamsOrganizationSettings("org", {hierarchyLevels: [
        {
            id: all.then(all => all.levels?.[0]?.id),
            name: "Division",
        },
        {
            id: all.then(all => all.levels?.[1]?.id),
            name: "Squad",
        },
    ]});
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    all = newrelic.get_teams_hierarchy_levels()
    org = newrelic.TeamsOrganizationSettings("org", hierarchy_levels=[
        {
            "id": all.levels[0].id,
            "name": "Division",
        },
        {
            "id": all.levels[1].id,
            "name": "Squad",
        },
    ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		all, err := newrelic.GetTeamsHierarchyLevels(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewTeamsOrganizationSettings(ctx, "org", &newrelic.TeamsOrganizationSettingsArgs{
    			HierarchyLevels: newrelic.TeamsOrganizationSettingsHierarchyLevelArray{
    				&newrelic.TeamsOrganizationSettingsHierarchyLevelArgs{
    					Id:   pulumi.String(all.Levels[0].Id),
    					Name: pulumi.String("Division"),
    				},
    				&newrelic.TeamsOrganizationSettingsHierarchyLevelArgs{
    					Id:   pulumi.String(all.Levels[1].Id),
    					Name: pulumi.String("Squad"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var all = NewRelic.GetTeamsHierarchyLevels.Invoke();
    
        var org = new NewRelic.TeamsOrganizationSettings("org", new()
        {
            HierarchyLevels = new[]
            {
                new NewRelic.Inputs.TeamsOrganizationSettingsHierarchyLevelArgs
                {
                    Id = all.Apply(getTeamsHierarchyLevelsResult => getTeamsHierarchyLevelsResult.Levels[0]?.Id),
                    Name = "Division",
                },
                new NewRelic.Inputs.TeamsOrganizationSettingsHierarchyLevelArgs
                {
                    Id = all.Apply(getTeamsHierarchyLevelsResult => getTeamsHierarchyLevelsResult.Levels[1]?.Id),
                    Name = "Squad",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.TeamsOrganizationSettings;
    import com.pulumi.newrelic.TeamsOrganizationSettingsArgs;
    import com.pulumi.newrelic.inputs.TeamsOrganizationSettingsHierarchyLevelArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var all = NewrelicFunctions.getTeamsHierarchyLevels(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            var org = new TeamsOrganizationSettings("org", TeamsOrganizationSettingsArgs.builder()
                .hierarchyLevels(            
                    TeamsOrganizationSettingsHierarchyLevelArgs.builder()
                        .id(all.levels()[0].id())
                        .name("Division")
                        .build(),
                    TeamsOrganizationSettingsHierarchyLevelArgs.builder()
                        .id(all.levels()[1].id())
                        .name("Squad")
                        .build())
                .build());
    
        }
    }
    
    resources:
      org:
        type: newrelic:TeamsOrganizationSettings
        properties:
          hierarchyLevels:
            - id: ${all.levels[0].id}
              name: Division
            - id: ${all.levels[1].id}
              name: Squad
    variables:
      all:
        fn::invoke:
          function: newrelic:getTeamsHierarchyLevels
          arguments: {}
    
    terraform {
      required_providers {
        newrelic = {
          source = "pulumi/newrelic"
        }
      }
    }
    
    data "newrelic_teams_hierarchy_levels" "all" {
    }
    
    resource "newrelic_teams_organization_settings" "org" {
      lifecycle {
        create_before_destroy = true
      }
      hierarchy_levels {
        id   = data.newrelic_teams_hierarchy_levels.all.levels[0].id
        name = "Division"
      }
      hierarchy_levels {
        id   = data.newrelic_teams_hierarchy_levels.all.levels[1].id
        name = "Squad"
      }
    }
    

    Using getTeamsHierarchyLevels

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getTeamsHierarchyLevels(opts?: InvokeOptions): Promise<GetTeamsHierarchyLevelsResult>
    function getTeamsHierarchyLevelsOutput(opts?: InvokeOutputOptions): Output<GetTeamsHierarchyLevelsResult>
    def get_teams_hierarchy_levels(opts: Optional[InvokeOptions] = None) -> GetTeamsHierarchyLevelsResult
    def get_teams_hierarchy_levels_output(opts: Optional[InvokeOutputOptions] = None) -> Output[GetTeamsHierarchyLevelsResult]
    func GetTeamsHierarchyLevels(ctx *Context, opts ...InvokeOption) (*GetTeamsHierarchyLevelsResult, error)
    func GetTeamsHierarchyLevelsOutput(ctx *Context, opts ...InvokeOption) GetTeamsHierarchyLevelsResultOutput

    > Note: This function is named GetTeamsHierarchyLevels in the Go SDK.

    public static class GetTeamsHierarchyLevels 
    {
        public static Task<GetTeamsHierarchyLevelsResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetTeamsHierarchyLevelsResult> Invoke(InvokeOptions? opts = null)
        public static Output<GetTeamsHierarchyLevelsResult> Invoke(InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetTeamsHierarchyLevelsResult> getTeamsHierarchyLevels(InvokeOptions options)
    public static Output<GetTeamsHierarchyLevelsResult> getTeamsHierarchyLevels(InvokeOptions options)
    public static Output<GetTeamsHierarchyLevelsResult> getTeamsHierarchyLevels(InvokeOutputOptions options)
    
    fn::invoke:
      function: newrelic:index/getTeamsHierarchyLevels:getTeamsHierarchyLevels
      arguments:
        # arguments dictionary
    data "newrelic_get_teams_hierarchy_levels" "name" {
        # arguments
    }

    getTeamsHierarchyLevels Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Levels List<Pulumi.NewRelic.Outputs.GetTeamsHierarchyLevelsLevel>
    A list of hierarchy level objects. Each object contains:
    Id string
    The provider-assigned unique ID for this managed resource.
    Levels []GetTeamsHierarchyLevelsLevel
    A list of hierarchy level objects. Each object contains:
    id string
    The provider-assigned unique ID for this managed resource.
    levels list(object)
    A list of hierarchy level objects. Each object contains:
    id String
    The provider-assigned unique ID for this managed resource.
    levels List<GetTeamsHierarchyLevelsLevel>
    A list of hierarchy level objects. Each object contains:
    id string
    The provider-assigned unique ID for this managed resource.
    levels GetTeamsHierarchyLevelsLevel[]
    A list of hierarchy level objects. Each object contains:
    id str
    The provider-assigned unique ID for this managed resource.
    levels Sequence[GetTeamsHierarchyLevelsLevel]
    A list of hierarchy level objects. Each object contains:
    id String
    The provider-assigned unique ID for this managed resource.
    levels List<Property Map>
    A list of hierarchy level objects. Each object contains:

    Supporting Types

    GetTeamsHierarchyLevelsLevel

    Id string
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    Name string
    The current display name of this level (e.g. "Division", "Squad").
    Id string
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    Name string
    The current display name of this level (e.g. "Division", "Squad").
    id string
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    name string
    The current display name of this level (e.g. "Division", "Squad").
    id String
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    name String
    The current display name of this level (e.g. "Division", "Squad").
    id string
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    name string
    The current display name of this level (e.g. "Division", "Squad").
    id str
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    name str
    The current display name of this level (e.g. "Division", "Squad").
    id String
    The entity GUID of the hierarchy level. Pass this to newrelic_teams_organization_settings.hierarchy_levels[*].id to reference and rename the level.
    name String
    The current display name of this level (e.g. "Division", "Squad").

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo newrelic logo
    Viewing docs for New Relic v5.80.4
    published on Tuesday, Oct 27, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial