import * as pulumi from "@pulumi/pulumi"; /** * Manages a shared dashboard in the Azure Portal. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const config = new pulumi.Config(); * // Content for the MD tile * const mdContent = config.get("mdContent") || "# Hello all :)"; * // Link to a video * const videoLink = config.get("videoLink") || "https://www.youtube.com/watch?v=......"; * const current = azure.core.getSubscription({}); * const example = new azure.core.ResourceGroup("example", { * name: "mygroup", * location: "West Europe", * }); * const my_board = new azure.portal.PortalDashboard("my-board", { * name: "my-cool-dashboard", * resourceGroupName: example.name, * location: example.location, * tags: { * source: "terraform", * }, * dashboardProperties: current.then(current => `{ * \"lenses\": { * \"0\": { * \"order\": 0, * \"parts\": { * \"0\": { * \"position\": { * \"x\": 0, * \"y\": 0, * \"rowSpan\": 2, * \"colSpan\": 3 * }, * \"metadata\": { * \"inputs\": [], * \"type\": \"Extension/HubsExtension/PartType/MarkdownPart\", * \"settings\": { * \"content\": { * \"settings\": { * \"content\": \"${mdContent}\", * \"subtitle\": \"\", * \"title\": \"\" * } * } * } * } * }, * \"1\": { * \"position\": { * \"x\": 5, * \"y\": 0, * \"rowSpan\": 4, * \"colSpan\": 6 * }, * \"metadata\": { * \"inputs\": [], * \"type\": \"Extension/HubsExtension/PartType/VideoPart\", * \"settings\": { * \"content\": { * \"settings\": { * \"title\": \"Important Information\", * \"subtitle\": \"\", * \"src\": \"${videoLink}\", * \"autoplay\": true * } * } * } * } * }, * \"2\": { * \"position\": { * \"x\": 0, * \"y\": 4, * \"rowSpan\": 4, * \"colSpan\": 6 * }, * \"metadata\": { * \"inputs\": [ * { * \"name\": \"ComponentId\", * \"value\": \"/subscriptions/${current.subscriptionId}/resourceGroups/myRG/providers/microsoft.insights/components/myWebApp\" * } * ], * \"type\": \"Extension/AppInsightsExtension/PartType/AppMapGalPt\", * \"settings\": {}, * \"asset\": { * \"idInputName\": \"ComponentId\", * \"type\": \"ApplicationInsights\" * } * } * } * } * } * }, * \"metadata\": { * \"model\": { * \"timeRange\": { * \"value\": { * \"relative\": { * \"duration\": 24, * \"timeUnit\": 1 * } * }, * \"type\": \"MsPortalFx.Composition.Configuration.ValueTypes.TimeRange\" * }, * \"filterLocale\": { * \"value\": \"en-us\" * }, * \"filters\": { * \"value\": { * \"MsPortalFx_TimeRange\": { * \"model\": { * \"format\": \"utc\", * \"granularity\": \"auto\", * \"relative\": \"24h\" * }, * \"displayCache\": { * \"name\": \"UTC Time\", * \"value\": \"Past 24 hours\" * }, * \"filteredPartIds\": [ * \"StartboardPart-UnboundPart-ae44fef5-76b8-46b0-86f0-2b3f47bad1c7\" * ] * } * } * } * } * } * } * `), * }); * ``` * * It is recommended to follow the steps outlined * [here](https://docs.microsoft.com/azure/azure-portal/azure-portal-dashboards-create-programmatically#fetch-the-json-representation-of-the-dashboard) to create a Dashboard in the Portal and extract the relevant JSON to use in this resource. From the extracted JSON, the contents of the `properties: {}` object can used. Variables can be injected as needed - see above example. * * ### Using a `templateFile` data source or the `templatefile` function * * Since the contents of the dashboard JSON can be quite lengthy, use a template file to improve readability: * * `dash.tpl`: * * This is then referenced in the `.tf` file by using a `templateFile` data source (terraform 0.11 or earlier), or the `templatefile` function (terraform 0.12+). * * `main.tf` (terraform 0.11 or earlier): * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azurerm from "@pulumi/azurerm"; * * function notImplemented(message: string) { * throw new Error(message); * } * * const dash_template = notImplemented("The template_file data resource is not yet supported."); * //... * const my_board = new azurerm.index.Dashboard("my-board", { * name: "my-cool-dashboard", * resourceGroupName: example.name, * location: example.location, * tags: { * source: "terraform", * }, * dashboardProperties: dash_template.rendered, * }); * ``` * * `main.tf` (terraform 0.12+) * * ## Import * * Dashboards can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:portal/portalDashboard:PortalDashboard my-board /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Portal/dashboards/00000000-0000-0000-0000-000000000000 * ``` * * Note the URI in the above sample can be found using the Resource Explorer tool in the Azure Portal. */ export declare class PortalDashboard extends pulumi.CustomResource { /** * Get an existing PortalDashboard 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?: PortalDashboardState, opts?: pulumi.CustomResourceOptions): PortalDashboard; /** * Returns true if the given object is an instance of PortalDashboard. 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 PortalDashboard; /** * JSON data representing dashboard body. See above for details on how to obtain this from the Portal. */ readonly dashboardProperties: pulumi.Output; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * Specifies the name of the Shared Dashboard. Changing this forces a new resource to be created. * * > **Note:** You can specify a tag with the key `hidden-title` to set a more user-friendly title for this Dashboard. */ readonly name: pulumi.Output; /** * The name of the resource group in which to create the dashboard. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * A mapping of tags to assign to the resource. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Create a PortalDashboard 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: PortalDashboardArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PortalDashboard resources. */ export interface PortalDashboardState { /** * JSON data representing dashboard body. See above for details on how to obtain this from the Portal. */ dashboardProperties?: pulumi.Input; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Specifies the name of the Shared Dashboard. Changing this forces a new resource to be created. * * > **Note:** You can specify a tag with the key `hidden-title` to set a more user-friendly title for this Dashboard. */ name?: pulumi.Input; /** * The name of the resource group in which to create the dashboard. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; } /** * The set of arguments for constructing a PortalDashboard resource. */ export interface PortalDashboardArgs { /** * JSON data representing dashboard body. See above for details on how to obtain this from the Portal. */ dashboardProperties: pulumi.Input; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Specifies the name of the Shared Dashboard. Changing this forces a new resource to be created. * * > **Note:** You can specify a tag with the key `hidden-title` to set a more user-friendly title for this Dashboard. */ name?: pulumi.Input; /** * The name of the resource group in which to create the dashboard. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; }