The portainer_kubernetes_cronjob
resource allows you to deploy one-off Kubernetes Cronjob
workloads into a specified namespace on a Kubernetes environment (endpoint) managed via Portainer.
resource "portainer_kubernetes_cronjob" "example" {
endpoint_id = 4
namespace = "default"
manifest = file("${path.module}/cronjob.yaml")
}
The Cronjob is created via the Portainer Kubernetes API.
Any change results in a delete + create.
To update the Cronjob (e.g. name, image), simply modify the manifest and re-apply:
terraform apply
To remove the Job:
terraform destroy
Name | Type | Required | Description |
---|---|---|---|
endpoint_id | int | ✅ yes | ID of the Portainer environment (Kubernetes cluster). |
namespace | string | ✅ yes | Kubernetes namespace where the CronJob should be created. |
manifest | string | ✅ yes | Kubernetes CronJob manifest (JSON or YAML as a string). |
Name | Description |
---|---|
id |
ID in the format endpoint_id:namespace:cronjob:name |