Skip to content

AD Organization Units (OUs) with Terraform»

Terraform KopiCloud_AD_API

Manage AD Organization Units (OUs) in Microsoft Active Directory using the KopiCloud AD API Terraform Provider


Resources»

Create an AD OU»

Create an AD OU:

1
2
3
4
5
6
resource "kopicloud_ou" "test" {
  ou_path     = "DC=kopicloud,DC=local"
  ou_name     = "kopicloud-europe"
  protected   = false
  description = "OU for KopiCloud Europe"
}

Returns created AD OU:

1
2
3
4
output "OUTPUT_created_ou" {
  description = "Created OU"
  value       = resource.kopicloud_ou.test
}

Schema

Required:

  • description (String) The Description of the AD OU

  • ou_name (String) Name of the AD OU

Optional:

  • ou_path (String) Path of the AD OU (Distinguished Name)

  • protected (Boolean) Protect the AD OU from Accidental Deletion

Read-Only:

  • id (String) The ID of this Resource

  • result (List of Objects) Single AD OU (see below for nested schema)


Data Sources:»

List AD OUs»

Get the List of AD OUs:

1
data "kopicloud_ou_list" "test" {}

Returns the List of OUs:

1
2
3
4
output "OUTPUT_list_ou" {
  description = "List of Existing OUs"
  value       = data.kopicloud_ou_list.test
}

Schema

Optional:

  • ou_name (String) Name of the AD OU

  • ou_path (String) Path of the AD OU (Distinguished Name)

Read-Only:

  • id (String) The ID of this Resource

  • result (List of Objects) Single AD OU (see below for nested schema)


Nested Schema for Result:»

Read-Only:

  • description (String) The Description of the AD OU

  • guid (String) The GUID of the AD OU

  • name (String) Name of the AD OU

  • path (String) Path of the AD OU (Distinguished Name)

  • protected (Boolean) Protect the AD OU from Accidental Deletion


Notes»

Running this resource with terraform apply will create or update the AD OU and running terraform destroy will remove this AD OU from the Active Directory.


Source Code»

Source code available here