1. Packages
  2. Ldap Provider
  3. API Docs
  4. Object
ldap 2.0.1 published on Monday, Apr 14, 2025 by elastic-infra

ldap.Object

Explore with Pulumi AI

ldap logo
ldap 2.0.1 published on Monday, Apr 14, 2025 by elastic-infra

    Provides a LDAP Object.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ldap from "@pulumi/ldap";
    
    const usersExampleCom = new ldap.Object("usersExampleCom", {
        dn: "ou=users,dc=example,dc=com",
        objectClasses: [
            "top",
            "organizationalUnit",
        ],
    });
    const a123456 = new ldap.Object("a123456", {
        attributes: [
            {
                sn: "Doe",
            },
            {
                givenName: "John",
            },
            {
                cn: "John Doe",
            },
            {
                displayName: "Mr. John K. Doe, esq.",
            },
            {
                mail: "john.doe@example.com",
            },
            {
                mail: "jdoe@example.com",
            },
            {
                userPassword: "password",
            },
            {
                uidNumber: "1234",
            },
            {
                gidNumber: "1234",
            },
            {
                homeDirectory: "/home/jdoe",
            },
            {
                loginShell: "/bin/bash",
            },
        ],
        dn: pulumi.interpolate`uid=a123456,${usersExampleCom.dn}`,
        objectClasses: [
            "inetOrgPerson",
            "posixAccount",
        ],
    });
    
    import pulumi
    import pulumi_ldap as ldap
    
    users_example_com = ldap.Object("usersExampleCom",
        dn="ou=users,dc=example,dc=com",
        object_classes=[
            "top",
            "organizationalUnit",
        ])
    a123456 = ldap.Object("a123456",
        attributes=[
            {
                "sn": "Doe",
            },
            {
                "givenName": "John",
            },
            {
                "cn": "John Doe",
            },
            {
                "displayName": "Mr. John K. Doe, esq.",
            },
            {
                "mail": "john.doe@example.com",
            },
            {
                "mail": "jdoe@example.com",
            },
            {
                "userPassword": "password",
            },
            {
                "uidNumber": "1234",
            },
            {
                "gidNumber": "1234",
            },
            {
                "homeDirectory": "/home/jdoe",
            },
            {
                "loginShell": "/bin/bash",
            },
        ],
        dn=users_example_com.dn.apply(lambda dn: f"uid=a123456,{dn}"),
        object_classes=[
            "inetOrgPerson",
            "posixAccount",
        ])
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ldap/v2/ldap"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		usersExampleCom, err := ldap.NewObject(ctx, "usersExampleCom", &ldap.ObjectArgs{
    			Dn: pulumi.String("ou=users,dc=example,dc=com"),
    			ObjectClasses: pulumi.StringArray{
    				pulumi.String("top"),
    				pulumi.String("organizationalUnit"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ldap.NewObject(ctx, "a123456", &ldap.ObjectArgs{
    			Attributes: pulumi.StringMapArray{
    				pulumi.StringMap{
    					"sn": pulumi.String("Doe"),
    				},
    				pulumi.StringMap{
    					"givenName": pulumi.String("John"),
    				},
    				pulumi.StringMap{
    					"cn": pulumi.String("John Doe"),
    				},
    				pulumi.StringMap{
    					"displayName": pulumi.String("Mr. John K. Doe, esq."),
    				},
    				pulumi.StringMap{
    					"mail": pulumi.String("john.doe@example.com"),
    				},
    				pulumi.StringMap{
    					"mail": pulumi.String("jdoe@example.com"),
    				},
    				pulumi.StringMap{
    					"userPassword": pulumi.String("password"),
    				},
    				pulumi.StringMap{
    					"uidNumber": pulumi.String("1234"),
    				},
    				pulumi.StringMap{
    					"gidNumber": pulumi.String("1234"),
    				},
    				pulumi.StringMap{
    					"homeDirectory": pulumi.String("/home/jdoe"),
    				},
    				pulumi.StringMap{
    					"loginShell": pulumi.String("/bin/bash"),
    				},
    			},
    			Dn: usersExampleCom.Dn.ApplyT(func(dn string) (string, error) {
    				return fmt.Sprintf("uid=a123456,%v", dn), nil
    			}).(pulumi.StringOutput),
    			ObjectClasses: pulumi.StringArray{
    				pulumi.String("inetOrgPerson"),
    				pulumi.String("posixAccount"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ldap = Pulumi.Ldap;
    
    return await Deployment.RunAsync(() => 
    {
        var usersExampleCom = new Ldap.Object("usersExampleCom", new()
        {
            Dn = "ou=users,dc=example,dc=com",
            ObjectClasses = new[]
            {
                "top",
                "organizationalUnit",
            },
        });
    
        var a123456 = new Ldap.Object("a123456", new()
        {
            Attributes = new[]
            {
                
                {
                    { "sn", "Doe" },
                },
                
                {
                    { "givenName", "John" },
                },
                
                {
                    { "cn", "John Doe" },
                },
                
                {
                    { "displayName", "Mr. John K. Doe, esq." },
                },
                
                {
                    { "mail", "john.doe@example.com" },
                },
                
                {
                    { "mail", "jdoe@example.com" },
                },
                
                {
                    { "userPassword", "password" },
                },
                
                {
                    { "uidNumber", "1234" },
                },
                
                {
                    { "gidNumber", "1234" },
                },
                
                {
                    { "homeDirectory", "/home/jdoe" },
                },
                
                {
                    { "loginShell", "/bin/bash" },
                },
            },
            Dn = usersExampleCom.Dn.Apply(dn => $"uid=a123456,{dn}"),
            ObjectClasses = new[]
            {
                "inetOrgPerson",
                "posixAccount",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ldap.Object;
    import com.pulumi.ldap.ObjectArgs;
    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) {
            var usersExampleCom = new Object("usersExampleCom", ObjectArgs.builder()
                .dn("ou=users,dc=example,dc=com")
                .objectClasses(            
                    "top",
                    "organizationalUnit")
                .build());
    
            var a123456 = new Object("a123456", ObjectArgs.builder()
                .attributes(            
                    Map.of("sn", "Doe"),
                    Map.of("givenName", "John"),
                    Map.of("cn", "John Doe"),
                    Map.of("displayName", "Mr. John K. Doe, esq."),
                    Map.of("mail", "john.doe@example.com"),
                    Map.of("mail", "jdoe@example.com"),
                    Map.of("userPassword", "password"),
                    Map.of("uidNumber", "1234"),
                    Map.of("gidNumber", "1234"),
                    Map.of("homeDirectory", "/home/jdoe"),
                    Map.of("loginShell", "/bin/bash"))
                .dn(usersExampleCom.dn().applyValue(dn -> String.format("uid=a123456,%s", dn)))
                .objectClasses(            
                    "inetOrgPerson",
                    "posixAccount")
                .build());
    
        }
    }
    
    resources:
      usersExampleCom:
        type: ldap:Object
        properties:
          dn: ou=users,dc=example,dc=com
          objectClasses:
            - top
            - organizationalUnit
      a123456:
        type: ldap:Object
        properties:
          attributes:
            - sn: Doe
            - givenName: John
            - cn: John Doe
            - displayName: Mr. John K. Doe, esq.
            - mail: john.doe@example.com
            - mail: jdoe@example.com
            - userPassword: password
            - uidNumber: '1234'
            - gidNumber: '1234'
            - homeDirectory: /home/jdoe
            - loginShell: /bin/bash
          dn: uid=a123456,${usersExampleCom.dn}
          objectClasses:
            - inetOrgPerson
            - posixAccount
    

    Create Object Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Object(name: string, args: ObjectArgs, opts?: CustomResourceOptions);
    @overload
    def Object(resource_name: str,
               args: ObjectArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Object(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               dn: Optional[str] = None,
               object_classes: Optional[Sequence[str]] = None,
               attributes: Optional[Sequence[Mapping[str, str]]] = None,
               object_id: Optional[str] = None)
    func NewObject(ctx *Context, name string, args ObjectArgs, opts ...ResourceOption) (*Object, error)
    public Object(string name, ObjectArgs args, CustomResourceOptions? opts = null)
    public Object(String name, ObjectArgs args)
    public Object(String name, ObjectArgs args, CustomResourceOptions options)
    
    type: ldap:Object
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ObjectArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ObjectArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ObjectArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ObjectArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ObjectArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var objectResource = new Ldap.Object("objectResource", new()
    {
        Dn = "string",
        ObjectClasses = new[]
        {
            "string",
        },
        Attributes = new[]
        {
            
            {
                { "string", "string" },
            },
        },
        ObjectId = "string",
    });
    
    example, err := ldap.NewObject(ctx, "objectResource", &ldap.ObjectArgs{
    	Dn: pulumi.String("string"),
    	ObjectClasses: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Attributes: pulumi.StringMapArray{
    		pulumi.StringMap{
    			"string": pulumi.String("string"),
    		},
    	},
    	ObjectId: pulumi.String("string"),
    })
    
    var objectResource = new Object("objectResource", ObjectArgs.builder()
        .dn("string")
        .objectClasses("string")
        .attributes(Map.of("string", "string"))
        .objectId("string")
        .build());
    
    object_resource = ldap.Object("objectResource",
        dn="string",
        object_classes=["string"],
        attributes=[{
            "string": "string",
        }],
        object_id="string")
    
    const objectResource = new ldap.Object("objectResource", {
        dn: "string",
        objectClasses: ["string"],
        attributes: [{
            string: "string",
        }],
        objectId: "string",
    });
    
    type: ldap:Object
    properties:
        attributes:
            - string: string
        dn: string
        objectClasses:
            - string
        objectId: string
    

    Object Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Object resource accepts the following input properties:

    Dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    ObjectClasses List<string>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    Attributes List<ImmutableDictionary<string, string>>
    The map of attributes of this object; each attribute can be multi-valued.
    ObjectId string
    The ID of this resource.
    Dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    ObjectClasses []string
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    Attributes []map[string]string
    The map of attributes of this object; each attribute can be multi-valued.
    ObjectId string
    The ID of this resource.
    dn String
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses List<String>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    attributes List<Map<String,String>>
    The map of attributes of this object; each attribute can be multi-valued.
    objectId String
    The ID of this resource.
    dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses string[]
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    attributes {[key: string]: string}[]
    The map of attributes of this object; each attribute can be multi-valued.
    objectId string
    The ID of this resource.
    dn str
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    object_classes Sequence[str]
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    attributes Sequence[Mapping[str, str]]
    The map of attributes of this object; each attribute can be multi-valued.
    object_id str
    The ID of this resource.
    dn String
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses List<String>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    attributes List<Map<String>>
    The map of attributes of this object; each attribute can be multi-valued.
    objectId String
    The ID of this resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Object resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Object Resource

    Get an existing Object resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ObjectState, opts?: CustomResourceOptions): Object
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            attributes: Optional[Sequence[Mapping[str, str]]] = None,
            dn: Optional[str] = None,
            object_classes: Optional[Sequence[str]] = None,
            object_id: Optional[str] = None) -> Object
    func GetObject(ctx *Context, name string, id IDInput, state *ObjectState, opts ...ResourceOption) (*Object, error)
    public static Object Get(string name, Input<string> id, ObjectState? state, CustomResourceOptions? opts = null)
    public static Object get(String name, Output<String> id, ObjectState state, CustomResourceOptions options)
    resources:  _:    type: ldap:Object    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Attributes List<ImmutableDictionary<string, string>>
    The map of attributes of this object; each attribute can be multi-valued.
    Dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    ObjectClasses List<string>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    ObjectId string
    The ID of this resource.
    Attributes []map[string]string
    The map of attributes of this object; each attribute can be multi-valued.
    Dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    ObjectClasses []string
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    ObjectId string
    The ID of this resource.
    attributes List<Map<String,String>>
    The map of attributes of this object; each attribute can be multi-valued.
    dn String
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses List<String>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    objectId String
    The ID of this resource.
    attributes {[key: string]: string}[]
    The map of attributes of this object; each attribute can be multi-valued.
    dn string
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses string[]
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    objectId string
    The ID of this resource.
    attributes Sequence[Mapping[str, str]]
    The map of attributes of this object; each attribute can be multi-valued.
    dn str
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    object_classes Sequence[str]
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    object_id str
    The ID of this resource.
    attributes List<Map<String>>
    The map of attributes of this object; each attribute can be multi-valued.
    dn String
    The Distinguished Name (DN) of the object, as the concatenation of its RDN (unique among siblings) and its parent's DN.
    objectClasses List<String>
    The set of classes this object conforms to (e.g. organizationalUnit, inetOrgPerson).
    objectId String
    The ID of this resource.

    Import

    $ export TF_LDAP_IMPORTER_PATH=a123456.tf

    $ pulumi import ldap:index/object:Object a123456 uid=a123456,ou=users,dc=example,dc=com
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ldap elastic-infra/terraform-provider-ldap
    License
    Notes
    This Pulumi package is based on the ldap Terraform Provider.
    ldap logo
    ldap 2.0.1 published on Monday, Apr 14, 2025 by elastic-infra