import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Use this resource to create, update, and delete a New Relic One workload. * * Workloads let you group related entities — services, hosts, databases, browser apps, and more — into a single operational view to monitor health and triage incidents across a business domain. * * This resource supports two workload modes: * * - **Standard workload** — define membership using entity GUIDs (`entityGuids`) and/or dynamic search queries (`entitySearchQuery`). Membership updates automatically as query results change. Cannot be used together with `dynamicFlows`. * - **Intelligent workload** — use `dynamicFlows` to anchor the workload to a transaction entry point. If it is set alongside `entityGuids` or `entitySearchQuery`, `dynamicFlows` takes precedence and an intelligent workload is created. New Relic auto-discovers and refreshes related entities every five minutes using Transaction 360 distributed tracing data. Supports `statusConfigAlertPolicy` in addition to the standard `statusConfigAutomatic` and `statusConfigStatic` options. * * A New Relic User API key is required to provision this resource. Set the `apiKey` * attribute in the `provider` block or the `NEW_RELIC_API_KEY` environment * variable with your User API key. * * ## Example Usage * * **Standard Workload** * * Include entities with a certain string on the name. * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.plugins.Workload("foo", { * name: "Example workload", * accountId: "12345678", * entityGuids: ["MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1"], * entitySearchQueries: [{ * query: "name like '%Example application%'", * }], * scopeAccountIds: ["12345678"], * }); * ``` * * Include entities with a set of tags. * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.plugins.Workload("foo", { * name: "Example workload with tags", * accountId: "12345678", * entityGuids: ["MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1"], * entitySearchQueries: [{ * query: "tags.accountId = '12345678' AND tags.environment='production' AND tags.language='java'", * }], * scopeAccountIds: ["12345678"], * }); * ``` * * Include automatic status * * > The global status of your workload is a quick indicator of the workload health. You can configure it to be calculated automatically, and you can also set an alert and get a notification whenever the workload stops being operational. Alternatively, you can communicate a certain status of the workload by setting up a static value and a description. [See our docs](https://docs.newrelic.com/docs/workloads/use-workloads/workloads/workload-status) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.plugins.Workload("foo", { * name: "Example workload", * accountId: "12345678", * entityGuids: ["MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1"], * entitySearchQueries: [{ * query: "name like '%Example application%'", * }], * scopeAccountIds: ["12345678"], * description: "Description", * statusConfigAutomatic: { * enabled: true, * remainingEntitiesRule: { * remainingEntitiesRuleRollup: { * strategy: "BEST_STATUS_WINS", * thresholdType: "FIXED", * thresholdValue: 100, * groupBy: "ENTITY_TYPE", * }, * }, * rules: [{ * entityGuids: ["MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1"], * nrqlQueries: [{ * query: "name like '%Example application2%'", * }], * rollup: { * strategy: "BEST_STATUS_WINS", * thresholdType: "FIXED", * thresholdValue: 100, * }, * }], * }, * }); * ``` * * Include static status * * > You can use this during maintenance tasks or any other time you want to provide a fixed status for your workload. This overrides all automatic rules. [See our docs](https://docs.newrelic.com/docs/workloads/use-workloads/workloads/workload-status#configure-static) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.plugins.Workload("foo", { * name: "Example workload", * accountId: "12345678", * entityGuids: ["MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1"], * entitySearchQueries: [{ * query: "name like '%Example application%'", * }], * scopeAccountIds: ["12345678"], * description: "Description", * statusConfigStatic: { * description: "test", * enabled: true, * status: "OPERATIONAL", * summary: "summary of the status", * }, * }); * ``` * * **Intelligent Workload** * * > An intelligent workload uses `dynamicFlows` to anchor the workload to a transaction entry point. New Relic automatically discovers and refreshes the related entities using Transaction 360 distributed tracing data — no manual entity selection required. If it is set alongside `entityGuids` or `entitySearchQuery`, `dynamicFlows` takes precedence and an intelligent workload is created. The `statusConfigAlertPolicy` block derives workload health from the alert state of its entities and requires `dynamicFlows` to be set; `statusConfigAutomatic` and `statusConfigStatic` remain available. [See our docs](https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/workloads/create-intelligent-workload/) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const intelligent = new newrelic.plugins.Workload("intelligent", { * name: "Example intelligent workload", * accountId: "12345678", * dynamicFlows: [{ * entityGuid: "MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1", * transactionName: "WebTransaction/Action/index", * }], * scopeAccountIds: ["12345678"], * }); * ``` * * **Intelligent Workload with Alert Condition** * * > **BETA PREVIEW:** `targetEntity` in `newrelic.NrqlAlertCondition` is in limited release and only enabled for preview on a per-account basis. Once an intelligent workload is created with `statusConfigAlertPolicy` enabled, alert conditions can be attached by referencing the workload's `guid` (available post-apply as `newrelic_workload..guid`) as `targetEntity`. The workload health is then derived from the alert states of those conditions. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const intelligent = new newrelic.plugins.Workload("intelligent", { * name: "Example intelligent workload", * accountId: "12345678", * dynamicFlows: [{ * entityGuid: "MjUyMDUyOHxBUE18QVBQTElDQVRJT058MjE1MDM3Nzk1", * transactionName: "WebTransaction/Action/index", * }], * scopeAccountIds: ["12345678"], * statusConfigAlertPolicy: { * enabled: true, * }, * }); * const foo = new newrelic.AlertPolicy("foo", {name: "foo"}); * const fooNrqlAlertCondition = new newrelic.NrqlAlertCondition("foo", { * accountId: "12345678", * policyId: foo.id, * type: "static", * name: "foo", * enabled: true, * violationTimeLimitSeconds: 3600, * targetEntity: intelligent.guid, * nrql: { * query: "SELECT count(*) FROM Transaction WHERE appName = 'Your App'", * }, * critical: { * operator: "above", * threshold: 5.5, * thresholdDuration: 300, * thresholdOccurrences: "ALL", * }, * }); * ``` * * ## Import * * New Relic workloads can be imported using a concatenated string of the format * `::`, e.g. * * ```sh * $ pulumi import newrelic:plugins/workload:Workload foo 12345678:1456:MjUyMDUyOHxBUE18QVBRTElDQVRJT058MjE1MDM3Nzk1 * ``` */ export declare class Workload extends pulumi.CustomResource { /** * Get an existing Workload 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?: WorkloadState, opts?: pulumi.CustomResourceOptions): Workload; /** * Returns true if the given object is an instance of Workload. 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 Workload; /** * The New Relic account ID where you want to create the workload. */ readonly accountId: pulumi.Output; /** * The composite query used to compose a dynamic workload. */ readonly compositeEntitySearchQuery: pulumi.Output; /** * Relevant information about the workload. */ readonly description: pulumi.Output; /** * A list of dynamic flow entries that define an **intelligent workload**. If it is set alongside `entityGuids` or `entitySearchQuery`, `dynamicFlows` takes precedence and an intelligent workload is created. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested dynamicFlows blocks below for details. */ readonly dynamicFlows: pulumi.Output; /** * A list of entity GUIDs manually assigned to this workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. */ readonly entityGuids: pulumi.Output; /** * A list of search queries that define a dynamic workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested entitySearchQuery blocks below for details. */ readonly entitySearchQueries: pulumi.Output; /** * The unique entity identifier of the workload in New Relic. */ readonly guid: pulumi.Output; /** * The workload's name. */ readonly name: pulumi.Output; /** * The URL of the workload. */ readonly permalink: pulumi.Output; /** * A list of account IDs that will be used to get entities from. */ readonly scopeAccountIds: pulumi.Output; /** * An alert policy status configuration for intelligent workloads. Requires `dynamicFlows` to be set. See Nested statusConfigAlertPolicy blocks below for details. */ readonly statusConfigAlertPolicy: pulumi.Output; /** * An input object used to represent an automatic status configuration. See Nested statusConfigAutomatic blocks below for details. */ readonly statusConfigAutomatic: pulumi.Output; /** * A list of static status configurations. You can only configure one static status for a workload. See Nested statusConfigStatic blocks below for details. */ readonly statusConfigStatic: pulumi.Output; /** * The unique entity identifier of the workload. */ readonly workloadId: pulumi.Output; /** * Create a Workload 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?: WorkloadArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Workload resources. */ export interface WorkloadState { /** * The New Relic account ID where you want to create the workload. */ accountId?: pulumi.Input; /** * The composite query used to compose a dynamic workload. */ compositeEntitySearchQuery?: pulumi.Input; /** * Relevant information about the workload. */ description?: pulumi.Input; /** * A list of dynamic flow entries that define an **intelligent workload**. If it is set alongside `entityGuids` or `entitySearchQuery`, `dynamicFlows` takes precedence and an intelligent workload is created. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested dynamicFlows blocks below for details. */ dynamicFlows?: pulumi.Input[] | undefined>; /** * A list of entity GUIDs manually assigned to this workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. */ entityGuids?: pulumi.Input[] | undefined>; /** * A list of search queries that define a dynamic workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested entitySearchQuery blocks below for details. */ entitySearchQueries?: pulumi.Input[] | undefined>; /** * The unique entity identifier of the workload in New Relic. */ guid?: pulumi.Input; /** * The workload's name. */ name?: pulumi.Input; /** * The URL of the workload. */ permalink?: pulumi.Input; /** * A list of account IDs that will be used to get entities from. */ scopeAccountIds?: pulumi.Input[] | undefined>; /** * An alert policy status configuration for intelligent workloads. Requires `dynamicFlows` to be set. See Nested statusConfigAlertPolicy blocks below for details. */ statusConfigAlertPolicy?: pulumi.Input; /** * An input object used to represent an automatic status configuration. See Nested statusConfigAutomatic blocks below for details. */ statusConfigAutomatic?: pulumi.Input; /** * A list of static status configurations. You can only configure one static status for a workload. See Nested statusConfigStatic blocks below for details. */ statusConfigStatic?: pulumi.Input; /** * The unique entity identifier of the workload. */ workloadId?: pulumi.Input; } /** * The set of arguments for constructing a Workload resource. */ export interface WorkloadArgs { /** * The New Relic account ID where you want to create the workload. */ accountId?: pulumi.Input; /** * Relevant information about the workload. */ description?: pulumi.Input; /** * A list of dynamic flow entries that define an **intelligent workload**. If it is set alongside `entityGuids` or `entitySearchQuery`, `dynamicFlows` takes precedence and an intelligent workload is created. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested dynamicFlows blocks below for details. */ dynamicFlows?: pulumi.Input[] | undefined>; /** * A list of entity GUIDs manually assigned to this workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. */ entityGuids?: pulumi.Input[] | undefined>; /** * A list of search queries that define a dynamic workload. At least one of `entityGuids`, `entitySearchQuery`, or `dynamicFlows` must be specified. See Nested entitySearchQuery blocks below for details. */ entitySearchQueries?: pulumi.Input[] | undefined>; /** * The workload's name. */ name?: pulumi.Input; /** * A list of account IDs that will be used to get entities from. */ scopeAccountIds?: pulumi.Input[] | undefined>; /** * An alert policy status configuration for intelligent workloads. Requires `dynamicFlows` to be set. See Nested statusConfigAlertPolicy blocks below for details. */ statusConfigAlertPolicy?: pulumi.Input; /** * An input object used to represent an automatic status configuration. See Nested statusConfigAutomatic blocks below for details. */ statusConfigAutomatic?: pulumi.Input; /** * A list of static status configurations. You can only configure one static status for a workload. See Nested statusConfigStatic blocks below for details. */ statusConfigStatic?: pulumi.Input; } //# sourceMappingURL=workload.d.ts.map