import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Resource for managing Harness Chaos Action Templates. Action templates define reusable actions that can be used in chaos experiments. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@pulumi/harness"; * * // ============================================================================ * // Harness Chaos Action Template Resource Examples * // ============================================================================ * // * // Action templates define reusable actions for chaos experiments. * // These examples are based on TESTED configurations from the e2e-test suite. * // * // Key Points: * // - Actions can be delay, script, or container type * // - Runtime inputs with defaults: "<+input>.default('value')" * // - Container actions support full Kubernetes pod configuration * // ============================================================================ * // ---------------------------------------------------------------------------- * // Example 1: Container Action with Runtime Inputs (TESTED ✅) * // ---------------------------------------------------------------------------- * // Most common pattern: container action with runtime inputs and defaults * const containerWithRuntimeInputs = new harness.chaos.ActionTemplate("container_with_runtime_inputs", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "container-action-template", * name: "Container Action Template", * description: "Container action with runtime inputs and defaults", * type: "container", * infrastructureType: "<+input>.default('Kubernetes')", * tags: [ * "container", * "kubernetes", * "runtime-inputs", * ], * containerAction: { * image: "<+input>.default('busybox:latest')", * commands: ["<+input>.default('sh')"], * args: "echo 'Running container action'; sleep 15", * namespace: "<+input>.default('default')", * nodeSelector: { * disktype: "ssd", * zone: "us-west-1a", * }, * labels: { * app: "chaos-action", * environment: "production", * "managed-by": "terraform", * }, * annotations: { * description: "Chaos container action", * owner: "chaos-team", * }, * envs: [ * { * name: "TEST_VAR", * value: "<+input>.default('test_value')", * }, * { * name: "ANOTHER_VAR", * value: "<+input>.default('another_value')", * }, * ], * resources: { * limits: { * cpu: "500m", * memory: "512Mi", * }, * requests: { * cpu: "250m", * memory: "256Mi", * }, * }, * }, * runProperties: { * timeout: "<+input>.default('60s')", * interval: "<+input>.default('15s')", * }, * variables: [ * { * name: "container_image", * value: "<+input>", * type: "string", * required: true, * description: "Container image to use (runtime input)", * }, * { * name: "namespace", * value: "<+input>", * type: "string", * required: false, * description: "Kubernetes namespace (runtime input)", * }, * ], * }, { * dependsOn: [projectLevel], * }); * // ---------------------------------------------------------------------------- * // Example 2: Simple Delay Action (TESTED ✅) * // ---------------------------------------------------------------------------- * // Delay action for adding wait time in experiments * const delayAction = new harness.chaos.ActionTemplate("delay_action", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "delay-action-template", * name: "Delay Action Template", * description: "Simple delay action for wait time", * type: "delay", * infrastructureType: "Kubernetes", * tags: [ * "delay", * "wait", * ], * delayAction: { * duration: "<+input>.default('30s')", * }, * runProperties: { * timeout: "60s", * }, * }, { * dependsOn: [projectLevel], * }); * // ---------------------------------------------------------------------------- * // Example 3: Script Action (TESTED ✅) * // ---------------------------------------------------------------------------- * // Custom script action for flexible operations * const scriptAction = new harness.chaos.ActionTemplate("script_action", { * orgId: _this.id, * projectId: thisHarnessPlatformProject.id, * hubIdentity: projectLevel.identity, * identity: "script-action-template", * name: "Script Action Template", * description: "Custom script action for chaos operations", * type: "script", * infrastructureType: "<+input>.default('Kubernetes')", * tags: [ * "script", * "custom", * ], * customScriptAction: { * script: `#!/bin/bash * echo \\"Running custom chaos script\\" * echo \\"Target: <+input>\\" * sleep 10 * echo \\"Script completed\\" * `, * shell: "bash", * envs: [{ * name: "TARGET", * value: "<+input>.default('default-target')", * }], * }, * runProperties: { * timeout: "<+input>.default('120s')", * interval: "30s", * }, * variables: [{ * name: "target_resource", * value: "<+input>", * type: "string", * required: true, * description: "Target resource for the script", * }], * }, { * dependsOn: [projectLevel], * }); * ``` * * ## Import * * The `pulumi import` command can be used, for example: * * Example 1: Import Project-level Action Template * Format: org_id/project_id/hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/actionTemplate:ActionTemplate example my_org/my_project/my-chaos-hub/delay-action-template * ``` * * Example 2: Import Org-level Action Template * Format: org_id/hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/actionTemplate:ActionTemplate org_example my_org/org-chaos-hub/org-script-action * ``` * * Example 3: Import Account-level Action Template * Format: hub_identity/template_identity * * ```sh * $ pulumi import harness:chaos/actionTemplate:ActionTemplate account_example account-chaos-hub/account-delay-action * ``` */ export declare class ActionTemplate extends pulumi.CustomResource { /** * Get an existing ActionTemplate 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?: ActionTemplateState, opts?: pulumi.CustomResourceOptions): ActionTemplate; /** * Returns true if the given object is an instance of ActionTemplate. 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 ActionTemplate; /** * Account identifier. */ readonly accountId: pulumi.Output; /** * Container action configuration. Required when type is 'container'. */ readonly containerAction: pulumi.Output; /** * Creation timestamp (Unix epoch). */ readonly createdAt: pulumi.Output; /** * User who created the action template. */ readonly createdBy: pulumi.Output; /** * Custom script action configuration. Required when type is 'customScript'. */ readonly customScriptAction: pulumi.Output; /** * Delay action configuration. Required when type is 'delay'. */ readonly delayAction: pulumi.Output; /** * Description of the action template. */ readonly description: pulumi.Output; /** * Identity of the chaos hub this action template belongs to. */ readonly hubIdentity: pulumi.Output; /** * Internal ID of the action template. */ readonly idInternal: pulumi.Output; /** * Unique identifier for the action template (immutable). */ readonly identity: pulumi.Output; /** * Infrastructure type for the action template. Valid values: Kubernetes, KubernetesV2, Windows, Linux, CloudFoundry, Container. Supports runtime inputs like <+input>. */ readonly infrastructureType: pulumi.Output; /** * Whether this is the default version for predefined actions. */ readonly isDefault: pulumi.Output; /** * Whether this is an enterprise action template. */ readonly isEnterprise: pulumi.Output; /** * Whether the action template has been removed. */ readonly isRemoved: pulumi.Output; /** * Name of the action template. */ readonly name: pulumi.Output; /** * Organization identifier. */ readonly orgId: pulumi.Output; /** * Project identifier. */ readonly projectId: pulumi.Output; /** * Revision number of the action template. */ readonly revision: pulumi.Output; /** * Run properties for the action template execution. */ readonly runProperties: pulumi.Output; /** * Tags to associate with the action template. */ readonly tags: pulumi.Output; /** * Template content/definition. */ readonly template: pulumi.Output; /** * Type of the action template. Valid values: delay, customScript, container. */ readonly type: pulumi.Output; /** * Last update timestamp (Unix epoch). */ readonly updatedAt: pulumi.Output; /** * User who last updated the action template. */ readonly updatedBy: pulumi.Output; /** * Template variables that can be used in the action. */ readonly variables: pulumi.Output; /** * Create a ActionTemplate 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: ActionTemplateArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ActionTemplate resources. */ export interface ActionTemplateState { /** * Account identifier. */ accountId?: pulumi.Input; /** * Container action configuration. Required when type is 'container'. */ containerAction?: pulumi.Input; /** * Creation timestamp (Unix epoch). */ createdAt?: pulumi.Input; /** * User who created the action template. */ createdBy?: pulumi.Input; /** * Custom script action configuration. Required when type is 'customScript'. */ customScriptAction?: pulumi.Input; /** * Delay action configuration. Required when type is 'delay'. */ delayAction?: pulumi.Input; /** * Description of the action template. */ description?: pulumi.Input; /** * Identity of the chaos hub this action template belongs to. */ hubIdentity?: pulumi.Input; /** * Internal ID of the action template. */ idInternal?: pulumi.Input; /** * Unique identifier for the action template (immutable). */ identity?: pulumi.Input; /** * Infrastructure type for the action template. Valid values: Kubernetes, KubernetesV2, Windows, Linux, CloudFoundry, Container. Supports runtime inputs like <+input>. */ infrastructureType?: pulumi.Input; /** * Whether this is the default version for predefined actions. */ isDefault?: pulumi.Input; /** * Whether this is an enterprise action template. */ isEnterprise?: pulumi.Input; /** * Whether the action template has been removed. */ isRemoved?: pulumi.Input; /** * Name of the action template. */ name?: pulumi.Input; /** * Organization identifier. */ orgId?: pulumi.Input; /** * Project identifier. */ projectId?: pulumi.Input; /** * Revision number of the action template. */ revision?: pulumi.Input; /** * Run properties for the action template execution. */ runProperties?: pulumi.Input; /** * Tags to associate with the action template. */ tags?: pulumi.Input[] | undefined>; /** * Template content/definition. */ template?: pulumi.Input; /** * Type of the action template. Valid values: delay, customScript, container. */ type?: pulumi.Input; /** * Last update timestamp (Unix epoch). */ updatedAt?: pulumi.Input; /** * User who last updated the action template. */ updatedBy?: pulumi.Input; /** * Template variables that can be used in the action. */ variables?: pulumi.Input[] | undefined>; } /** * The set of arguments for constructing a ActionTemplate resource. */ export interface ActionTemplateArgs { /** * Container action configuration. Required when type is 'container'. */ containerAction?: pulumi.Input; /** * Custom script action configuration. Required when type is 'customScript'. */ customScriptAction?: pulumi.Input; /** * Delay action configuration. Required when type is 'delay'. */ delayAction?: pulumi.Input; /** * Description of the action template. */ description?: pulumi.Input; /** * Identity of the chaos hub this action template belongs to. */ hubIdentity: pulumi.Input; /** * Unique identifier for the action template (immutable). */ identity: pulumi.Input; /** * Infrastructure type for the action template. Valid values: Kubernetes, KubernetesV2, Windows, Linux, CloudFoundry, Container. Supports runtime inputs like <+input>. */ infrastructureType?: pulumi.Input; /** * Name of the action template. */ name?: pulumi.Input; /** * Organization identifier. */ orgId?: pulumi.Input; /** * Project identifier. */ projectId?: pulumi.Input; /** * Run properties for the action template execution. */ runProperties?: pulumi.Input; /** * Tags to associate with the action template. */ tags?: pulumi.Input[] | undefined>; /** * Type of the action template. Valid values: delay, customScript, container. */ type: pulumi.Input; /** * Template variables that can be used in the action. */ variables?: pulumi.Input[] | undefined>; } //# sourceMappingURL=actionTemplate.d.ts.map