@incident-io/pulumi 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,424 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import * as inputs from "./types/input";
3
+ import * as outputs from "./types/output";
4
+ /**
5
+ * Configure the forms used to declare, accept, update, and resolve incidents.
6
+ *
7
+ * Each form carries its elements and the expressions those elements can reference.
8
+ * Escalate forms are not part of this API.
9
+ *
10
+ * A form is one resource: its elements and the expressions they reference are written together, in
11
+ * display order, and reconciled server-side on every apply.
12
+ *
13
+ * Every organisation already has a default form of each lifecycle type (`declare`, `accept`, `update`, `resolve`
14
+ * and `retrospective`), which can be neither created nor deleted. To manage one, import it by ID. Destroying
15
+ * it afterwards removes it from state and hands it back to the dashboard, but the form itself remains. A form
16
+ * for a specific incident type is created and deleted like any other resource. A `custom-fields` form has no
17
+ * default, so one with no `incidentTypeId` is created and deleted normally too.
18
+ *
19
+ * The saved form always lists the `name`, `incidentType` and `status` elements first, in that order, whatever
20
+ * order the configuration gives them. List them first, or state keeps your order while the form shows theirs.
21
+ *
22
+ * ## Example - A declare form for one incident type
23
+ *
24
+ * ```typescript
25
+ * import * as pulumi from "@pulumi/pulumi";
26
+ * import * as incident from "@incident-io/pulumi";
27
+ *
28
+ * // A declare form for one incident type. Elements appear in the order listed. The
29
+ * // form is reconciled as a whole on every apply, so an element dropped from this
30
+ * // list is removed from the form.
31
+ * const security = incident.getIncidentType({
32
+ * name: "Security",
33
+ * });
34
+ * const incidentLead = incident.getIncidentRole({
35
+ * name: "Incident Lead",
36
+ * });
37
+ * const affectedSystem = new incident.CustomField("affected_system", {
38
+ * name: "Affected system",
39
+ * description: "The system this incident affects.",
40
+ * fieldType: "text",
41
+ * });
42
+ * const securityDeclare = new incident.IncidentForm("security_declare", {
43
+ * formType: "declare",
44
+ * incidentTypeId: security.then(security => security.id),
45
+ * lifecycleElements: [
46
+ * {
47
+ * elementType: "name",
48
+ * },
49
+ * {
50
+ * elementType: "severity",
51
+ * requiredIf: "always_require",
52
+ * },
53
+ * {
54
+ * elementType: "incident_role",
55
+ * incidentRoleId: incidentLead.then(incidentLead => incidentLead.id),
56
+ * },
57
+ * {
58
+ * elementType: "text",
59
+ * description: "**Security incidents are private by default.** Only add people who need to know.",
60
+ * },
61
+ * {
62
+ * elementType: "custom_field",
63
+ * customFieldId: affectedSystem.id,
64
+ * placeholder: "Which system is affected?",
65
+ * description: "Name the service or data store, not the team.",
66
+ * defaultValue: {
67
+ * valueLiteral: "Unknown",
68
+ * },
69
+ * },
70
+ * {
71
+ * elementType: "divider",
72
+ * },
73
+ * {
74
+ * elementType: "summary",
75
+ * placeholder: "What do we know so far?",
76
+ * },
77
+ * ],
78
+ * });
79
+ * ```
80
+ *
81
+ * ## Example - An accept form for one incident type
82
+ *
83
+ * ```typescript
84
+ * import * as pulumi from "@pulumi/pulumi";
85
+ * import * as incident from "@incident-io/pulumi";
86
+ *
87
+ * // An accept form for one incident type: what responders fill in when they accept
88
+ * // a triage incident as real. Everything a declare form asks for is available here
89
+ * // too, except triage and visibility, which the accepted incident already has.
90
+ * const customerReport = incident.getIncidentType({
91
+ * name: "Customer report",
92
+ * });
93
+ * const commsLead = incident.getIncidentRole({
94
+ * name: "Communications Lead",
95
+ * });
96
+ * const impactStarted = incident.getIncidentTimestamp({
97
+ * name: "Impact started",
98
+ * });
99
+ * const customerReportAccept = new incident.IncidentForm("customer_report_accept", {
100
+ * formType: "accept",
101
+ * incidentTypeId: customerReport.then(customerReport => customerReport.id),
102
+ * lifecycleElements: [
103
+ * {
104
+ * elementType: "name",
105
+ * },
106
+ * {
107
+ * elementType: "severity",
108
+ * requiredIf: "always_require",
109
+ * },
110
+ * {
111
+ * elementType: "incident_role",
112
+ * incidentRoleId: commsLead.then(commsLead => commsLead.id),
113
+ * description: "Customer reports need someone owning the reply.",
114
+ * },
115
+ * {
116
+ * elementType: "timestamp",
117
+ * incidentTimestampId: impactStarted.then(impactStarted => impactStarted.id),
118
+ * description: "When the customer first saw the problem, if they said.",
119
+ * },
120
+ * {
121
+ * elementType: "summary",
122
+ * },
123
+ * ],
124
+ * });
125
+ * ```
126
+ *
127
+ * ## Example - A resolve form with investigation feedback
128
+ *
129
+ * ```typescript
130
+ * import * as pulumi from "@pulumi/pulumi";
131
+ * import * as incident from "@incident-io/pulumi";
132
+ *
133
+ * // A resolve form for one incident type. It collects what is only known at the
134
+ * // end: when the fix landed, and feedback on the investigation.
135
+ * const productionOutage = incident.getIncidentType({
136
+ * name: "Production Outage",
137
+ * });
138
+ * const fixed = incident.getIncidentTimestamp({
139
+ * name: "Fixed",
140
+ * });
141
+ * const rootCause = new incident.CustomField("root_cause", {
142
+ * name: "Root cause",
143
+ * description: "One line on what went wrong.",
144
+ * fieldType: "text",
145
+ * });
146
+ * const productionOutageResolve = new incident.IncidentForm("production_outage_resolve", {
147
+ * formType: "resolve",
148
+ * incidentTypeId: productionOutage.then(productionOutage => productionOutage.id),
149
+ * lifecycleElements: [
150
+ * {
151
+ * elementType: "timestamp",
152
+ * incidentTimestampId: fixed.then(fixed => fixed.id),
153
+ * requiredIf: "always_require",
154
+ * },
155
+ * {
156
+ * elementType: "custom_field",
157
+ * customFieldId: rootCause.id,
158
+ * requiredIf: "always_require",
159
+ * placeholder: "What went wrong?",
160
+ * },
161
+ * {
162
+ * elementType: "summary",
163
+ * description: "Update the summary to say how it was resolved.",
164
+ * },
165
+ * {
166
+ * elementType: "investigation_feedback",
167
+ * config: {
168
+ * requireComment: true,
169
+ * },
170
+ * },
171
+ * ],
172
+ * });
173
+ * ```
174
+ *
175
+ * ## Example - A retrospective form
176
+ *
177
+ * ```typescript
178
+ * import * as pulumi from "@pulumi/pulumi";
179
+ * import * as incident from "@incident-io/pulumi";
180
+ *
181
+ * // A retrospective form for one incident type: the form for logging an incident
182
+ * // after the fact. It has elements no other form has, for the channel to create
183
+ * // and the post-incident flow to start.
184
+ * const nearMiss = incident.getIncidentType({
185
+ * name: "Near miss",
186
+ * });
187
+ * const impactStarted = incident.getIncidentTimestamp({
188
+ * name: "Impact started",
189
+ * });
190
+ * const impactEnded = incident.getIncidentTimestamp({
191
+ * name: "Impact ended",
192
+ * });
193
+ * const nearMissRetrospective = new incident.IncidentForm("near_miss_retrospective", {
194
+ * formType: "retrospective",
195
+ * incidentTypeId: nearMiss.then(nearMiss => nearMiss.id),
196
+ * lifecycleElements: [
197
+ * {
198
+ * elementType: "name",
199
+ * },
200
+ * {
201
+ * elementType: "incident_type",
202
+ * },
203
+ * {
204
+ * elementType: "severity",
205
+ * },
206
+ * {
207
+ * elementType: "timestamp",
208
+ * incidentTimestampId: impactStarted.then(impactStarted => impactStarted.id),
209
+ * requiredIf: "always_require",
210
+ * },
211
+ * {
212
+ * elementType: "timestamp",
213
+ * incidentTimestampId: impactEnded.then(impactEnded => impactEnded.id),
214
+ * requiredIf: "always_require",
215
+ * },
216
+ * {
217
+ * elementType: "summary",
218
+ * },
219
+ * {
220
+ * elementType: "divider",
221
+ * },
222
+ * {
223
+ * elementType: "slack_channel",
224
+ * },
225
+ * {
226
+ * elementType: "announce_retro_incident",
227
+ * },
228
+ * {
229
+ * elementType: "enter_post_incident_flow",
230
+ * description: "Near misses skip the post-incident flow unless something needs following up.",
231
+ * },
232
+ * ],
233
+ * });
234
+ * ```
235
+ *
236
+ * ## Example - A custom-fields form with conditional requirements
237
+ *
238
+ * ```typescript
239
+ * import * as pulumi from "@pulumi/pulumi";
240
+ * import * as incident from "@incident-io/pulumi";
241
+ *
242
+ * // A custom-fields form holds the fields shown in the incident sidebar. It is the
243
+ * // one lifecycle form with no default. This one has no incident_type_id, so it
244
+ * // applies to every incident type without a form of its own.
245
+ * const ticket = new incident.CustomField("ticket", {
246
+ * name: "Ticket",
247
+ * description: "The ticket tracking this incident.",
248
+ * fieldType: "link",
249
+ * });
250
+ * const customerImpact = new incident.CustomField("customer_impact", {
251
+ * name: "Customer impact",
252
+ * description: "How customers were affected.",
253
+ * fieldType: "single_select",
254
+ * });
255
+ * const customerImpactNone = new incident.CustomFieldOption("customer_impact_none", {
256
+ * customFieldId: customerImpact.id,
257
+ * value: "None",
258
+ * });
259
+ * const customFields = new incident.IncidentForm("custom_fields", {
260
+ * formType: "custom-fields",
261
+ * lifecycleElements: [
262
+ * {
263
+ * elementType: "custom_field",
264
+ * customFieldId: ticket.id,
265
+ * },
266
+ * {
267
+ * elementType: "custom_field",
268
+ * customFieldId: customerImpact.id,
269
+ * requiredIf: "check_engine_config",
270
+ * requiredIfConditionGroups: [{
271
+ * conditions: [{
272
+ * subject: "incident.status.category",
273
+ * operation: "one_of",
274
+ * paramBindings: [{
275
+ * arrayValue: [{
276
+ * literal: "closed",
277
+ * }],
278
+ * }],
279
+ * }],
280
+ * }],
281
+ * defaultValue: {
282
+ * valueLiteral: customerImpactNone.id,
283
+ * },
284
+ * canSelectNoValue: true,
285
+ * },
286
+ * ],
287
+ * });
288
+ * ```
289
+ *
290
+ * ## Example - A custom-fields form for one incident type
291
+ *
292
+ * ```typescript
293
+ * import * as pulumi from "@pulumi/pulumi";
294
+ * import * as incident from "@incident-io/pulumi";
295
+ *
296
+ * // A custom-fields form for one incident type, overriding the organisation-wide
297
+ * // one: security incidents show a different set of fields in the sidebar.
298
+ * const security = incident.getIncidentType({
299
+ * name: "Security",
300
+ * });
301
+ * const dataExposed = new incident.CustomField("data_exposed", {
302
+ * name: "Data exposed",
303
+ * description: "Whether customer data was exposed.",
304
+ * fieldType: "bool",
305
+ * });
306
+ * const cve = new incident.CustomField("cve", {
307
+ * name: "CVE",
308
+ * description: "The CVE this incident relates to, if any.",
309
+ * fieldType: "text",
310
+ * });
311
+ * const securityCustomFields = new incident.IncidentForm("security_custom_fields", {
312
+ * formType: "custom-fields",
313
+ * incidentTypeId: security.then(security => security.id),
314
+ * lifecycleElements: [
315
+ * {
316
+ * elementType: "custom_field",
317
+ * customFieldId: dataExposed.id,
318
+ * requiredIf: "always_require",
319
+ * },
320
+ * {
321
+ * elementType: "custom_field",
322
+ * customFieldId: cve.id,
323
+ * placeholder: "CVE-2026-...",
324
+ * },
325
+ * ],
326
+ * });
327
+ * ```
328
+ */
329
+ export declare class IncidentForm extends pulumi.CustomResource {
330
+ /**
331
+ * Get an existing IncidentForm resource's state with the given name, ID, and optional extra
332
+ * properties used to qualify the lookup.
333
+ *
334
+ * @param name The _unique_ name of the resulting resource.
335
+ * @param id The _unique_ provider ID of the resource to lookup.
336
+ * @param state Any extra arguments used during the lookup.
337
+ * @param opts Optional settings to control the behavior of the CustomResource.
338
+ */
339
+ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: IncidentFormState, opts?: pulumi.CustomResourceOptions): IncidentForm;
340
+ /**
341
+ * Returns true if the given object is an instance of IncidentForm. This is designed to work even
342
+ * when multiple copies of the Pulumi SDK have been loaded into the same process.
343
+ */
344
+ static isInstance(obj: any): obj is IncidentForm;
345
+ /**
346
+ * Expressions available to every element's conditions and defaults. Referenced by reference, not by ID.
347
+ */
348
+ readonly expressions: pulumi.Output<outputs.IncidentFormExpression[] | undefined>;
349
+ /**
350
+ * Which form this is. Escalate forms are not part of this API. Possible values are: `declare`, `accept`, `update`, `resolve`, `retrospective`, `custom-fields`. A form's type cannot change, so changing this replaces the form.
351
+ */
352
+ readonly formType: pulumi.Output<string>;
353
+ /**
354
+ * The incident type this form belongs to. Unset for the organisation's default form of this type. A form cannot move to another incident type, so changing this replaces the form.
355
+ */
356
+ readonly incidentTypeId: pulumi.Output<string | undefined>;
357
+ /**
358
+ * Elements on this form, in display order. List position is the order: there is no separate rank.
359
+ */
360
+ readonly lifecycleElements: pulumi.Output<outputs.IncidentFormLifecycleElement[] | undefined>;
361
+ /**
362
+ * Whether to leave this resource unlocked in the incident.io dashboard, so people can edit it there. Defaults to `false`: Terraform claims what it manages, and a claimed resource cannot be edited in the dashboard. Set it to `true` to leave the resource unclaimed — pair that with `lifecycle { ignoreChanges = [...] }` naming the attributes people edit, or the next apply reverts them. Setting it on a resource Terraform already claimed hands that resource back, and someone disconnecting one in the dashboard shows as no change.
363
+ */
364
+ readonly unlockInDashboard: pulumi.Output<boolean | undefined>;
365
+ /**
366
+ * Create a IncidentForm resource with the given unique name, arguments, and options.
367
+ *
368
+ * @param name The _unique_ name of the resource.
369
+ * @param args The arguments to use to populate this resource's properties.
370
+ * @param opts A bag of options that control this resource's behavior.
371
+ */
372
+ constructor(name: string, args: IncidentFormArgs, opts?: pulumi.CustomResourceOptions);
373
+ }
374
+ /**
375
+ * Input properties used for looking up and filtering IncidentForm resources.
376
+ */
377
+ export interface IncidentFormState {
378
+ /**
379
+ * Expressions available to every element's conditions and defaults. Referenced by reference, not by ID.
380
+ */
381
+ expressions?: pulumi.Input<pulumi.Input<inputs.IncidentFormExpression>[] | undefined>;
382
+ /**
383
+ * Which form this is. Escalate forms are not part of this API. Possible values are: `declare`, `accept`, `update`, `resolve`, `retrospective`, `custom-fields`. A form's type cannot change, so changing this replaces the form.
384
+ */
385
+ formType?: pulumi.Input<string | undefined>;
386
+ /**
387
+ * The incident type this form belongs to. Unset for the organisation's default form of this type. A form cannot move to another incident type, so changing this replaces the form.
388
+ */
389
+ incidentTypeId?: pulumi.Input<string | undefined>;
390
+ /**
391
+ * Elements on this form, in display order. List position is the order: there is no separate rank.
392
+ */
393
+ lifecycleElements?: pulumi.Input<pulumi.Input<inputs.IncidentFormLifecycleElement>[] | undefined>;
394
+ /**
395
+ * Whether to leave this resource unlocked in the incident.io dashboard, so people can edit it there. Defaults to `false`: Terraform claims what it manages, and a claimed resource cannot be edited in the dashboard. Set it to `true` to leave the resource unclaimed — pair that with `lifecycle { ignoreChanges = [...] }` naming the attributes people edit, or the next apply reverts them. Setting it on a resource Terraform already claimed hands that resource back, and someone disconnecting one in the dashboard shows as no change.
396
+ */
397
+ unlockInDashboard?: pulumi.Input<boolean | undefined>;
398
+ }
399
+ /**
400
+ * The set of arguments for constructing a IncidentForm resource.
401
+ */
402
+ export interface IncidentFormArgs {
403
+ /**
404
+ * Expressions available to every element's conditions and defaults. Referenced by reference, not by ID.
405
+ */
406
+ expressions?: pulumi.Input<pulumi.Input<inputs.IncidentFormExpression>[] | undefined>;
407
+ /**
408
+ * Which form this is. Escalate forms are not part of this API. Possible values are: `declare`, `accept`, `update`, `resolve`, `retrospective`, `custom-fields`. A form's type cannot change, so changing this replaces the form.
409
+ */
410
+ formType: pulumi.Input<string>;
411
+ /**
412
+ * The incident type this form belongs to. Unset for the organisation's default form of this type. A form cannot move to another incident type, so changing this replaces the form.
413
+ */
414
+ incidentTypeId?: pulumi.Input<string | undefined>;
415
+ /**
416
+ * Elements on this form, in display order. List position is the order: there is no separate rank.
417
+ */
418
+ lifecycleElements?: pulumi.Input<pulumi.Input<inputs.IncidentFormLifecycleElement>[] | undefined>;
419
+ /**
420
+ * Whether to leave this resource unlocked in the incident.io dashboard, so people can edit it there. Defaults to `false`: Terraform claims what it manages, and a claimed resource cannot be edited in the dashboard. Set it to `true` to leave the resource unclaimed — pair that with `lifecycle { ignoreChanges = [...] }` naming the attributes people edit, or the next apply reverts them. Setting it on a resource Terraform already claimed hands that resource back, and someone disconnecting one in the dashboard shows as no change.
421
+ */
422
+ unlockInDashboard?: pulumi.Input<boolean | undefined>;
423
+ }
424
+ //# sourceMappingURL=incidentForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incidentForm.d.ts","sourceRoot":"","sources":["../incidentForm.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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