import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Resource for creating chaos experiments from experiment templates. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@pulumi/harness"; * * // ============================================================================ * // Harness Chaos Experiment Resource Examples * // ============================================================================ * // * // Chaos Experiments are INSTANCES created FROM Experiment Templates. * // These examples are based on TESTED configurations from the e2e-test suite. * // * // Key Points: * // - Experiments are created by "launching" an experiment template * // - Infrastructure binding (infra_ref) is MANDATORY (format: env_id/infra_id) * // - Hub scope can be different from experiment scope (cross-scope support) * // - import_type: "REFERENCE" (default) or "LOCAL" (full copy) * // ============================================================================ * // ---------------------------------------------------------------------------- * // Example 1: Basic Experiment with REFERENCE Import * // ---------------------------------------------------------------------------- * // Most common pattern: project-level experiment from project-level template * const basic = new harness.chaos.Experiment("basic", { * orgId: "my_org", * projectId: "my_project", * hubOrgId: "my_org", * hubProjectId: "my_project", * hubIdentity: "my-chaos-hub", * templateIdentity: "my-template", * infraRef: "my-env/my-infra", * name: "My Chaos Experiment", * identity: "my-chaos-experiment", * description: "Basic chaos experiment with REFERENCE import", * importType: "REFERENCE", * tags: [ * "chaos", * "kubernetes", * "resilience", * ], * }, { * dependsOn: [ * myTemplate, * myInfra, * ], * ignoreChanges: ["tags"], * }); * // ---------------------------------------------------------------------------- * // Example 2: Experiment with LOCAL Import * // ---------------------------------------------------------------------------- * // LOCAL import creates a full copy - independent of template changes * const localCopy = new harness.chaos.Experiment("local_copy", { * orgId: "my_org", * projectId: "my_project", * hubOrgId: "my_org", * hubProjectId: "my_project", * hubIdentity: "my-chaos-hub", * templateIdentity: "my-template", * infraRef: "my-env/my-infra", * name: "My Independent Experiment", * identity: "my-independent-experiment", * description: "Experiment with LOCAL import (independent copy)", * importType: "LOCAL", * tags: [ * "chaos", * "local", * "independent", * ], * }, { * dependsOn: [ * myTemplate, * myInfra, * ], * ignoreChanges: ["tags"], * }); * // ---------------------------------------------------------------------------- * // Example 3: Cross-Scope Experiment (Org Hub → Project Experiment) * // ---------------------------------------------------------------------------- * // Create project experiment from org-level template (cross-scope) * const crossScope = new harness.chaos.Experiment("cross_scope", { * orgId: "my_org", * projectId: "my_project", * hubOrgId: "my_org", * hubIdentity: "my-chaos-hub", * templateIdentity: "my-template", * infraRef: "my-env/my-infra", * name: "Cross-Scope Experiment", * identity: "cross-scope-experiment", * description: "Project experiment from org-level template", * importType: "REFERENCE", * tags: [ * "chaos", * "cross-scope", * "org-template", * ], * }, { * dependsOn: [ * orgTemplate, * myInfra, * ], * ignoreChanges: ["tags"], * }); * ``` * * ## Import * * The `pulumi import` command can be used, for example: * * !/bin/bash * === * Harness Chaos Experiment Import Examples * === * * Import Format: org_id/project_id/experiment_identity * * ============================================================================ * * *** * Example 1: Import Project-Level Experiment * --- * * ```sh * $ pulumi import harness:chaos/experiment:Experiment basic my_org/my_project/my-chaos-experiment * ``` * * *** * After Import * --- * 1. Run `terraform state show harness_chaos_experiment.example` to see imported values * 2. Run `pulumi preview` to check for configuration drift * 3. Update your .tf file to match the imported state * * Required configuration after import: * - org_id, projectId * - hub_org_id, hub_project_id, hubIdentity * - templateIdentity * - name, infraRef * - importType (default: "REFERENCE") * *** */ export declare class Experiment extends pulumi.CustomResource { /** * Get an existing Experiment 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?: ExperimentState, opts?: pulumi.CustomResourceOptions): Experiment; /** * Returns true if the given object is an instance of Experiment. 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 Experiment; /** * Creation timestamp (Unix) */ readonly createdAt: pulumi.Output; /** * Username of the creator */ readonly createdBy: pulumi.Output; /** * Cron expression for scheduled execution */ readonly cronSyntax: pulumi.Output; /** * Description of the chaos experiment */ readonly description: pulumi.Output; /** * Full experiment ID */ readonly experimentId: pulumi.Output; /** * Type of the experiment */ readonly experimentType: pulumi.Output; /** * List of fault IDs used in the experiment */ readonly faultIds: pulumi.Output; /** * Identity of the hub where the experiment template resides. Must include scope prefix for account and org levels: 'account.my-hub' for account-level hubs, 'org.my-hub' for org-level hubs, or just 'my-hub' for project-level hubs (no prefix) */ readonly hubIdentity: pulumi.Output; /** * Organization identifier where the hub/template resides (leave empty for account-level hubs). This is used to locate the template, not where the experiment will be created. */ readonly hubOrgId: pulumi.Output; /** * Project identifier where the hub/template resides (leave empty for org-level or account-level hubs). This is used to locate the template, not where the experiment will be created. */ readonly hubProjectId: pulumi.Output; /** * Unique identifier for the experiment (auto-generated if not provided) */ readonly identity: pulumi.Output; /** * Import type: REFERENCE (template reference) or LOCAL (full copy). Default: REFERENCE */ readonly importType: pulumi.Output; /** * Resolved infrastructure ID */ readonly infraId: pulumi.Output; /** * Infrastructure reference (ID or identity) to bind the experiment to */ readonly infraRef: pulumi.Output; /** * Infrastructure type (e.g., KubernetesV2) */ readonly infraType: pulumi.Output; /** * Whether cron scheduling is enabled */ readonly isCronEnabled: pulumi.Output; /** * Whether this is a custom experiment */ readonly isCustomExperiment: pulumi.Output; /** * Whether single-run cron is enabled */ readonly isSingleRunCronEnabled: pulumi.Output; /** * Timestamp of last execution */ readonly lastExecutedAt: pulumi.Output; /** * Full experiment manifest YAML (populated for LOCAL imports) */ readonly manifest: pulumi.Output; /** * Name of the chaos experiment */ readonly name: pulumi.Output; /** * Organization identifier where the experiment will be created */ readonly orgId: pulumi.Output; /** * Project identifier where the experiment will be created */ readonly projectId: pulumi.Output; /** * Template revision to use (default: v1) */ readonly revision: pulumi.Output; /** * Tags to categorize the experiment. Note: Only user-configured tags are tracked in state. The API may add system-generated tags which are automatically filtered to prevent drift. */ readonly tags: pulumi.Output; /** * Target network map ID */ readonly targetNetworkMapId: pulumi.Output; /** * Details about the experiment template used */ readonly templateDetails: pulumi.Output; /** * Identity of the experiment template to launch from */ readonly templateIdentity: pulumi.Output; /** * Total number of experiment runs */ readonly totalExperimentRuns: pulumi.Output; /** * Last update timestamp (Unix) */ readonly updatedAt: pulumi.Output; /** * Username of the last updater */ readonly updatedBy: pulumi.Output; /** * Create a Experiment 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: ExperimentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Experiment resources. */ export interface ExperimentState { /** * Creation timestamp (Unix) */ createdAt?: pulumi.Input; /** * Username of the creator */ createdBy?: pulumi.Input; /** * Cron expression for scheduled execution */ cronSyntax?: pulumi.Input; /** * Description of the chaos experiment */ description?: pulumi.Input; /** * Full experiment ID */ experimentId?: pulumi.Input; /** * Type of the experiment */ experimentType?: pulumi.Input; /** * List of fault IDs used in the experiment */ faultIds?: pulumi.Input[] | undefined>; /** * Identity of the hub where the experiment template resides. Must include scope prefix for account and org levels: 'account.my-hub' for account-level hubs, 'org.my-hub' for org-level hubs, or just 'my-hub' for project-level hubs (no prefix) */ hubIdentity?: pulumi.Input; /** * Organization identifier where the hub/template resides (leave empty for account-level hubs). This is used to locate the template, not where the experiment will be created. */ hubOrgId?: pulumi.Input; /** * Project identifier where the hub/template resides (leave empty for org-level or account-level hubs). This is used to locate the template, not where the experiment will be created. */ hubProjectId?: pulumi.Input; /** * Unique identifier for the experiment (auto-generated if not provided) */ identity?: pulumi.Input; /** * Import type: REFERENCE (template reference) or LOCAL (full copy). Default: REFERENCE */ importType?: pulumi.Input; /** * Resolved infrastructure ID */ infraId?: pulumi.Input; /** * Infrastructure reference (ID or identity) to bind the experiment to */ infraRef?: pulumi.Input; /** * Infrastructure type (e.g., KubernetesV2) */ infraType?: pulumi.Input; /** * Whether cron scheduling is enabled */ isCronEnabled?: pulumi.Input; /** * Whether this is a custom experiment */ isCustomExperiment?: pulumi.Input; /** * Whether single-run cron is enabled */ isSingleRunCronEnabled?: pulumi.Input; /** * Timestamp of last execution */ lastExecutedAt?: pulumi.Input; /** * Full experiment manifest YAML (populated for LOCAL imports) */ manifest?: pulumi.Input; /** * Name of the chaos experiment */ name?: pulumi.Input; /** * Organization identifier where the experiment will be created */ orgId?: pulumi.Input; /** * Project identifier where the experiment will be created */ projectId?: pulumi.Input; /** * Template revision to use (default: v1) */ revision?: pulumi.Input; /** * Tags to categorize the experiment. Note: Only user-configured tags are tracked in state. The API may add system-generated tags which are automatically filtered to prevent drift. */ tags?: pulumi.Input[] | undefined>; /** * Target network map ID */ targetNetworkMapId?: pulumi.Input; /** * Details about the experiment template used */ templateDetails?: pulumi.Input[] | undefined>; /** * Identity of the experiment template to launch from */ templateIdentity?: pulumi.Input; /** * Total number of experiment runs */ totalExperimentRuns?: pulumi.Input; /** * Last update timestamp (Unix) */ updatedAt?: pulumi.Input; /** * Username of the last updater */ updatedBy?: pulumi.Input; } /** * The set of arguments for constructing a Experiment resource. */ export interface ExperimentArgs { /** * Description of the chaos experiment */ description?: pulumi.Input; /** * Identity of the hub where the experiment template resides. Must include scope prefix for account and org levels: 'account.my-hub' for account-level hubs, 'org.my-hub' for org-level hubs, or just 'my-hub' for project-level hubs (no prefix) */ hubIdentity: pulumi.Input; /** * Organization identifier where the hub/template resides (leave empty for account-level hubs). This is used to locate the template, not where the experiment will be created. */ hubOrgId?: pulumi.Input; /** * Project identifier where the hub/template resides (leave empty for org-level or account-level hubs). This is used to locate the template, not where the experiment will be created. */ hubProjectId?: pulumi.Input; /** * Unique identifier for the experiment (auto-generated if not provided) */ identity?: pulumi.Input; /** * Import type: REFERENCE (template reference) or LOCAL (full copy). Default: REFERENCE */ importType?: pulumi.Input; /** * Infrastructure reference (ID or identity) to bind the experiment to */ infraRef: pulumi.Input; /** * Name of the chaos experiment */ name?: pulumi.Input; /** * Organization identifier where the experiment will be created */ orgId: pulumi.Input; /** * Project identifier where the experiment will be created */ projectId: pulumi.Input; /** * Template revision to use (default: v1) */ revision?: pulumi.Input; /** * Tags to categorize the experiment. Note: Only user-configured tags are tracked in state. The API may add system-generated tags which are automatically filtered to prevent drift. */ tags?: pulumi.Input[] | undefined>; /** * Identity of the experiment template to launch from */ templateIdentity: pulumi.Input; } //# sourceMappingURL=experiment.d.ts.map