New FinOps Capabilities Kion Strengthens Multicloud Capabilities with New Support for FOCUS and Oracle Cloud Infrastructure Read the press release

Feature Friday Automation & Orchestration

Feature Friday: Harnessing the Power of the Terraform Provider

Brandon Shutter

3 min read

In this blog post, we'll explore the benefits of using the Terraform Provider in Kion. By leveraging the Terraform Provider, Kion taps into APIs to enable you to perform actions with Terraform that would typically be done through the UI. We'll walk through an example to demonstrate the capabilities of the Terraform Provider and explain how it can enhance your Kion experience. So let's dive in!

Getting Started with the Terraform Provider

After initializing Terraform and declaring the provider, you're ready to utilize the Terraform Provider in Kion. To set up the Terraform Provider with Kion, follow our instructions, which include obtaining an API key and the URL to your Kion install. These credentials can be directly set in the Terraform file or through an environmental file. For the purposes of this demo, we will set them directly in the Terraform file.

Using the Terraform Provider

To demonstrate the capabilities of the Terraform Provider, let's walk through an example of creating an IAM policy in Terraform and pushing it to Kion. The Kion documentation and Terraform Registry provide an example of creating an IAM policy, which we will utilize.

  1. Configuring the IAM Policy: Copy and paste the provided example into your Terraform file. This defines a resource type - "Kion AWS IAM policy" - and provides details such as the policy's name, description, ownership, user groups, and the policy itself. The output block allows you to access the created policy's value for future use.
  2. Executing Terraform Plan: Run the Terraform plan command to ensure that Terraform can connect and generate an execution plan. If the output states that there are no changes and your infrastructure matches the configuration, it means the Terraform Provider is properly set up, but no actions have been performed yet.
  3. Applying the Terraform Plan: Proceed to run the Terraform apply command, which will show you the expected output and prompt for approval. By approving the plan, Terraform will leverage the Terraform Provider to create the IAM policy in Kion based on the provided instructions.
  4. Verifying the Result: After applying the Terraform plan, you can navigate to Cloud Management ->AWS IAM Policies within Kion to verify that the policy has been created successfully. You will notice that the policy named "sample resource" matches the one defined in Terraform. It's important to note that this entire process was accomplished without utilizing the Kion UI directly.

Benefits of the Terraform Provider

Using the Terraform Provider in Kion offers numerous advantages, especially when managing complex setups involving multiple policies and users. By defining everything through code, you can easily incorporate the Terraform configuration into your CI/CD workflows and version control systems. This seamless integration simplifies management and ensures consistency across environments.

Conclusion

The Terraform Provider in Kion empowers users to manage their Kion installations effectively using the familiar and powerful capabilities of Terraform. By harnessing the power of the Terraform Provider, you can automate the creation of resources, such as IAM policies, and enjoy the benefits of infrastructure as code. Whether you are new to Terraform or already utilizing it, integrating the Terraform Provider in Kion provides a centralized and efficient approach to managing your Kion installation.

We hope this blog post has shed light on the importance and advantages of using the Terraform Provider in Kion. Thank you for taking the time to read, 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,