1. Registry
  2. Packages
  3. Nsxt Provider
  4. API Docs
  5. getPolicyBaremetalServerTags
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 tags applied to a Bare Metal Server in NSX-T Policy.

    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";
    
    const test = nsxt.getPolicyBaremetalServerTags({
        externalId: "71be0142-2ed1-1d53-9c60-5564cf4b7e2e",
    });
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    test = nsxt.get_policy_baremetal_server_tags(external_id="71be0142-2ed1-1d53-9c60-5564cf4b7e2e")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nsxt/v3/nsxt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nsxt.LookupPolicyBaremetalServerTags(ctx, &nsxt.LookupPolicyBaremetalServerTagsArgs{
    			ExternalId: "71be0142-2ed1-1d53-9c60-5564cf4b7e2e",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Nsxt.GetPolicyBaremetalServerTags.Invoke(new()
        {
            ExternalId = "71be0142-2ed1-1d53-9c60-5564cf4b7e2e",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nsxt.NsxtFunctions;
    import com.pulumi.nsxt.inputs.GetPolicyBaremetalServerTagsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 test = NsxtFunctions.getPolicyBaremetalServerTags(GetPolicyBaremetalServerTagsArgs.builder()
                .externalId("71be0142-2ed1-1d53-9c60-5564cf4b7e2e")
                .build());
    
        }
    }
    
    variables:
      test:
        fn::invoke:
          function: nsxt:getPolicyBaremetalServerTags
          arguments:
            externalId: 71be0142-2ed1-1d53-9c60-5564cf4b7e2e
    
    Example coming soon!
    

    Using With BMS Server Discovery

    import * as pulumi from "@pulumi/pulumi";
    import * as nsxt from "@pulumi/nsxt";
    
    // First discover BMS servers
    const productionServers = nsxt.getPolicyBaremetalServers({
        displayName: "prod-server",
    });
    // Then get tags for a specific server
    const serverTags = productionServers.then(productionServers => nsxt.getPolicyBaremetalServerTags({
        externalId: productionServers.results?.[0]?.externalId,
    }));
    export const serverEnvironment = serverTags.then(serverTags => .filter(tag => tag.scope == "environment").map(tag => (tag.tag))[0]);
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    # First discover BMS servers
    production_servers = nsxt.get_policy_baremetal_servers(display_name="prod-server")
    # Then get tags for a specific server
    server_tags = nsxt.get_policy_baremetal_server_tags(external_id=production_servers.results[0].external_id)
    pulumi.export("serverEnvironment", [tag.tag for tag in server_tags.tags if tag.scope == "environment"][0])
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        // First discover BMS servers
        var productionServers = Nsxt.GetPolicyBaremetalServers.Invoke(new()
        {
            DisplayName = "prod-server",
        });
    
        // Then get tags for a specific server
        var serverTags = Nsxt.GetPolicyBaremetalServerTags.Invoke(new()
        {
            ExternalId = productionServers.Apply(getPolicyBaremetalServersResult => getPolicyBaremetalServersResult.Results[0]?.ExternalId),
        });
    
        return new Dictionary<string, object?>
        {
            ["serverEnvironment"] = .Where(tag => tag.Scope == "environment").Select(tag => 
            {
                return tag.Tag;
            }).ToList()[0],
        };
    });
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    

    Notes

    • This data source retrieves tags that have been applied to BMS servers using the nsxt.PolicyBaremetalServerTags resource or other NSX-T mechanisms.
    • Tags are used for dynamic group membership and policy application in NSX-T.
    • The external_id must be the external ID of a Bare Metal Server that exists in NSX-T inventory.

    Using getPolicyBaremetalServerTags

    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 getPolicyBaremetalServerTags(args: GetPolicyBaremetalServerTagsArgs, opts?: InvokeOptions): Promise<GetPolicyBaremetalServerTagsResult>
    function getPolicyBaremetalServerTagsOutput(args: GetPolicyBaremetalServerTagsOutputArgs, opts?: InvokeOutputOptions): Output<GetPolicyBaremetalServerTagsResult>
    def get_policy_baremetal_server_tags(external_id: Optional[str] = None,
                                         id: Optional[str] = None,
                                         tags: Optional[Sequence[GetPolicyBaremetalServerTagsTag]] = None,
                                         opts: Optional[InvokeOptions] = None) -> GetPolicyBaremetalServerTagsResult
    def get_policy_baremetal_server_tags_output(external_id: pulumi.Input[Optional[str]] = None,
                                         id: pulumi.Input[Optional[str]] = None,
                                         tags: pulumi.Input[Optional[Sequence[pulumi.Input[GetPolicyBaremetalServerTagsTagArgs]]]] = None,
                                         opts: Optional[InvokeOutputOptions] = None) -> Output[GetPolicyBaremetalServerTagsResult]
    func LookupPolicyBaremetalServerTags(ctx *Context, args *LookupPolicyBaremetalServerTagsArgs, opts ...InvokeOption) (*LookupPolicyBaremetalServerTagsResult, error)
    func LookupPolicyBaremetalServerTagsOutput(ctx *Context, args *LookupPolicyBaremetalServerTagsOutputArgs, opts ...InvokeOption) LookupPolicyBaremetalServerTagsResultOutput

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

    public static class GetPolicyBaremetalServerTags 
    {
        public static Task<GetPolicyBaremetalServerTagsResult> InvokeAsync(GetPolicyBaremetalServerTagsArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyBaremetalServerTagsResult> Invoke(GetPolicyBaremetalServerTagsInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyBaremetalServerTagsResult> Invoke(GetPolicyBaremetalServerTagsInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetPolicyBaremetalServerTagsResult> getPolicyBaremetalServerTags(GetPolicyBaremetalServerTagsArgs args, InvokeOptions options)
    public static Output<GetPolicyBaremetalServerTagsResult> getPolicyBaremetalServerTags(GetPolicyBaremetalServerTagsArgs args, InvokeOptions options)
    public static Output<GetPolicyBaremetalServerTagsResult> getPolicyBaremetalServerTags(GetPolicyBaremetalServerTagsArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: nsxt:index/getPolicyBaremetalServerTags:getPolicyBaremetalServerTags
      arguments:
        # arguments dictionary
    data "nsxt_get_policy_baremetal_server_tags" "name" {
        # arguments
    }

    The following arguments are supported:

    ExternalId string
    External ID of the Bare Metal Server to retrieve tags for.
    Id string
    ID of the data source (same as external_id).
    Tags List<GetPolicyBaremetalServerTagsTag>
    Tag value.
    ExternalId string
    External ID of the Bare Metal Server to retrieve tags for.
    Id string
    ID of the data source (same as external_id).
    Tags []GetPolicyBaremetalServerTagsTag
    Tag value.
    external_id string
    External ID of the Bare Metal Server to retrieve tags for.
    id string
    ID of the data source (same as external_id).
    tags list(object)
    Tag value.
    externalId String
    External ID of the Bare Metal Server to retrieve tags for.
    id String
    ID of the data source (same as external_id).
    tags List<GetPolicyBaremetalServerTagsTag>
    Tag value.
    externalId string
    External ID of the Bare Metal Server to retrieve tags for.
    id string
    ID of the data source (same as external_id).
    tags GetPolicyBaremetalServerTagsTag[]
    Tag value.
    external_id str
    External ID of the Bare Metal Server to retrieve tags for.
    id str
    ID of the data source (same as external_id).
    tags Sequence[GetPolicyBaremetalServerTagsTag]
    Tag value.
    externalId String
    External ID of the Bare Metal Server to retrieve tags for.
    id String
    ID of the data source (same as external_id).
    tags List<Property Map>
    Tag value.

    getPolicyBaremetalServerTags Result

    The following output properties are available:

    ExternalId string
    Id string
    ID of the data source (same as external_id).
    Tags List<GetPolicyBaremetalServerTagsTag>
    Tag value.
    ExternalId string
    Id string
    ID of the data source (same as external_id).
    Tags []GetPolicyBaremetalServerTagsTag
    Tag value.
    external_id string
    id string
    ID of the data source (same as external_id).
    tags list(object)
    Tag value.
    externalId String
    id String
    ID of the data source (same as external_id).
    tags List<GetPolicyBaremetalServerTagsTag>
    Tag value.
    externalId string
    id string
    ID of the data source (same as external_id).
    tags GetPolicyBaremetalServerTagsTag[]
    Tag value.
    external_id str
    id str
    ID of the data source (same as external_id).
    tags Sequence[GetPolicyBaremetalServerTagsTag]
    Tag value.
    externalId String
    id String
    ID of the data source (same as external_id).
    tags List<Property Map>
    Tag value.

    Supporting Types

    GetPolicyBaremetalServerTagsTag

    Scope string
    Tag scope.
    Tag string
    Tag value.
    Scope string
    Tag scope.
    Tag string
    Tag value.
    scope string
    Tag scope.
    tag string
    Tag value.
    scope String
    Tag scope.
    tag String
    Tag value.
    scope string
    Tag scope.
    tag string
    Tag value.
    scope str
    Tag scope.
    tag str
    Tag value.
    scope String
    Tag scope.
    tag String
    Tag value.

    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