FinOps: The Future of FinOps is CloudOps Learn why

Feature Friday Automation & Orchestration

Feature Friday: Creating OUs and Projects with the Terraform Provider

Brandon Shutter

3 min read

In this blog post, we'll explore an advanced use case of Terraform by creating OUs (Organizational Units) and projects using the Kion Terraform provider. This example showcases the versatility of Terraform and addresses a common scenario encountered by our customers. OUs and projects serve as fundamental building blocks within Kion , making it essential to understand how to leverage the Kion Terraform provider effectively. Let's dive into the details and get started!

Creating an OU Using Terraform

To create an OU, we need to refer to the Kion OU resource in the Kion Provider documentation. By examining the schema, we can determine the required fields expected by the provider. In this case, the fields include name, parent OU ID, permission scheme ID, and owner user groups or user owner users. We will include owner user groups in our Terraform configuration. Let's navigate to our Integrated Development Environment (IDE) to proceed.

In the IDE, we create a new file for demonstration purposes. It's important to note that the file extension must be .tf for Terraform to recognize it. Now, let's define the resource block for the Kion OU and provide it with a reference name within Terraform. Remember, this reference name is not the actual OU name. Next, we set the required fields, such as name, parent OU ID, and permission scheme ID. For example, we can assign name as "Terraform created OU" and owner users with an ID of 1.

Validating and Applying the Configuration

To ensure our configuration is syntactically correct, we run a Terraform plan. If the plan is satisfactory, we proceed with terraform apply to create the OU. Once completed, we can navigate to our Kion installation and observe the newly created OU.

Creating a Project and Associating it with the OU

To create a project, we consult the Terraform documentation to understand the necessary input for the Kion provider fields such as name and OU ID. Back in the IDE, we define a new resource block for the Kion project, assigning it a reference name of "Terraform created project." Similar to the OU creation process, we utilize the output of the previous resource (OU) as an input for the project's parent OU ID field. This feature showcases the immense power of Terraform providers. Additionally, we assign the same owner user groups as the OU.

Validating and Applying the Project Configuration

We execute a Terraform plan to verify the correctness of our syntax. Once confirmed, we proceed with terraform apply to create the project. After completion, we can navigate to the Kion application to observe the newly created project associated with the Terraform-created OU.

Utilizing the Power of Terraform

Terraform's strength lies in its ability to automate infrastructure creation and management. We've demonstrated how you can leverage the Kion Terraform provider to create OUs and projects seamlessly. Additionally, Terraform's inheritance feature allows for easy replication of resource configurations, as shown by the creation of multiple projects using the same OU ID.

Thank you for checking out this Feature Friday, and happy provisioning!

About the Author

Brandon Shutter

Brandon is a senior solutions architect at Kion.

Start your cloud operations journey.

Request a demo today,