pulumi-azure-native icon indicating copy to clipboard operation
pulumi-azure-native copied to clipboard

Dashboard - Treat DashboardPartsArgs as untyped JSON.

Open ttvrdon opened this issue 1 year ago • 1 comments

The Dashboard parts schema is incomplete in the azure specs. It looks like the type field is supposed to be a discriminator on a union type, but only the MarkdownPart arm of the union is defined in the specs. (Additional discussion on this problem can be found in #3015.)

While we've filed an upstream issue, this seems like a type of resource where it maybe difficult for azure to keep a fully typed schema up to date. As noted in https://github.com/pulumi/pulumi-azure-native/issues/3015, the terraform provider for azure just exposes the dashboard parts as an untyped json blob.

We propose to add support for Dashboard Parts using a similar approach, by enhancing the generator to support marking a property or sub-property as JSON typed. (This would also address https://github.com/pulumi/pulumi-azure-native/issues/68.)


Original: Dashboard - DashboardPartsArgs doesn't contain properties needed for successful Parts creation

What happened?

What is happening:

I'd like to deploy Azure Dashboard with multiple Parts. For example this one (Server request rate MonitorChart): DashboardPart.json Such part must contain following Metadata properties:

{
  Inputs,
  Settings,
  Type
}

Inputs Pulumi type is InputList<object> which does not match expected structure (refer to attached DashboardPart.json)

Settings (MarkdownPartMetadataSettingsArgs) had completely different structure then needed.

Type has following comment:

    /// <summary>
    /// The type of dashboard part.
    /// Expected value is 'Extension/HubsExtension/PartType/MarkdownPart'.
    /// </summary>
    Input<string> Type { get;set; }= null!;

So it's not possible to deploy any complex DashboardPart using Pulumi.

Example

Please compare Pulumi DashboardPartsArgs class structure with structure retrieved from existing Azure Dashboard (DashboardPart.json)

Output of pulumi about

CLI Version 3.100.0 Go Version go1.21.5 Go Compiler gc

Plugins NAME VERSION azure-native 2.24.0 dotnet unknown random 4.15.0

Host OS Microsoft Windows 10 Pro Version 10.0.19045 Build 19045 Arch x86_64

This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='8.0.101'

Backend Name pulumi.com URL https://app.pulumi.com/ttvrdon User ttvrdon Organizations ttvrdon, resideo Token type personal

Dependencies: NAME VERSION Beacon.BuildSupport.MSBuild.Containers.RecordCreated 1.0.4 Beacon.BuildSupport.MSBuild.Pulumi.Publish 1.0.4 JetBrains.Annotations 2023.3.0 Pulumi 3.59.0 Pulumi.AzureNative 2.24.0 Pulumi.Random 4.15.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

ttvrdon avatar Jan 16 '24 15:01 ttvrdon

Thanks for filing this one @ttvrdon. I agree it's probably related to the root cause for #3015 in that these are both issues where we're missing the full type for some of these properties.

For this particular case, it looks like the type field is supposed to be a discriminator on a union type, but I'm having trouble finding type details for a Extension/HubsExtension/PartType/MonitorChartPart in the Azure API specs: https://github.com/search?q=repo%3AAzure%2Fazure-rest-api-specs+MonitorChartPart&type=code It looks like only the MarkdownPart arm of the union is defined in the specs which explains the comment you're seeing. I think we may need to file an upstream issue asking Azure to expand the specs to cover more DashboardPart variants.

mjeffryes avatar Jan 20 '24 00:01 mjeffryes

This issue has been addressed in PR #3123 and shipped in release v2.48.0.

pulumi-bot avatar Jul 02 '24 09:07 pulumi-bot