import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Use this resource to manage entity assignments across one or more rings of a New Relic Fleet. Each resource instance is scoped to a single fleet and may declare any number of `ring` blocks, one per ring to manage. * * > **Note** This resource requires access to the New Relic Fleet Control API. Ensure the API key provided to the provider has the necessary Fleet Control permissions. * * ## How membership management works * * Entities can join a fleet ring through two independent paths: * * 1. **Agent Control instrumentation** — when an entity is instrumented with Agent Control and associated with a fleet, the platform assigns it to the fleet automatically. These entities are outside of Terraform's control unless explicitly declared (see Adopting Agent Control entities below). * * 2. **Explicit assignment** — this resource manages entities via the `FleetControlAddFleetMembers` and `FleetControlRemoveFleetMembers` API mutations. Only entities listed in `entityIds` are tracked. * * This resource operates on an **opt-in management model**: it tracks only the entities explicitly declared in each `ring` block. Entities present in a ring through any other means—including Agent Control instrumentation—are not visible to Terraform, are never reported as drift, and are never removed by this resource — unless they are explicitly added to `entityIds`, at which point they come under full Terraform lifecycle management and can be removed from a ring or moved to another ring on the next `apply`. * * ## Warning reference * * The following warnings may appear during `plan` or `apply` operations: * * ### Entities already assigned in fleet * * This warning fires during `create` or `update` when one or more entities listed in `entityIds` are already assigned somewhere in the fleet (including in a different ring, or via Agent Control). The API rejects duplicate add requests, so the affected entities are skipped for the add mutation. However, if those entities are already in the target ring, they are confirmed by the subsequent read and adopted into Terraform state. From that point on, Terraform manages their lifecycle: removing them from `entityIds` will remove them from the fleet ring on the next `apply`. * * If an entity is in a *different* ring than the one declared, it must first be removed from that ring before it can be reassigned. The warning message identifies the affected entity GUIDs and indicates which ring they were targeted for. * * ### Fleet members removed outside Terraform * * This warning fires during `plan` or `apply` when an entity listed in `entityIds` is no longer present in the ring according to the API. This indicates out-of-band drift—the entity was removed from the ring by a process other than Terraform. The next `apply` will re-add the entity to restore the declared state. To accept the removal instead, remove the entity GUID from `entityIds` and apply again. * * A second `plan` after apply will confirm the state is clean once API-side changes have propagated. * * ## Example Usage * * ### Single ring * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const example = new newrelic.Fleet("example", { * name: "my-fleet", * managedEntityType: "HOST", * operatingSystem: "LINUX", * }); * const exampleFleetMembers = new newrelic.FleetMembers("example", { * fleetId: example.id, * rings: [{ * name: "default", * entityIds: [ * "MXxOR0VQfEhPU1R8MTIzNDU2Nzg", * "MXxOR0VQfEhPU1R8ODc2NTQzMjE", * ], * }], * }); * ``` * * ### Multiple rings * * Multiple `ring` blocks can be declared within a single resource instance to manage entity assignments across rings in one operation. Moving an entity from one ring to another is handled by updating the `entityIds` lists in both ring blocks and applying in a single step. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const example = new newrelic.FleetMembers("example", { * fleetId: exampleNewrelicFleet.id, * rings: [ * { * name: "default", * entityIds: ["MXxOR0VQfEhPU1R8MTIzNDU2Nzg"], * }, * { * name: "canary", * entityIds: [ * "MXxOR0VQfEhPU1R8ODc2NTQzMjE", * "MXxOR0VQfEhPU1R8OTk5ODc2NTQ", * ], * }, * ], * }); * ``` * * ### Adopting Agent Control entities * * To bring an entity that joined via Agent Control under Terraform management, add its GUID to `entityIds`. A warning will indicate that the entity is already assigned in the fleet and was skipped during the add mutation. The entity is then confirmed by the subsequent read and adopted into state. Subsequent plans will be no-ops, and destroying the resource (or removing the GUID from `entityIds`) will remove the entity from the fleet ring. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const example = new newrelic.FleetMembers("example", { * fleetId: exampleNewrelicFleet.id, * rings: [{ * name: "default", * entityIds: [ * "MXxOR0VQfEhPU1R8MTIzNDU2Nzg", * "MXxOR0VQfEhPU1R8ODc2NTQzMjE", * ], * }], * }); * ``` * * ## Drift Detection * * On each `plan` or `refresh`, this resource queries the current membership of each declared ring and compares it against the entity GUIDs in state. If any declared entity is no longer present in the ring, a warning is emitted and the pending plan will include a change to re-add it. If the removal was intentional, remove the GUID from `entityIds` to silence the warning and prevent re-addition. * * Entities present in the ring but not declared in `entityIds` are never surfaced as drift. * * ## Import * * A `newrelic.FleetMembers` resource can be imported using the fleet GUID: * * ```sh * $ pulumi import newrelic:index/fleetMembers:FleetMembers example * ``` * * On import, the resource queries all current members of the fleet and populates a single `ring` block named `"default"` with all discovered entity GUIDs. For fleets with entities distributed across multiple rings, update the `ring` blocks in the configuration to match the actual ring topology after import and run `pulumi preview` to confirm there are no unintended changes. * * > **Note on ordering** Because `entityIds` is an ordered list, the entity GUIDs populated on import reflect the order returned by the API. If your configuration specifies a different order, `pulumi preview` will show an in-place update to reorder the list. Reorder the `entityIds` entries in your configuration to match the imported order, or apply once to let Terraform reorder the state. */ export declare class FleetMembers extends pulumi.CustomResource { /** * Get an existing FleetMembers 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?: FleetMembersState, opts?: pulumi.CustomResourceOptions): FleetMembers; /** * Returns true if the given object is an instance of FleetMembers. 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 FleetMembers; /** * The GUID of the fleet to manage entity assignments for. */ readonly fleetId: pulumi.Output; /** * One or more ring blocks. Each block declares which entities Terraform should maintain in that ring. At least one `ring` block must be specified. The following arguments are supported within each `ring` block: */ readonly rings: pulumi.Output; /** * Create a FleetMembers 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: FleetMembersArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering FleetMembers resources. */ export interface FleetMembersState { /** * The GUID of the fleet to manage entity assignments for. */ fleetId?: pulumi.Input; /** * One or more ring blocks. Each block declares which entities Terraform should maintain in that ring. At least one `ring` block must be specified. The following arguments are supported within each `ring` block: */ rings?: pulumi.Input[] | undefined>; } /** * The set of arguments for constructing a FleetMembers resource. */ export interface FleetMembersArgs { /** * The GUID of the fleet to manage entity assignments for. */ fleetId: pulumi.Input; /** * One or more ring blocks. Each block declares which entities Terraform should maintain in that ring. At least one `ring` block must be specified. The following arguments are supported within each `ring` block: */ rings: pulumi.Input[]>; } //# sourceMappingURL=fleetMembers.d.ts.map