Skip to content

Commit

Permalink
hashicorp#24225: Support for azure_monitor_workspace_integrations att…
Browse files Browse the repository at this point in the history
…ribute
  • Loading branch information
harshavmb committed Dec 15, 2023
1 parent 5882349 commit 4f09173
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions internal/services/dashboard/dashboard_grafana_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,9 @@ func dataSourceDashboardGrafanaRead(d *pluginsdk.ResourceData, meta interface{})
d.Set("endpoint", properties.Endpoint)
}

// TO-DO
/*
if properties.GrafanaIntegrations != nil && properties.GrafanaIntegrations.AzureMonitorWorkspaceIntegrations != nil {
d.Set("azure_monitor_workspace_integrations", flattenAzureMonitorWorkspaceIntegrationModelArray(properties.GrafanaIntegrations.AzureMonitorWorkspaceIntegrations))
}
*/
if properties.GrafanaIntegrations != nil && properties.GrafanaIntegrations.AzureMonitorWorkspaceIntegrations != nil {
d.Set("azure_monitor_workspace_integrations", flattenAzureMonitorWorkspaceIntegrations(*properties.GrafanaIntegrations.AzureMonitorWorkspaceIntegrations))
}

if properties.GrafanaVersion != nil {
d.Set("grafana_version", properties.GrafanaVersion)
Expand Down Expand Up @@ -215,3 +212,18 @@ func dataSourceDashboardGrafanaRead(d *pluginsdk.ResourceData, meta interface{})

return nil
}

// AzureMonitorWorkspaceIntegration represents a struct for Azure Monitor Workspace Integration
type AzureMonitorWorkspaceIntegration struct {
AzureMonitorWorkspaceResourceId *string `json:"azureMonitorWorkspaceResourceId,omitempty"`
}

func flattenAzureMonitorWorkspaceIntegrations(integrations []grafanaresource.AzureMonitorWorkspaceIntegration) []interface{} {
result := make([]interface{}, len(integrations))
for i, integration := range integrations {
result[i] = map[string]interface{}{
"resource_id": integration.AzureMonitorWorkspaceResourceId,
}
}
return result
}
2 changes: 1 addition & 1 deletion website/docs/d/dashboard_grafana.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The following attributes are exported:

* `location` - Azure location where the resource exists.

* `api_key_enabled` - Whether tje api key setting of the Grafana instance is enabled.
* `api_key_enabled` - Whether the api key setting of the Grafana instance is enabled.

* `auto_generated_domain_name_label_scope` - Scope for dns deterministic name hash calculation.

Expand Down

0 comments on commit 4f09173

Please sign in to comment.