Python CDKTF

The Cloud Development Kit for Terraform (CDKTF) allows you to manage your Akeyless resources, such as secrets, roles, and authentication methods, using Terraform without needing to write HashiCorp Configuration Language (HCL). Instead, you can define and manage these resources using Python.



Install the library

Install the CDKTF for Akeyless package

pip install akeyless-cdktf==1.6.3

Once the package is installed, configure the and cdktf.json files:

Example for Static Secret creation

Create a file named and edit it as described below:

from akeyless_cdktf import static_secret, provider
from cdktf import App, TerraformStack
from constructs import Construct

login = {
    "accessId":"Access ID",
    "accessKey":"Access Key",

class MyStack(TerraformStack):
    def __init__(self, scope: Construct, ns: str):
        super().__init__(scope, ns)
        static_secret.StaticSecret(self, "<Secret Name>", path=f"/path/to/secret", value="SecretValue")

app = App()
MyStack(app, "akeyless")

Create a file named cdktf.json and edit it as described below:

  "language": "python",
  "app": "python",
  "projectId": "Enter your Project ID",
  "sendCrashReports": "false",
  "terraformProviders": [],
  "terraformModules": [],
  "context": {}

Once both files are configured, run the following command to apply the files:

cdktf apply # or plan