AD Users with Terraform»
Manage AD Users in Microsoft Active Directory using the KopiCloud AD Terraform Provider
Resources»
Create an AD User»
Create AD User:
1 2 3 4 5 6 7 8 9 10 11 12  |  | 
Returns AD User Result:
1 2 3 4 5  |  | 
Schema
Required:
password(String) - Passwordusername(String) - AD Username
Optional:
change_password_next_logon(Boolean) Status of Change Password Next Logon Settingcity(String) Citycompany(String) Company Namecountry(String) Country (use the English Name of the Country)department(String) Company Departmentdescription(String) User Descriptiondisplay_name(String) User Display Nameemail_address(String) User Email Addressfirst_name(String) User First Nameguid(String) User GUIDhome_folder_directory(String) Home Folder Directoryhome_folder_drive(String) Home Folder Drivehome_folder_path(String) Home Folder Pathhome_phone(String) Home Phoneinitials(String) User Middle Name Initialjob_title(String) Job Titlelast_name(String) User Last Namemanager(String) - Manager Namemobile_phone(String) Mobile Phoneoffice(String) Office Informationoffice_phone(String) Office Phoneou_path(String) OU Path (Distinguished Name) of the Userpassword_never_expired(Boolean) Status of the Password Never Expired Settingpostal_code(String) Postal/ZIP Codeprofile_logon_script(String) Profile Logon Scriptprofile_path(String) Profile Pathrds_allow_logon(Boolean) Remote Desktop Allow Logonrds_connect_drive(Boolean) Remote Desktop Connect Driverds_home_folder_drive(String) Remote Desktop Home Folderrds_home_folder_path(String) Remote Desktop Folder Pathrds_profile_path(String) Remote Desktop Profile Pathsam_username(String) SAM Account Name (Used by Previous Versions of Windows)state (String)State or Provincestreet_address(String) Street Addressstreet_po_box(String) PO Box Addressusername(String) Username
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Disable an AD User»
Disable AD User Account:
1 2 3  |  | 
Disabled AD User Account Result:
1 2 3 4  |  | 
Schema
Required:
username(String) - AD Username to Disable
Optional:
show_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Enable an AD User»
Enable AD User Account:
1 2 3  |  | 
Enabled AD User Account Result:
1 2 3 4  |  | 
Schema
Required:
username(String) - AD Username to Enable
Optional:
show_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Reset the Password of an AD User»
Reset User Password:
1 2 3 4 5 6  |  | 
Reset Password Output:
1 2 3 4  |  | 
Schema
Required:
new_password(String) New Password for the AD Userusername(String) - AD Username
Optional:
change_password_next_logon(Boolean) Force the User to Change the Password on the Next Logonshow_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Rename an Active Directory User»
Rename AD User:
1 2 3 4  |  | 
AD User Rename Result:
1 2 3 4  |  | 
Schema
Required:
username(String) - Existing AD Usernamenew_username(String) - New AD Username
Optional:
show_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Unlock an Active Directory User»
Unlock AD User:
1 2 3  |  | 
Unlock AD User Result:
1 2 3 4  |  | 
Schema
Required:
username(String) - AD Username to Unlock
Optional:
show_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Data Sources»
List Users in AD»
Get All AD Users:
1 |  | 
Returns All AD Users:
1 2 3 4  |  | 
Get All AD Users Inside an OU:
1 2 3  |  | 
Returns All AD Users Inside an OU:
1 2 3 4  |  | 
Get All AD Users Showing Specific Fields :
1 2 3  |  | 
Returns all AD Users Showing Specific Fields:
1 2 3 4  |  | 
Schema
Optional:
ou_path(String) OU Path (Distinguished Name)recursive(Boolean) Recursive Search Inside the OUshow_fields(String) Filter Specific Fields in the Output
Read-Only:
id(String) The ID of this Resourceresult(List of Objects) Single AD User (see below for nested schema)
Nested Schema for Result»
Read-Only:
change_password_next_logon(Boolean) Status of Change Password Next Logon Settingcity(String) Citycompany(String) Company Namecountry(String) Country (use the English Name of the Country)department(String) Company Departmentdescription(String) User Descriptiondisplay_name(String) User Display Nameemail_address(String) User Email Addressfirst_name(String) User First Nameguid(String) User GUIDhome_folder_directory(String) Home Folder Directoryhome_folder_drive(String) Home Folder Drivehome_folder_path(String) Home Folder Pathhome_phone(String) Home Phoneinitials(String) User Middle Name Initialjob_title(String) Job Titlelast_name(String) User Last Namemanager(String) - Manager Namemobile_phone(String) Mobile Phoneoffice(String) Office Informationoffice_phone(String) Office Phoneou_path(String) OU Path (Distinguished Name) of the Userpassword_never_expired(Boolean) Status of the Password Never Expired Settingpostal_code(String) Postal/ZIP Codeprofile_logon_script(String) Profile Logon Scriptprofile_path(String) Profile Pathrds_allow_logon(Boolean) Remote Desktop Allow Logonrds_connect_drive(Boolean) Remote Desktop Connect Driverds_home_folder_drive(String) Remote Desktop Home Folderrds_home_folder_path(String) Remote Desktop Folder Pathrds_profile_path(String) Remote Desktop Profile Pathsam_username(String) SAM Account Name (Used by Previous Versions of Windows)state (String)State or Provincestreet_address(String) Street Addressstreet_po_box(String) PO Box Addressusername(String) Username
Notes»
Note #1: Running this resource with terraform apply will create or update the AD User and running terraform destroy will remove this AD User from the Active Directory.
Note #2: Use the parameter ShowFields to select user fields to show. This optional argument is a comma-separated string with the name of the fields you want to be returned.
- 
Example: ShowFields=All or ShowFields=* : Return all User Fields
 - 
Example: ShowFields=Username,Firstname : Return Only Username and Firstname Fields
 - 
Example: ShowFields=Null or Empty : Return Default Fields (Username, Firstname, Lastname, Display_Name, Description, Company, Office, Department, Email_Address)
 
Note #3: you cannot set both change_password_next_logon = true and password_never_expires = true as is not supported by Active Directory.
Note #4: for the Universal Naming Convention (UNC) path of servers in the Profile and the RDS variables use twice backslashes as usual. For example, instead of using \\, use \\\\ and use \\ instead of \.
Source Code»
Source code available here