diff --git a/README.md b/README.md
index 121b7a4..e51063c 100644
--- a/README.md
+++ b/README.md
@@ -293,7 +293,7 @@ Usage examples are located in [terraform provider repo](https://github.com/casta
| [terraform](#requirement\_terraform) | >= 0.13 |
| [azuread](#requirement\_azuread) | >= 2.22.0 |
| [azurerm](#requirement\_azurerm) | >= 3.7.0 |
-| [castai](#requirement\_castai) | ~> 7.10 |
+| [castai](#requirement\_castai) | ~> 7.11 |
| [helm](#requirement\_helm) | >= 2.0.0 |
## Providers
@@ -302,7 +302,7 @@ Usage examples are located in [terraform provider repo](https://github.com/casta
|------|---------|
| [azuread](#provider\_azuread) | >= 2.22.0 |
| [azurerm](#provider\_azurerm) | >= 3.7.0 |
-| [castai](#provider\_castai) | ~> 7.10 |
+| [castai](#provider\_castai) | ~> 7.11 |
| [helm](#provider\_helm) | >= 2.0.0 |
| [null](#provider\_null) | n/a |
@@ -326,6 +326,7 @@ No modules.
| [castai_node_configuration.this](https://registry.terraform.io/providers/castai/castai/latest/docs/resources/node_configuration) | resource |
| [castai_node_configuration_default.this](https://registry.terraform.io/providers/castai/castai/latest/docs/resources/node_configuration_default) | resource |
| [castai_node_template.this](https://registry.terraform.io/providers/castai/castai/latest/docs/resources/node_template) | resource |
+| [castai_workload_scaling_policy.this](https://registry.terraform.io/providers/castai/castai/latest/docs/resources/workload_scaling_policy) | resource |
| [helm_release.castai_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_cluster_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.castai_cluster_controller_self_managed](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
@@ -386,6 +387,7 @@ No modules.
| [wait\_for\_cluster\_ready](#input\_wait\_for\_cluster\_ready) | Wait for cluster to be ready before finishing the module execution, this option requires `castai_api_token` to be set | `bool` | `false` | no |
| [workload\_autoscaler\_values](#input\_workload\_autoscaler\_values) | List of YAML formatted string with cluster-workload-autoscaler values | `list(string)` | `[]` | no |
| [workload\_autoscaler\_version](#input\_workload\_autoscaler\_version) | Version of castai-workload-autoscaler helm chart. Default latest | `string` | `null` | no |
+| [workload\_scaling\_policies](#input\_workload\_scaling\_policies) | Map of workload scaling policies to create | `any` | `{}` | no |
## Outputs
diff --git a/main.tf b/main.tf
index 734e3ad..5cd3742 100644
--- a/main.tf
+++ b/main.tf
@@ -128,6 +128,27 @@ resource "castai_node_template" "this" {
depends_on = [castai_autoscaler.castai_autoscaler_policies]
}
+resource "castai_workload_scaling_policy" "this" {
+ for_each = { for k, v in var.workload_scaling_policies : k => v }
+
+ name = try(each.value.name, each.key)
+ cluster_id = castai_aks_cluster.castai_cluster.id
+
+ apply_type = try(each.value.apply_type, "DEFERRED")
+ management_option = try(each.value.management_option, "READ_ONLY")
+ cpu {
+ function = try(each.value.cpu.function, "QUANTILE")
+ overhead = try(each.value.cpu.overhead, 0)
+ apply_threshold = try(each.value.cpu.apply_threshold, 0.1)
+ args = try(each.value.cpu.args, ["0.8"])
+ }
+ memory {
+ function = try(each.value.memory.function, "MAX")
+ overhead = try(each.value.memory.overhead, 0.1)
+ apply_threshold = try(each.value.memory.apply_threshold, 0.1)
+ }
+}
+
resource "helm_release" "castai_agent" {
name = "castai-agent"
repository = "https://castai.github.io/helm-charts"
diff --git a/variables.tf b/variables.tf
index 5542af5..c60c353 100644
--- a/variables.tf
+++ b/variables.tf
@@ -112,6 +112,12 @@ variable "node_templates" {
default = {}
}
+variable "workload_scaling_policies" {
+ type = any
+ description = "Map of workload scaling policies to create"
+ default = {}
+}
+
variable "install_security_agent" {
type = bool
default = false
diff --git a/versions.tf b/versions.tf
index 63d527c..f4cd9a3 100644
--- a/versions.tf
+++ b/versions.tf
@@ -12,7 +12,7 @@ terraform {
}
castai = {
source = "castai/castai"
- version = "~> 7.10"
+ version = "~> 7.11"
}
helm = {
source = "hashicorp/helm"