/
analyticsWorkspace.ts
394 lines (386 loc) · 22.3 KB
/
analyticsWorkspace.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as utilities from "../utilities";
/**
* Manages a Log Analytics (formally Operational Insights) Workspace.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
*
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
* name: "acctest-01",
* location: example.location,
* resourceGroupName: example.name,
* sku: "PerGB2018",
* retentionInDays: 30,
* });
* ```
*
* ## Import
*
* Log Analytics Workspaces can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:operationalinsights/analyticsWorkspace:AnalyticsWorkspace workspace1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1
* ```
*/
export class AnalyticsWorkspace extends pulumi.CustomResource {
/**
* Get an existing AnalyticsWorkspace 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.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AnalyticsWorkspaceState, opts?: pulumi.CustomResourceOptions): AnalyticsWorkspace {
return new AnalyticsWorkspace(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'azure:operationalinsights/analyticsWorkspace:AnalyticsWorkspace';
/**
* Returns true if the given object is an instance of AnalyticsWorkspace. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is AnalyticsWorkspace {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AnalyticsWorkspace.__pulumiType;
}
/**
* Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults to `true`.
*/
public readonly allowResourceOnlyPermissions!: pulumi.Output<boolean | undefined>;
/**
* Is Customer Managed Storage mandatory for query management?
*/
public readonly cmkForQueryForced!: pulumi.Output<boolean | undefined>;
/**
* The workspace daily quota for ingestion in GB. Defaults to -1 (unlimited) if omitted.
*
* > **NOTE:** When `sku` is set to `Free` this field should not be set and has a default value of `0.5`.
*/
public readonly dailyQuotaGb!: pulumi.Output<number | undefined>;
/**
* The ID of the Data Collection Rule to use for this workspace.
*/
public readonly dataCollectionRuleId!: pulumi.Output<string | undefined>;
/**
* An `identity` block as defined below.
*/
public readonly identity!: pulumi.Output<outputs.operationalinsights.AnalyticsWorkspaceIdentity | undefined>;
/**
* Whether to remove the data in the Log Analytics Workspace immediately after 30 days.
*/
public readonly immediateDataPurgeOn30DaysEnabled!: pulumi.Output<boolean | undefined>;
/**
* Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to `true`.
*/
public readonly internetIngestionEnabled!: pulumi.Output<boolean | undefined>;
/**
* Should the Log Analytics Workspace support querying over the Public Internet? Defaults to `true`.
*/
public readonly internetQueryEnabled!: pulumi.Output<boolean | undefined>;
/**
* Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults to `false`.
*/
public readonly localAuthenticationDisabled!: pulumi.Output<boolean | undefined>;
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public readonly location!: pulumi.Output<string>;
/**
* Specifies the name of the Log Analytics Workspace. Workspace name should include 4-63 letters, digits or '-'. The '-' shouldn't be the first or the last symbol. Changing this forces a new resource to be created.
*/
public readonly name!: pulumi.Output<string>;
/**
* The Primary shared key for the Log Analytics Workspace.
*/
public /*out*/ readonly primarySharedKey!: pulumi.Output<string>;
/**
* The capacity reservation level in GB for this workspace. Possible values are `100`, `200`, `300`, `400`, `500`, `1000`, `2000` and `5000`.
*
* > **NOTE:** `reservationCapacityInGbPerDay` can only be used when the `sku` is set to `CapacityReservation`.
*/
public readonly reservationCapacityInGbPerDay!: pulumi.Output<number | undefined>;
/**
* The name of the resource group in which the Log Analytics workspace is created. Changing this forces a new resource to be created.
*/
public readonly resourceGroupName!: pulumi.Output<string>;
/**
* The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.
*/
public readonly retentionInDays!: pulumi.Output<number>;
/**
* The Secondary shared key for the Log Analytics Workspace.
*/
public /*out*/ readonly secondarySharedKey!: pulumi.Output<string>;
/**
* Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`.
*
* > **NOTE:** A new pricing model took effect on `2018-04-03`, which requires the SKU `PerGB2018`. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about [the Pricing SKUs is available at the following URI](https://aka.ms/PricingTierWarning).
*
* > **NOTE:** Changing `sku` forces a new Log Analytics Workspace to be created, except when changing between `PerGB2018` and `CapacityReservation`. However, changing `sku` to `CapacityReservation` or changing `reservationCapacityInGbPerDay` to a higher tier will lead to a 31-days commitment period, during which the SKU cannot be changed to a lower one. Please refer to [official documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/cost-logs#commitment-tiers) for further information.
*
* > **NOTE:** The `Free` SKU has a default `dailyQuotaGb` value of `0.5` (GB).
*/
public readonly sku!: pulumi.Output<string>;
/**
* A mapping of tags to assign to the resource.
*
* > **NOTE:** If a `azure.operationalinsights.AnalyticsWorkspace` is connected to a `azure.loganalytics.Cluster` via a `azure.loganalytics.LinkedService` you will not be able to modify the workspaces `sku` field until the link between the workspace and the cluster has been broken by deleting the `azure.loganalytics.LinkedService` resource. All other fields are modifiable while the workspace is linked to a cluster.
*/
public readonly tags!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* The Workspace (or Customer) ID for the Log Analytics Workspace.
*/
public /*out*/ readonly workspaceId!: pulumi.Output<string>;
/**
* Create a AnalyticsWorkspace 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: AnalyticsWorkspaceArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: AnalyticsWorkspaceArgs | AnalyticsWorkspaceState, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as AnalyticsWorkspaceState | undefined;
resourceInputs["allowResourceOnlyPermissions"] = state ? state.allowResourceOnlyPermissions : undefined;
resourceInputs["cmkForQueryForced"] = state ? state.cmkForQueryForced : undefined;
resourceInputs["dailyQuotaGb"] = state ? state.dailyQuotaGb : undefined;
resourceInputs["dataCollectionRuleId"] = state ? state.dataCollectionRuleId : undefined;
resourceInputs["identity"] = state ? state.identity : undefined;
resourceInputs["immediateDataPurgeOn30DaysEnabled"] = state ? state.immediateDataPurgeOn30DaysEnabled : undefined;
resourceInputs["internetIngestionEnabled"] = state ? state.internetIngestionEnabled : undefined;
resourceInputs["internetQueryEnabled"] = state ? state.internetQueryEnabled : undefined;
resourceInputs["localAuthenticationDisabled"] = state ? state.localAuthenticationDisabled : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["primarySharedKey"] = state ? state.primarySharedKey : undefined;
resourceInputs["reservationCapacityInGbPerDay"] = state ? state.reservationCapacityInGbPerDay : undefined;
resourceInputs["resourceGroupName"] = state ? state.resourceGroupName : undefined;
resourceInputs["retentionInDays"] = state ? state.retentionInDays : undefined;
resourceInputs["secondarySharedKey"] = state ? state.secondarySharedKey : undefined;
resourceInputs["sku"] = state ? state.sku : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["workspaceId"] = state ? state.workspaceId : undefined;
} else {
const args = argsOrState as AnalyticsWorkspaceArgs | undefined;
if ((!args || args.resourceGroupName === undefined) && !opts.urn) {
throw new Error("Missing required property 'resourceGroupName'");
}
resourceInputs["allowResourceOnlyPermissions"] = args ? args.allowResourceOnlyPermissions : undefined;
resourceInputs["cmkForQueryForced"] = args ? args.cmkForQueryForced : undefined;
resourceInputs["dailyQuotaGb"] = args ? args.dailyQuotaGb : undefined;
resourceInputs["dataCollectionRuleId"] = args ? args.dataCollectionRuleId : undefined;
resourceInputs["identity"] = args ? args.identity : undefined;
resourceInputs["immediateDataPurgeOn30DaysEnabled"] = args ? args.immediateDataPurgeOn30DaysEnabled : undefined;
resourceInputs["internetIngestionEnabled"] = args ? args.internetIngestionEnabled : undefined;
resourceInputs["internetQueryEnabled"] = args ? args.internetQueryEnabled : undefined;
resourceInputs["localAuthenticationDisabled"] = args ? args.localAuthenticationDisabled : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["reservationCapacityInGbPerDay"] = args ? args.reservationCapacityInGbPerDay : undefined;
resourceInputs["resourceGroupName"] = args ? args.resourceGroupName : undefined;
resourceInputs["retentionInDays"] = args ? args.retentionInDays : undefined;
resourceInputs["sku"] = args ? args.sku : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["primarySharedKey"] = undefined /*out*/;
resourceInputs["secondarySharedKey"] = undefined /*out*/;
resourceInputs["workspaceId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["primarySharedKey", "secondarySharedKey"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(AnalyticsWorkspace.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering AnalyticsWorkspace resources.
*/
export interface AnalyticsWorkspaceState {
/**
* Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults to `true`.
*/
allowResourceOnlyPermissions?: pulumi.Input<boolean>;
/**
* Is Customer Managed Storage mandatory for query management?
*/
cmkForQueryForced?: pulumi.Input<boolean>;
/**
* The workspace daily quota for ingestion in GB. Defaults to -1 (unlimited) if omitted.
*
* > **NOTE:** When `sku` is set to `Free` this field should not be set and has a default value of `0.5`.
*/
dailyQuotaGb?: pulumi.Input<number>;
/**
* The ID of the Data Collection Rule to use for this workspace.
*/
dataCollectionRuleId?: pulumi.Input<string>;
/**
* An `identity` block as defined below.
*/
identity?: pulumi.Input<inputs.operationalinsights.AnalyticsWorkspaceIdentity>;
/**
* Whether to remove the data in the Log Analytics Workspace immediately after 30 days.
*/
immediateDataPurgeOn30DaysEnabled?: pulumi.Input<boolean>;
/**
* Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to `true`.
*/
internetIngestionEnabled?: pulumi.Input<boolean>;
/**
* Should the Log Analytics Workspace support querying over the Public Internet? Defaults to `true`.
*/
internetQueryEnabled?: pulumi.Input<boolean>;
/**
* Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults to `false`.
*/
localAuthenticationDisabled?: pulumi.Input<boolean>;
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
location?: pulumi.Input<string>;
/**
* Specifies the name of the Log Analytics Workspace. Workspace name should include 4-63 letters, digits or '-'. The '-' shouldn't be the first or the last symbol. Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* The Primary shared key for the Log Analytics Workspace.
*/
primarySharedKey?: pulumi.Input<string>;
/**
* The capacity reservation level in GB for this workspace. Possible values are `100`, `200`, `300`, `400`, `500`, `1000`, `2000` and `5000`.
*
* > **NOTE:** `reservationCapacityInGbPerDay` can only be used when the `sku` is set to `CapacityReservation`.
*/
reservationCapacityInGbPerDay?: pulumi.Input<number>;
/**
* The name of the resource group in which the Log Analytics workspace is created. Changing this forces a new resource to be created.
*/
resourceGroupName?: pulumi.Input<string>;
/**
* The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.
*/
retentionInDays?: pulumi.Input<number>;
/**
* The Secondary shared key for the Log Analytics Workspace.
*/
secondarySharedKey?: pulumi.Input<string>;
/**
* Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`.
*
* > **NOTE:** A new pricing model took effect on `2018-04-03`, which requires the SKU `PerGB2018`. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about [the Pricing SKUs is available at the following URI](https://aka.ms/PricingTierWarning).
*
* > **NOTE:** Changing `sku` forces a new Log Analytics Workspace to be created, except when changing between `PerGB2018` and `CapacityReservation`. However, changing `sku` to `CapacityReservation` or changing `reservationCapacityInGbPerDay` to a higher tier will lead to a 31-days commitment period, during which the SKU cannot be changed to a lower one. Please refer to [official documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/cost-logs#commitment-tiers) for further information.
*
* > **NOTE:** The `Free` SKU has a default `dailyQuotaGb` value of `0.5` (GB).
*/
sku?: pulumi.Input<string>;
/**
* A mapping of tags to assign to the resource.
*
* > **NOTE:** If a `azure.operationalinsights.AnalyticsWorkspace` is connected to a `azure.loganalytics.Cluster` via a `azure.loganalytics.LinkedService` you will not be able to modify the workspaces `sku` field until the link between the workspace and the cluster has been broken by deleting the `azure.loganalytics.LinkedService` resource. All other fields are modifiable while the workspace is linked to a cluster.
*/
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The Workspace (or Customer) ID for the Log Analytics Workspace.
*/
workspaceId?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a AnalyticsWorkspace resource.
*/
export interface AnalyticsWorkspaceArgs {
/**
* Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults to `true`.
*/
allowResourceOnlyPermissions?: pulumi.Input<boolean>;
/**
* Is Customer Managed Storage mandatory for query management?
*/
cmkForQueryForced?: pulumi.Input<boolean>;
/**
* The workspace daily quota for ingestion in GB. Defaults to -1 (unlimited) if omitted.
*
* > **NOTE:** When `sku` is set to `Free` this field should not be set and has a default value of `0.5`.
*/
dailyQuotaGb?: pulumi.Input<number>;
/**
* The ID of the Data Collection Rule to use for this workspace.
*/
dataCollectionRuleId?: pulumi.Input<string>;
/**
* An `identity` block as defined below.
*/
identity?: pulumi.Input<inputs.operationalinsights.AnalyticsWorkspaceIdentity>;
/**
* Whether to remove the data in the Log Analytics Workspace immediately after 30 days.
*/
immediateDataPurgeOn30DaysEnabled?: pulumi.Input<boolean>;
/**
* Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to `true`.
*/
internetIngestionEnabled?: pulumi.Input<boolean>;
/**
* Should the Log Analytics Workspace support querying over the Public Internet? Defaults to `true`.
*/
internetQueryEnabled?: pulumi.Input<boolean>;
/**
* Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults to `false`.
*/
localAuthenticationDisabled?: pulumi.Input<boolean>;
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
location?: pulumi.Input<string>;
/**
* Specifies the name of the Log Analytics Workspace. Workspace name should include 4-63 letters, digits or '-'. The '-' shouldn't be the first or the last symbol. Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* The capacity reservation level in GB for this workspace. Possible values are `100`, `200`, `300`, `400`, `500`, `1000`, `2000` and `5000`.
*
* > **NOTE:** `reservationCapacityInGbPerDay` can only be used when the `sku` is set to `CapacityReservation`.
*/
reservationCapacityInGbPerDay?: pulumi.Input<number>;
/**
* The name of the resource group in which the Log Analytics workspace is created. Changing this forces a new resource to be created.
*/
resourceGroupName: pulumi.Input<string>;
/**
* The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.
*/
retentionInDays?: pulumi.Input<number>;
/**
* Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`.
*
* > **NOTE:** A new pricing model took effect on `2018-04-03`, which requires the SKU `PerGB2018`. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about [the Pricing SKUs is available at the following URI](https://aka.ms/PricingTierWarning).
*
* > **NOTE:** Changing `sku` forces a new Log Analytics Workspace to be created, except when changing between `PerGB2018` and `CapacityReservation`. However, changing `sku` to `CapacityReservation` or changing `reservationCapacityInGbPerDay` to a higher tier will lead to a 31-days commitment period, during which the SKU cannot be changed to a lower one. Please refer to [official documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/cost-logs#commitment-tiers) for further information.
*
* > **NOTE:** The `Free` SKU has a default `dailyQuotaGb` value of `0.5` (GB).
*/
sku?: pulumi.Input<string>;
/**
* A mapping of tags to assign to the resource.
*
* > **NOTE:** If a `azure.operationalinsights.AnalyticsWorkspace` is connected to a `azure.loganalytics.Cluster` via a `azure.loganalytics.LinkedService` you will not be able to modify the workspaces `sku` field until the link between the workspace and the cluster has been broken by deleting the `azure.loganalytics.LinkedService` resource. All other fields are modifiable while the workspace is linked to a cluster.
*/
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}