import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Use this resource to manage cardinality limit overrides for a New Relic account. * * Dimensional metrics in New Relic are subject to a per-metric cardinality limit — the maximum number of unique attribute-value combinations a single metric name may produce per day. This resource lets you raise or lower that limit, either account-wide (for all metrics at once) or for individual named metrics. * * Two modes are available, selected via the required `mode` argument. * * > **Note:** Cardinality limit overrides are managed via reset rather than removal. Running `terraform destroy` resets the affected limit(s) back to the platform default of **100,000**. The behaviour for each mode is described in the sections below. * * *** * * ## DEFAULT Mode * * Sets a single account-wide limit that applies to every dimensional metric in the account that does not have its own per-metric override. * * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const accountDefault = new newrelic.CardinalityManagement("account_default", { * mode: "DEFAULT", * cardinalityLimit: 150000, * }); * ``` * * ### Behaviour * * - **`pulumi up`** — submits the new default value. The change takes effect in the enforcement layer straight away. * - **`pulumi preview` / `terraform refresh` on an existing resource** — reads the current account-wide default and reconciles state. Any drift is surfaced before the next apply. * - **`terraform destroy`** — resets the account-wide default to the platform default of **100,000** and displays a confirmation warning. * * > **Note:** Changes may take a few minutes to be visible in the New Relic UI, particularly if affected metrics have not sent data recently. * * *** * * ## PER_METRIC Mode * * Sets individual cardinality limits for one or more named metrics. Each metric is configured in its own `metric` block and can have a different limit. * * ### Example — single metric * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const perMetric = new newrelic.CardinalityManagement("per_metric", { * mode: "PER_METRIC", * metrics: [{ * name: "http.server.duration", * cardinalityLimit: 200000, * }], * }); * ``` * * ### Example — multiple metrics in one resource * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const highCardinalityMetrics = new newrelic.CardinalityManagement("high_cardinality_metrics", { * mode: "PER_METRIC", * metrics: [ * { * name: "http.server.duration", * cardinalityLimit: 200000, * }, * { * name: "otelcol_nrreceiver_incoming_request_proxy", * cardinalityLimit: 300000, * }, * { * name: "k8s.pod.cpu.usage", * cardinalityLimit: 150000, * }, * ], * }); * ``` * * ### Example — managing many metrics in bulk * * If you have a long list of metrics to manage, you can keep a single source of truth in `locals` and use a `dynamic` block to expand them into `metric` blocks at apply time. Adding or removing a metric is then a one-line edit. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const highCardinalityMetrics = [ * { * name: "http.server.duration", * limit: 200000, * }, * { * name: "otelcol_nrreceiver_incoming_request_proxy", * limit: 300000, * }, * { * name: "k8s.pod.cpu.usage", * limit: 150000, * }, * { * name: "k8s.pod.memory.usage", * limit: 150000, * }, * ]; * const bulk = new newrelic.CardinalityManagement("bulk", { * metrics: highCardinalityMetrics.map((v, k) => ({key: k, value: v})).map(entry => ({ * name: entry.value.name, * cardinalityLimit: entry.value.limit, * })), * mode: "PER_METRIC", * }); * ``` * * ### Behaviour * * - **`pulumi up`** — submits one override per `metric` block. A warning is displayed as a reminder that updates may take a few minutes to be reflected in the UI. * - **`pulumi preview` / `terraform refresh` on an existing resource** — in `PER_METRIC` mode, `cardinalityLimit` values in state reflect the last configuration applied via terraform — this is the expected behaviour for this mode. A note is displayed as a reminder. * - **`terraform destroy`** — resets each managed metric's limit to the platform default of **100,000** and displays a confirmation warning. * * > **Note:** In `PER_METRIC` mode, the `cardinalityLimit` values within `metric` blocks reflect the last configuration applied via terraform. If any of these limits have been adjusted outside of terraform, run `pulumi up` to re-apply the desired values. * * *** * * ## Using Both Modes Together * * You can manage both the account-wide default and individual metric overrides at the same time: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const accountDefault = new newrelic.CardinalityManagement("account_default", { * mode: "DEFAULT", * cardinalityLimit: 150000, * }); * const perMetric = new newrelic.CardinalityManagement("per_metric", { * mode: "PER_METRIC", * metrics: [ * { * name: "http.server.duration", * cardinalityLimit: 250000, * }, * { * name: "otelcol_nrreceiver_incoming_request_proxy", * cardinalityLimit: 300000, * }, * ], * }); * ``` * * *** * * ## Import * * Cardinality management resources can be imported using the composite ID format `:`. * * For a `DEFAULT` override: * * ```sh * $ pulumi import newrelic:index/cardinalityManagement:CardinalityManagement account_default 12345678:DEFAULT * ``` * * For a `PER_METRIC` override: * * ```sh * $ pulumi import newrelic:index/cardinalityManagement:CardinalityManagement per_metric 12345678:PER_METRIC * ``` * * > **Note:** When importing a `PER_METRIC` resource, `metric` blocks cannot be auto-populated on import and must be defined manually in your configuration. Run `pulumi up` after import to re-apply the desired limits. */ export declare class CardinalityManagement extends pulumi.CustomResource { /** * Get an existing CardinalityManagement 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?: CardinalityManagementState, opts?: pulumi.CustomResourceOptions): CardinalityManagement; /** * Returns true if the given object is an instance of CardinalityManagement. 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 CardinalityManagement; /** * The account-wide cardinality limit — the maximum number of unique dimension-value combinations allowed per metric per day. Required when `mode` is `"DEFAULT"`; must not be set when `mode` is `"PER_METRIC"`. */ readonly cardinalityLimit: pulumi.Output; /** * One or more metric override blocks. Required when `mode` is `"PER_METRIC"`; must not be set when `mode` is `"DEFAULT"`. Each block supports: */ readonly metrics: pulumi.Output; /** * The override mode. Accepted values: `"DEFAULT"` or `"PER_METRIC"`. Forces re-creation when changed. * * `DEFAULT` — sets an account-wide limit for all metrics. `cardinalityLimit` is required; `metric` blocks must not be set. * * `PER_METRIC` — sets individual limits for named metrics. At least one `metric` block is required; `cardinalityLimit` must not be set at the top level. */ readonly mode: pulumi.Output; /** * Create a CardinalityManagement 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: CardinalityManagementArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering CardinalityManagement resources. */ export interface CardinalityManagementState { /** * The account-wide cardinality limit — the maximum number of unique dimension-value combinations allowed per metric per day. Required when `mode` is `"DEFAULT"`; must not be set when `mode` is `"PER_METRIC"`. */ cardinalityLimit?: pulumi.Input; /** * One or more metric override blocks. Required when `mode` is `"PER_METRIC"`; must not be set when `mode` is `"DEFAULT"`. Each block supports: */ metrics?: pulumi.Input[] | undefined>; /** * The override mode. Accepted values: `"DEFAULT"` or `"PER_METRIC"`. Forces re-creation when changed. * * `DEFAULT` — sets an account-wide limit for all metrics. `cardinalityLimit` is required; `metric` blocks must not be set. * * `PER_METRIC` — sets individual limits for named metrics. At least one `metric` block is required; `cardinalityLimit` must not be set at the top level. */ mode?: pulumi.Input; } /** * The set of arguments for constructing a CardinalityManagement resource. */ export interface CardinalityManagementArgs { /** * The account-wide cardinality limit — the maximum number of unique dimension-value combinations allowed per metric per day. Required when `mode` is `"DEFAULT"`; must not be set when `mode` is `"PER_METRIC"`. */ cardinalityLimit?: pulumi.Input; /** * One or more metric override blocks. Required when `mode` is `"PER_METRIC"`; must not be set when `mode` is `"DEFAULT"`. Each block supports: */ metrics?: pulumi.Input[] | undefined>; /** * The override mode. Accepted values: `"DEFAULT"` or `"PER_METRIC"`. Forces re-creation when changed. * * `DEFAULT` — sets an account-wide limit for all metrics. `cardinalityLimit` is required; `metric` blocks must not be set. * * `PER_METRIC` — sets individual limits for named metrics. At least one `metric` block is required; `cardinalityLimit` must not be set at the top level. */ mode: pulumi.Input; } //# sourceMappingURL=cardinalityManagement.d.ts.map