import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Resource for managing Harness Chaos Fault Templates. Phase 1: Core fields (identity, name, description, tags, category, infrastructure, basic spec) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@pulumi/harness"; * * // ============================================================================ * // Harness Chaos Fault Template Resource Examples * // ============================================================================ * // * // Fault templates define reusable chaos faults for experiments. * // These examples are based on TESTED configurations from the e2e-test suite. * // * // Key Points: * // - Faults inject failures into systems (pod delete, network latency, etc.) * // - Type is usually "Custom" for custom faults * // - Category and infrastructures define where fault can run * // ============================================================================ * // ---------------------------------------------------------------------------- * // Example 1: Basic Kubernetes Fault (TESTED ✅) * // ---------------------------------------------------------------------------- * // Most common pattern: Custom Kubernetes fault with container spec * const kubernetesFault = new harness.chaos.FaultTemplate("kubernetes_fault", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "k8s-fault-template", * name: "Kubernetes Fault Template", * description: "Custom Kubernetes fault for chaos injection", * categories: ["Kubernetes"], * infrastructures: ["KubernetesV2"], * type: "Custom", * permissionsRequired: "Basic", * tags: [ * "kubernetes", * "fault", * "custom", * ], * links: [{ * name: "Documentation", * url: "https://docs.harness.io/chaos", * }], * spec: { * chaos: { * faultName: "byoc-injector", * params: [ * { * name: "CHAOS_DURATION", * value: "30s", * }, * { * name: "CHAOS_INTERVAL", * value: "5s", * }, * ], * kubernetes: { * image: "chaosnative/go-runner:ci", * commands: [ * "/bin/bash", * "-c", * ], * args: ["echo 'Running chaos fault'; sleep 30"], * imagePullPolicy: "IfNotPresent", * resources: { * limits: { * cpu: "150m", * memory: "150Mi", * }, * requests: { * cpu: "100m", * memory: "100Mi", * }, * }, * }, * }, * }, * }, { * dependsOn: [projectLevel], * }); * // ---------------------------------------------------------------------------- * // Example 2: Fault with Environment Variables (TESTED ✅) * // ---------------------------------------------------------------------------- * // Fault with environment variables for configuration * const faultWithEnv = new harness.chaos.FaultTemplate("fault_with_env", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "fault-with-env-template", * name: "Fault with Environment Variables", * description: "Fault template with environment configuration", * categories: ["Kubernetes"], * infrastructures: ["KubernetesV2"], * type: "Custom", * permissionsRequired: "Basic", * tags: [ * "kubernetes", * "env", * "config", * ], * links: [{ * name: "Documentation", * url: "https://docs.harness.io/chaos", * }], * spec: { * chaos: { * faultName: "byoc-injector", * params: [ * { * name: "CHAOS_DURATION", * value: "15s", * }, * { * name: "CHAOS_INTERVAL", * value: "3s", * }, * { * name: "TARGET_NAMESPACE", * value: "<+input>.default('default')", * }, * ], * kubernetes: { * image: "chaosnative/go-runner:ci", * commands: [ * "/bin/bash", * "-c", * ], * args: ["echo 'Fault with env vars'; sleep 15"], * imagePullPolicy: "IfNotPresent", * envs: [ * { * name: "TARGET_NAMESPACE", * value: "<+input>.default('default')", * }, * { * name: "CHAOS_MODE", * value: "pod", * }, * ], * resources: { * limits: { * cpu: "200m", * memory: "200Mi", * }, * }, * }, * }, * }, * variables: [{ * name: "target_namespace", * value: "<+input>", * type: "string", * required: false, * description: "Target namespace for chaos injection", * }], * }, { * dependsOn: [projectLevel], * }); * // ---------------------------------------------------------------------------- * // Example 3: Fault with Advanced Configuration (TESTED ✅) * // ---------------------------------------------------------------------------- * // Fault with node selector, labels, and annotations * const advancedFault = new harness.chaos.FaultTemplate("advanced_fault", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "advanced-fault-template", * name: "Advanced Fault Template", * description: "Fault with advanced Kubernetes configuration", * categories: ["Kubernetes"], * infrastructures: ["KubernetesV2"], * type: "Custom", * permissionsRequired: "Basic", * tags: [ * "kubernetes", * "advanced", * "production", * ], * links: [ * { * name: "Documentation", * url: "https://docs.harness.io/chaos", * }, * { * name: "Support", * url: "https://support.harness.io", * }, * ], * spec: { * chaos: { * faultName: "byoc-injector", * params: [ * { * name: "CHAOS_DURATION", * value: "<+input>.default('30s')", * }, * { * name: "CHAOS_INTERVAL", * value: "<+input>.default('5s')", * }, * ], * kubernetes: { * image: "chaosnative/go-runner:ci", * commands: [ * "/bin/bash", * "-c", * ], * args: ["echo 'Advanced chaos fault'; sleep 30"], * imagePullPolicy: "IfNotPresent", * nodeSelector: { * disktype: "ssd", * zone: "us-west-1a", * }, * labels: { * app: "chaos-fault", * environment: "production", * "managed-by": "terraform", * }, * annotations: { * description: "Advanced chaos fault", * owner: "chaos-team", * }, * resources: { * limits: { * cpu: "250m", * memory: "256Mi", * }, * requests: { * cpu: "125m", * memory: "128Mi", * }, * }, * }, * }, * }, * variables: [ * { * name: "chaos_duration", * value: "<+input>", * type: "string", * required: true, * description: "Duration of chaos injection", * }, * { * name: "chaos_interval", * value: "<+input>", * type: "string", * required: false, * description: "Interval between chaos injections", * }, * ], * }, { * dependsOn: [projectLevel], * }); * ``` * * ## Import * * The `pulumi import` command can be used, for example: * * Example 1: Import Project-level Fault Template * Format: org_id/project_id/hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/faultTemplate:FaultTemplate example my_org/my_project/my-chaos-hub/pod-delete-fault * ``` * * Example 2: Import Org-level Fault Template * Format: org_id/hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/faultTemplate:FaultTemplate org_example my_org/org-chaos-hub/org-pod-delete * ``` * * Example 3: Import Account-level Fault Template * Format: hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/faultTemplate:FaultTemplate account_example account-chaos-hub/account-network-fault * ``` */ export declare class FaultTemplate extends pulumi.CustomResource { /** * Get an existing FaultTemplate resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: FaultTemplateState, opts?: pulumi.CustomResourceOptions): FaultTemplate; /** * Returns true if the given object is an instance of FaultTemplate. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is FaultTemplate; /** * Account identifier */ readonly accountId: pulumi.Output; /** * API version */ readonly apiVersion: pulumi.Output; /** * Fault categories */ readonly categories: pulumi.Output; /** * Creation timestamp */ readonly createdAt: pulumi.Output; /** * Creator user ID */ readonly createdBy: pulumi.Output; /** * Description of the fault template */ readonly description: pulumi.Output; /** * Hub identity reference */ readonly hubIdentity: pulumi.Output; /** * Hub reference (computed) */ readonly hubRef: pulumi.Output; /** * Unique identifier for the fault template (immutable) */ readonly identity: pulumi.Output; /** * List of supported infrastructures */ readonly infrastructures: pulumi.Output; /** * Whether this is an enterprise-only template */ readonly isEnterprise: pulumi.Output; /** * Soft delete flag */ readonly isRemoved: pulumi.Output; /** * Search keywords */ readonly keywords: pulumi.Output; /** * Resource kind */ readonly kind: pulumi.Output; /** * Related links */ readonly links: pulumi.Output; /** * Name of the fault template */ readonly name: pulumi.Output; /** * Organization identifier */ readonly orgId: pulumi.Output; /** * Required permissions for the fault */ readonly permissionsRequired: pulumi.Output; /** * Supported platforms */ readonly platforms: pulumi.Output; /** * Project identifier */ readonly projectId: pulumi.Output; /** * Template revision (defaults to v1 if not specified) */ readonly revision: pulumi.Output; /** * Fault specification */ readonly spec: pulumi.Output; /** * Tags for the fault template */ readonly tags: pulumi.Output; /** * Fault type */ readonly type: pulumi.Output; /** * Update timestamp */ readonly updatedAt: pulumi.Output; /** * Updater user ID */ readonly updatedBy: pulumi.Output; /** * Template variables */ readonly variables: pulumi.Output; /** * Create a FaultTemplate resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: FaultTemplateArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering FaultTemplate resources. */ export interface FaultTemplateState { /** * Account identifier */ accountId?: pulumi.Input; /** * API version */ apiVersion?: pulumi.Input; /** * Fault categories */ categories?: pulumi.Input[] | undefined>; /** * Creation timestamp */ createdAt?: pulumi.Input; /** * Creator user ID */ createdBy?: pulumi.Input; /** * Description of the fault template */ description?: pulumi.Input; /** * Hub identity reference */ hubIdentity?: pulumi.Input; /** * Hub reference (computed) */ hubRef?: pulumi.Input; /** * Unique identifier for the fault template (immutable) */ identity?: pulumi.Input; /** * List of supported infrastructures */ infrastructures?: pulumi.Input[] | undefined>; /** * Whether this is an enterprise-only template */ isEnterprise?: pulumi.Input; /** * Soft delete flag */ isRemoved?: pulumi.Input; /** * Search keywords */ keywords?: pulumi.Input[] | undefined>; /** * Resource kind */ kind?: pulumi.Input; /** * Related links */ links?: pulumi.Input[] | undefined>; /** * Name of the fault template */ name?: pulumi.Input; /** * Organization identifier */ orgId?: pulumi.Input; /** * Required permissions for the fault */ permissionsRequired?: pulumi.Input; /** * Supported platforms */ platforms?: pulumi.Input[] | undefined>; /** * Project identifier */ projectId?: pulumi.Input; /** * Template revision (defaults to v1 if not specified) */ revision?: pulumi.Input; /** * Fault specification */ spec?: pulumi.Input; /** * Tags for the fault template */ tags?: pulumi.Input[] | undefined>; /** * Fault type */ type?: pulumi.Input; /** * Update timestamp */ updatedAt?: pulumi.Input; /** * Updater user ID */ updatedBy?: pulumi.Input; /** * Template variables */ variables?: pulumi.Input[] | undefined>; } /** * The set of arguments for constructing a FaultTemplate resource. */ export interface FaultTemplateArgs { /** * API version */ apiVersion?: pulumi.Input; /** * Fault categories */ categories?: pulumi.Input[] | undefined>; /** * Description of the fault template */ description?: pulumi.Input; /** * Hub identity reference */ hubIdentity: pulumi.Input; /** * Unique identifier for the fault template (immutable) */ identity: pulumi.Input; /** * List of supported infrastructures */ infrastructures?: pulumi.Input[] | undefined>; /** * Search keywords */ keywords?: pulumi.Input[] | undefined>; /** * Resource kind */ kind?: pulumi.Input; /** * Related links */ links?: pulumi.Input[] | undefined>; /** * Name of the fault template */ name?: pulumi.Input; /** * Organization identifier */ orgId?: pulumi.Input; /** * Required permissions for the fault */ permissionsRequired?: pulumi.Input; /** * Supported platforms */ platforms?: pulumi.Input[] | undefined>; /** * Project identifier */ projectId?: pulumi.Input; /** * Template revision (defaults to v1 if not specified) */ revision?: pulumi.Input; /** * Fault specification */ spec?: pulumi.Input; /** * Tags for the fault template */ tags?: pulumi.Input[] | undefined>; /** * Fault type */ type?: pulumi.Input; /** * Template variables */ variables?: pulumi.Input[] | undefined>; } //# sourceMappingURL=faultTemplate.d.ts.map