Summary
The provider has no first-class way to bring a Sysdig policy that was instantiated from a Sysdig-provided template (isDefault: false, templateId != 0) under Terraform management. Both candidate resource types reject the import:
-
sysdig_secure_custom_policy.Import errors with "unable to import policy that is not a custom policy" because of:
if policy.IsDefault || policy.TemplateID != 0 {
return nil, errors.New("unable to import policy that is not a custom policy")
}
-
sysdig_secure_managed_policy exposes no Importer, and terraform import errors with "resource sysdig_secure_managed_policy doesn't support import". The Create handler is also strict — it requires IsDefault: true, so it cannot adopt a template-instantiated customer-owned policy either.
This leaves a gap: a real category of customer-owned policies (instantiated from a Sysdig template but customer-managed thereafter) cannot be brought under Terraform management via either resource type.
Reproduction
-
In the Sysdig UI, create a new policy by clicking "Add Policy" → choose one of the Sysdig-provided templates (e.g. "Sysdig Runtime Notable Events").
-
Confirm via API that the resulting policy has isDefault: false, templateId: <non-zero>.
-
In Terraform, declare the resource and an import { ... } block:
resource "sysdig_secure_custom_policy" "example" {
name = "Notable Events Customised"
type = "falco"
# ...
}
import {
to = sysdig_secure_custom_policy.example
id = "<policy_id>"
}
-
Run terraform plan → Error: unable to import policy that is not a custom policy.
-
Switch to sysdig_secure_managed_policy → Error: resource sysdig_secure_managed_policy doesn't support import.
Suggested fix (either approach unblocks the gap)
- Add an
Importer to sysdig_secure_managed_policy that adopts any policy with templateId != 0 (regardless of isDefault). Update the Create handler to also accept isDefault: false policies when templateId != 0.
- OR relax
sysdig_secure_custom_policy.Import so it accepts templateId != 0 policies as long as isDefault: false. The CRUD handlers already treat them as customer-owned (they're not Sysdig defaults; the customer can edit them), so this is a relatively small change.
Versions affected
- Provider 3.8.1 (latest at time of writing). Confirmed by reading provider source at
master.
Workaround
The affected policies can currently only be managed via the Sysdig UI. Terraform imports must skip them, leaving the only meaningful operator interactions (disabling individual rules, adjusting enabled / scope / notification_channels) outside GitOps coverage.
Summary
The provider has no first-class way to bring a Sysdig policy that was instantiated from a Sysdig-provided template (
isDefault: false,templateId != 0) under Terraform management. Both candidate resource types reject the import:sysdig_secure_custom_policy.Importerrors with "unable to import policy that is not a custom policy" because of:sysdig_secure_managed_policyexposes noImporter, andterraform importerrors with "resource sysdig_secure_managed_policy doesn't support import". TheCreatehandler is also strict — it requiresIsDefault: true, so it cannot adopt a template-instantiated customer-owned policy either.This leaves a gap: a real category of customer-owned policies (instantiated from a Sysdig template but customer-managed thereafter) cannot be brought under Terraform management via either resource type.
Reproduction
In the Sysdig UI, create a new policy by clicking "Add Policy" → choose one of the Sysdig-provided templates (e.g. "Sysdig Runtime Notable Events").
Confirm via API that the resulting policy has
isDefault: false,templateId: <non-zero>.In Terraform, declare the resource and an
import { ... }block:Run
terraform plan→Error: unable to import policy that is not a custom policy.Switch to
sysdig_secure_managed_policy→Error: resource sysdig_secure_managed_policy doesn't support import.Suggested fix (either approach unblocks the gap)
Importertosysdig_secure_managed_policythat adopts any policy withtemplateId != 0(regardless ofisDefault). Update theCreatehandler to also acceptisDefault: falsepolicies whentemplateId != 0.sysdig_secure_custom_policy.Importso it acceptstemplateId != 0policies as long asisDefault: false. The CRUD handlers already treat them as customer-owned (they're not Sysdig defaults; the customer can edit them), so this is a relatively small change.Versions affected
master.Workaround
The affected policies can currently only be managed via the Sysdig UI. Terraform imports must skip them, leaving the only meaningful operator interactions (disabling individual rules, adjusting
enabled/scope/notification_channels) outside GitOps coverage.