1. Packages
  2. vSphere
  3. API Docs
  4. getCustomAttribute
vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi

vsphere.getCustomAttribute

Explore with Pulumi AI

vsphere logo
vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi

    The vsphere.CustomAttribute data source can be used to reference custom attributes that are not managed by this provider. Its attributes are exactly the same as the vsphere.CustomAttribute resource, and, like importing, the data source takes a name argument for the search. The id and other attributes are then populated with the data found by the search.

    NOTE: Custom attributes are unsupported on direct ESXi host connections and require vCenter Server.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const attribute = vsphere.getCustomAttribute({
        name: "test-attribute",
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    attribute = vsphere.get_custom_attribute(name="test-attribute")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vsphere.LookupCustomAttribute(ctx, &vsphere.LookupCustomAttributeArgs{
    			Name: "test-attribute",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var attribute = VSphere.GetCustomAttribute.Invoke(new()
        {
            Name = "test-attribute",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VsphereFunctions;
    import com.pulumi.vsphere.inputs.GetCustomAttributeArgs;
    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 attribute = VsphereFunctions.getCustomAttribute(GetCustomAttributeArgs.builder()
                .name("test-attribute")
                .build());
    
        }
    }
    
    variables:
      attribute:
        fn::invoke:
          Function: vsphere:getCustomAttribute
          Arguments:
            name: test-attribute
    

    Using getCustomAttribute

    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 getCustomAttribute(args: GetCustomAttributeArgs, opts?: InvokeOptions): Promise<GetCustomAttributeResult>
    function getCustomAttributeOutput(args: GetCustomAttributeOutputArgs, opts?: InvokeOptions): Output<GetCustomAttributeResult>
    def get_custom_attribute(name: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetCustomAttributeResult
    def get_custom_attribute_output(name: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetCustomAttributeResult]
    func LookupCustomAttribute(ctx *Context, args *LookupCustomAttributeArgs, opts ...InvokeOption) (*LookupCustomAttributeResult, error)
    func LookupCustomAttributeOutput(ctx *Context, args *LookupCustomAttributeOutputArgs, opts ...InvokeOption) LookupCustomAttributeResultOutput

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

    public static class GetCustomAttribute 
    {
        public static Task<GetCustomAttributeResult> InvokeAsync(GetCustomAttributeArgs args, InvokeOptions? opts = null)
        public static Output<GetCustomAttributeResult> Invoke(GetCustomAttributeInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCustomAttributeResult> getCustomAttribute(GetCustomAttributeArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vsphere:index/getCustomAttribute:getCustomAttribute
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the custom attribute.
    Name string
    The name of the custom attribute.
    name String
    The name of the custom attribute.
    name string
    The name of the custom attribute.
    name str
    The name of the custom attribute.
    name String
    The name of the custom attribute.

    getCustomAttribute Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    ManagedObjectType string
    Name string
    Id string
    The provider-assigned unique ID for this managed resource.
    ManagedObjectType string
    Name string
    id String
    The provider-assigned unique ID for this managed resource.
    managedObjectType String
    name String
    id string
    The provider-assigned unique ID for this managed resource.
    managedObjectType string
    name string
    id str
    The provider-assigned unique ID for this managed resource.
    managed_object_type str
    name str
    id String
    The provider-assigned unique ID for this managed resource.
    managedObjectType String
    name String

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.10.0 published on Tuesday, Mar 12, 2024 by Pulumi