1. Registry
  2. Packages
  3. Nsxt Provider
  4. API Docs
  5. getPolicyBaremetalServerGroupAssociations
Viewing docs for nsxt 3.12.1
published on Friday, Sep 11, 2026 by vmware
Viewing docs for nsxt 3.12.1
published on Friday, Sep 11, 2026 by vmware

    This data source provides information about policy groups for which the given bare metal server is a member. This is useful for discovering group membership and understanding firewall rule scope.

    This data source is applicable to NSX Policy Manager and requires NSX-T version 9.0.0 or higher (Bare Metal Server support)

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nsxt from "@pulumi/nsxt";
    
    // Get groups that a specific bare metal server belongs to
    const bm1Groups = nsxt.getPolicyBaremetalServerGroupAssociations({
        externalId: "71be0142-2ed1-1d53-9c60-5564cf4b7e2e",
    });
    // Define required services
    const http = new nsxt.PolicyService("http", {
        displayName: "HTTP-Service",
        l4PortSetEntries: [{
            protocol: "TCP",
            destinationPorts: ["80"],
        }],
    });
    const https = new nsxt.PolicyService("https", {
        displayName: "HTTPS-Service",
        l4PortSetEntries: [{
            protocol: "TCP",
            destinationPorts: ["443"],
        }],
    });
    // Define the web-servers group referenced in the security policy
    const web_servers = new nsxt.PolicyGroup("web-servers", {
        displayName: "Web-Servers-Group",
        description: "Group containing web server bare metal resources",
        criterias: [{
            conditions: [{
                key: "Tag",
                memberType: "BareMetalServer",
                operator: "EQUALS",
                value: "application_tier|web",
            }],
        }],
    });
    // Use the groups in firewall policies
    const bmsPolicy = new nsxt.PolicySecurityPolicy("bms_policy", {
        displayName: "BMS Security Policy",
        category: "Application",
        rules: [{
            displayName: "Allow BMS Communication",
            sourceGroups: bm1Groups.then(bm1Groups => bm1Groups.groups.map(__item => __item.path)),
            destinationGroups: [web_servers.path],
            action: "ALLOW",
            services: [
                http.path,
                https.path,
            ],
        }],
    });
    export const serverGroups = bm1Groups.then(bm1Groups => .reduce((__obj, group) => ({ ...__obj, [group.displayName]: group.path })));
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    # Get groups that a specific bare metal server belongs to
    bm1_groups = nsxt.get_policy_baremetal_server_group_associations(external_id="71be0142-2ed1-1d53-9c60-5564cf4b7e2e")
    # Define required services
    http = nsxt.PolicyService("http",
        display_name="HTTP-Service",
        l4_port_set_entries=[{
            "protocol": "TCP",
            "destination_ports": ["80"],
        }])
    https = nsxt.PolicyService("https",
        display_name="HTTPS-Service",
        l4_port_set_entries=[{
            "protocol": "TCP",
            "destination_ports": ["443"],
        }])
    # Define the web-servers group referenced in the security policy
    web_servers = nsxt.PolicyGroup("web-servers",
        display_name="Web-Servers-Group",
        description="Group containing web server bare metal resources",
        criterias=[{
            "conditions": [{
                "key": "Tag",
                "member_type": "BareMetalServer",
                "operator": "EQUALS",
                "value": "application_tier|web",
            }],
        }])
    # Use the groups in firewall policies
    bms_policy = nsxt.PolicySecurityPolicy("bms_policy",
        display_name="BMS Security Policy",
        category="Application",
        rules=[{
            "display_name": "Allow BMS Communication",
            "source_groups": [__item.path for __item in bm1_groups.groups],
            "destination_groups": [web_servers.path],
            "action": "ALLOW",
            "services": [
                http.path,
                https.path,
            ],
        }])
    pulumi.export("serverGroups", {group.display_name: group.path for group in bm1_groups.groups})
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        // Get groups that a specific bare metal server belongs to
        var bm1Groups = Nsxt.GetPolicyBaremetalServerGroupAssociations.Invoke(new()
        {
            ExternalId = "71be0142-2ed1-1d53-9c60-5564cf4b7e2e",
        });
    
        // Define required services
        var http = new Nsxt.PolicyService("http", new()
        {
            DisplayName = "HTTP-Service",
            L4PortSetEntries = new[]
            {
                new Nsxt.Inputs.PolicyServiceL4PortSetEntryArgs
                {
                    Protocol = "TCP",
                    DestinationPorts = new[]
                    {
                        "80",
                    },
                },
            },
        });
    
        var https = new Nsxt.PolicyService("https", new()
        {
            DisplayName = "HTTPS-Service",
            L4PortSetEntries = new[]
            {
                new Nsxt.Inputs.PolicyServiceL4PortSetEntryArgs
                {
                    Protocol = "TCP",
                    DestinationPorts = new[]
                    {
                        "443",
                    },
                },
            },
        });
    
        // Define the web-servers group referenced in the security policy
        var web_servers = new Nsxt.PolicyGroup("web-servers", new()
        {
            DisplayName = "Web-Servers-Group",
            Description = "Group containing web server bare metal resources",
            Criterias = new[]
            {
                new Nsxt.Inputs.PolicyGroupCriteriaArgs
                {
                    Conditions = new[]
                    {
                        new Nsxt.Inputs.PolicyGroupCriteriaConditionArgs
                        {
                            Key = "Tag",
                            MemberType = "BareMetalServer",
                            Operator = "EQUALS",
                            Value = "application_tier|web",
                        },
                    },
                },
            },
        });
    
        // Use the groups in firewall policies
        var bmsPolicy = new Nsxt.PolicySecurityPolicy("bms_policy", new()
        {
            DisplayName = "BMS Security Policy",
            Category = "Application",
            Rules = new[]
            {
                new Nsxt.Inputs.PolicySecurityPolicyRuleArgs
                {
                    DisplayName = "Allow BMS Communication",
                    SourceGroups = bm1Groups.Apply(getPolicyBaremetalServerGroupAssociationsResult => getPolicyBaremetalServerGroupAssociationsResult.Groups).Select(__item => __item.Path).ToList(),
                    DestinationGroups = new[]
                    {
                        web_servers.Path,
                    },
                    Action = "ALLOW",
                    Services = new[]
                    {
                        http.Path,
                        https.Path,
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["serverGroups"] = .ToDictionary(item => {
                var group = item.Value;
                return @group.DisplayName;
            }, item => {
                var group = item.Value;
                return @group.Path;
            }),
        };
    });
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    

    Using getPolicyBaremetalServerGroupAssociations

    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 getPolicyBaremetalServerGroupAssociations(args: GetPolicyBaremetalServerGroupAssociationsArgs, opts?: InvokeOptions): Promise<GetPolicyBaremetalServerGroupAssociationsResult>
    function getPolicyBaremetalServerGroupAssociationsOutput(args: GetPolicyBaremetalServerGroupAssociationsOutputArgs, opts?: InvokeOutputOptions): Output<GetPolicyBaremetalServerGroupAssociationsResult>
    def get_policy_baremetal_server_group_associations(enforcement_point_path: Optional[str] = None,
                                                       external_id: Optional[str] = None,
                                                       id: Optional[str] = None,
                                                       opts: Optional[InvokeOptions] = None) -> GetPolicyBaremetalServerGroupAssociationsResult
    def get_policy_baremetal_server_group_associations_output(enforcement_point_path: pulumi.Input[Optional[str]] = None,
                                                       external_id: pulumi.Input[Optional[str]] = None,
                                                       id: pulumi.Input[Optional[str]] = None,
                                                       opts: Optional[InvokeOutputOptions] = None) -> Output[GetPolicyBaremetalServerGroupAssociationsResult]
    func GetPolicyBaremetalServerGroupAssociations(ctx *Context, args *GetPolicyBaremetalServerGroupAssociationsArgs, opts ...InvokeOption) (*GetPolicyBaremetalServerGroupAssociationsResult, error)
    func GetPolicyBaremetalServerGroupAssociationsOutput(ctx *Context, args *GetPolicyBaremetalServerGroupAssociationsOutputArgs, opts ...InvokeOption) GetPolicyBaremetalServerGroupAssociationsResultOutput

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

    public static class GetPolicyBaremetalServerGroupAssociations 
    {
        public static Task<GetPolicyBaremetalServerGroupAssociationsResult> InvokeAsync(GetPolicyBaremetalServerGroupAssociationsArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyBaremetalServerGroupAssociationsResult> Invoke(GetPolicyBaremetalServerGroupAssociationsInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyBaremetalServerGroupAssociationsResult> Invoke(GetPolicyBaremetalServerGroupAssociationsInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetPolicyBaremetalServerGroupAssociationsResult> getPolicyBaremetalServerGroupAssociations(GetPolicyBaremetalServerGroupAssociationsArgs args, InvokeOptions options)
    public static Output<GetPolicyBaremetalServerGroupAssociationsResult> getPolicyBaremetalServerGroupAssociations(GetPolicyBaremetalServerGroupAssociationsArgs args, InvokeOptions options)
    public static Output<GetPolicyBaremetalServerGroupAssociationsResult> getPolicyBaremetalServerGroupAssociations(GetPolicyBaremetalServerGroupAssociationsArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: nsxt:index/getPolicyBaremetalServerGroupAssociations:getPolicyBaremetalServerGroupAssociations
      arguments:
        # arguments dictionary
    data "nsxt_get_policy_baremetal_server_group_associations" "name" {
        # arguments
    }

    The following arguments are supported:

    ExternalId string
    External ID of the bare metal server.
    EnforcementPointPath string
    Path of the enforcement point.
    Id string
    ID of the data source.
    ExternalId string
    External ID of the bare metal server.
    EnforcementPointPath string
    Path of the enforcement point.
    Id string
    ID of the data source.
    external_id string
    External ID of the bare metal server.
    enforcement_point_path string
    Path of the enforcement point.
    id string
    ID of the data source.
    externalId String
    External ID of the bare metal server.
    enforcementPointPath String
    Path of the enforcement point.
    id String
    ID of the data source.
    externalId string
    External ID of the bare metal server.
    enforcementPointPath string
    Path of the enforcement point.
    id string
    ID of the data source.
    external_id str
    External ID of the bare metal server.
    enforcement_point_path str
    Path of the enforcement point.
    id str
    ID of the data source.
    externalId String
    External ID of the bare metal server.
    enforcementPointPath String
    Path of the enforcement point.
    id String
    ID of the data source.

    getPolicyBaremetalServerGroupAssociations Result

    The following output properties are available:

    ExternalId string
    Groups List<GetPolicyBaremetalServerGroupAssociationsGroup>
    List of groups this bare metal server is a member of. Each group contains:
    Id string
    ID of the data source.
    EnforcementPointPath string
    ExternalId string
    Groups []GetPolicyBaremetalServerGroupAssociationsGroup
    List of groups this bare metal server is a member of. Each group contains:
    Id string
    ID of the data source.
    EnforcementPointPath string
    external_id string
    groups list(object)
    List of groups this bare metal server is a member of. Each group contains:
    id string
    ID of the data source.
    enforcement_point_path string
    externalId String
    groups List<GetPolicyBaremetalServerGroupAssociationsGroup>
    List of groups this bare metal server is a member of. Each group contains:
    id String
    ID of the data source.
    enforcementPointPath String
    externalId string
    groups GetPolicyBaremetalServerGroupAssociationsGroup[]
    List of groups this bare metal server is a member of. Each group contains:
    id string
    ID of the data source.
    enforcementPointPath string
    external_id str
    groups Sequence[GetPolicyBaremetalServerGroupAssociationsGroup]
    List of groups this bare metal server is a member of. Each group contains:
    id str
    ID of the data source.
    enforcement_point_path str
    externalId String
    groups List<Property Map>
    List of groups this bare metal server is a member of. Each group contains:
    id String
    ID of the data source.
    enforcementPointPath String

    Supporting Types

    GetPolicyBaremetalServerGroupAssociationsGroup

    DisplayName string
    Display name of the group.
    IsValid bool
    Indicates if the referenced NSX resource is valid.
    Path string
    Policy path of the group.
    TargetType string
    Type of the target resource.
    DisplayName string
    Display name of the group.
    IsValid bool
    Indicates if the referenced NSX resource is valid.
    Path string
    Policy path of the group.
    TargetType string
    Type of the target resource.
    display_name string
    Display name of the group.
    is_valid bool
    Indicates if the referenced NSX resource is valid.
    path string
    Policy path of the group.
    target_type string
    Type of the target resource.
    displayName String
    Display name of the group.
    isValid Boolean
    Indicates if the referenced NSX resource is valid.
    path String
    Policy path of the group.
    targetType String
    Type of the target resource.
    displayName string
    Display name of the group.
    isValid boolean
    Indicates if the referenced NSX resource is valid.
    path string
    Policy path of the group.
    targetType string
    Type of the target resource.
    display_name str
    Display name of the group.
    is_valid bool
    Indicates if the referenced NSX resource is valid.
    path str
    Policy path of the group.
    target_type str
    Type of the target resource.
    displayName String
    Display name of the group.
    isValid Boolean
    Indicates if the referenced NSX resource is valid.
    path String
    Policy path of the group.
    targetType String
    Type of the target resource.

    Package Details

    Repository
    nsxt vmware/terraform-provider-nsxt
    License
    Notes
    This Pulumi package is based on the nsxt Terraform Provider.
    Viewing docs for nsxt 3.12.1
    published on Friday, Sep 11, 2026 by vmware

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial