1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. monitoring
  5. Dashboard
Google Cloud v8.25.1 published on Wednesday, Apr 9, 2025 by Pulumi

gcp.monitoring.Dashboard

Explore with Pulumi AI

A Google Stackdriver dashboard. Dashboards define the content and layout of pages in the Stackdriver web application.

To get more information about Dashboards, see:

Example Usage

Monitoring Dashboard Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
  "displayName": "Demo Dashboard",
  "gridLayout": {
    "widgets": [
      {
        "blank": {}
      }
    ]
  }
}

`});
Copy
import pulumi
import pulumi_gcp as gcp

dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
  "displayName": "Demo Dashboard",
  "gridLayout": {
    "widgets": [
      {
        "blank": {}
      }
    ]
  }
}

""")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
			DashboardJson: pulumi.String(`{
  "displayName": "Demo Dashboard",
  "gridLayout": {
    "widgets": [
      {
        "blank": {}
      }
    ]
  }
}

`),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
    {
        DashboardJson = @"{
  ""displayName"": ""Demo Dashboard"",
  ""gridLayout"": {
    ""widgets"": [
      {
        ""blank"": {}
      }
    ]
  }
}

",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.Dashboard;
import com.pulumi.gcp.monitoring.DashboardArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
            .dashboardJson("""
{
  "displayName": "Demo Dashboard",
  "gridLayout": {
    "widgets": [
      {
        "blank": {}
      }
    ]
  }
}

            """)
            .build());

    }
}
Copy
resources:
  dashboard:
    type: gcp:monitoring:Dashboard
    properties:
      dashboardJson: |+
        {
          "displayName": "Demo Dashboard",
          "gridLayout": {
            "widgets": [
              {
                "blank": {}
              }
            ]
          }
        }        
Copy

Monitoring Dashboard GridLayout

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
  "displayName": "Grid Layout Example",
  "gridLayout": {
    "columns": "2",
    "widgets": [
      {
        "title": "Widget 1",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "LINE"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      },
      {
        "text": {
          "content": "Widget 2",
          "format": "MARKDOWN"
        }
      },
      {
        "title": "Widget 3",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "STACKED_BAR"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      }
    ]
  }
}

`});
Copy
import pulumi
import pulumi_gcp as gcp

dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
  "displayName": "Grid Layout Example",
  "gridLayout": {
    "columns": "2",
    "widgets": [
      {
        "title": "Widget 1",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "LINE"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      },
      {
        "text": {
          "content": "Widget 2",
          "format": "MARKDOWN"
        }
      },
      {
        "title": "Widget 3",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "STACKED_BAR"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      }
    ]
  }
}

""")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
			DashboardJson: pulumi.String(`{
  "displayName": "Grid Layout Example",
  "gridLayout": {
    "columns": "2",
    "widgets": [
      {
        "title": "Widget 1",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "LINE"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      },
      {
        "text": {
          "content": "Widget 2",
          "format": "MARKDOWN"
        }
      },
      {
        "title": "Widget 3",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "STACKED_BAR"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      }
    ]
  }
}

`),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
    {
        DashboardJson = @"{
  ""displayName"": ""Grid Layout Example"",
  ""gridLayout"": {
    ""columns"": ""2"",
    ""widgets"": [
      {
        ""title"": ""Widget 1"",
        ""xyChart"": {
          ""dataSets"": [{
            ""timeSeriesQuery"": {
              ""timeSeriesFilter"": {
                ""filter"": ""metric.type=\""agent.googleapis.com/nginx/connections/accepted_count\"""",
                ""aggregation"": {
                  ""perSeriesAligner"": ""ALIGN_RATE""
                }
              },
              ""unitOverride"": ""1""
            },
            ""plotType"": ""LINE""
          }],
          ""timeshiftDuration"": ""0s"",
          ""yAxis"": {
            ""label"": ""y1Axis"",
            ""scale"": ""LINEAR""
          }
        }
      },
      {
        ""text"": {
          ""content"": ""Widget 2"",
          ""format"": ""MARKDOWN""
        }
      },
      {
        ""title"": ""Widget 3"",
        ""xyChart"": {
          ""dataSets"": [{
            ""timeSeriesQuery"": {
              ""timeSeriesFilter"": {
                ""filter"": ""metric.type=\""agent.googleapis.com/nginx/connections/accepted_count\"""",
                ""aggregation"": {
                  ""perSeriesAligner"": ""ALIGN_RATE""
                }
              },
              ""unitOverride"": ""1""
            },
            ""plotType"": ""STACKED_BAR""
          }],
          ""timeshiftDuration"": ""0s"",
          ""yAxis"": {
            ""label"": ""y1Axis"",
            ""scale"": ""LINEAR""
          }
        }
      }
    ]
  }
}

",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.Dashboard;
import com.pulumi.gcp.monitoring.DashboardArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
            .dashboardJson("""
{
  "displayName": "Grid Layout Example",
  "gridLayout": {
    "columns": "2",
    "widgets": [
      {
        "title": "Widget 1",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "LINE"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      },
      {
        "text": {
          "content": "Widget 2",
          "format": "MARKDOWN"
        }
      },
      {
        "title": "Widget 3",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "STACKED_BAR"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      }
    ]
  }
}

            """)
            .build());

    }
}
Copy
resources:
  dashboard:
    type: gcp:monitoring:Dashboard
    properties:
      dashboardJson: |+
        {
          "displayName": "Grid Layout Example",
          "gridLayout": {
            "columns": "2",
            "widgets": [
              {
                "title": "Widget 1",
                "xyChart": {
                  "dataSets": [{
                    "timeSeriesQuery": {
                      "timeSeriesFilter": {
                        "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                        "aggregation": {
                          "perSeriesAligner": "ALIGN_RATE"
                        }
                      },
                      "unitOverride": "1"
                    },
                    "plotType": "LINE"
                  }],
                  "timeshiftDuration": "0s",
                  "yAxis": {
                    "label": "y1Axis",
                    "scale": "LINEAR"
                  }
                }
              },
              {
                "text": {
                  "content": "Widget 2",
                  "format": "MARKDOWN"
                }
              },
              {
                "title": "Widget 3",
                "xyChart": {
                  "dataSets": [{
                    "timeSeriesQuery": {
                      "timeSeriesFilter": {
                        "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                        "aggregation": {
                          "perSeriesAligner": "ALIGN_RATE"
                        }
                      },
                      "unitOverride": "1"
                    },
                    "plotType": "STACKED_BAR"
                  }],
                  "timeshiftDuration": "0s",
                  "yAxis": {
                    "label": "y1Axis",
                    "scale": "LINEAR"
                  }
                }
              }
            ]
          }
        }        
Copy

Create Dashboard Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Dashboard(name: string, args: DashboardArgs, opts?: CustomResourceOptions);
@overload
def Dashboard(resource_name: str,
              args: DashboardArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def Dashboard(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              dashboard_json: Optional[str] = None,
              project: Optional[str] = None)
func NewDashboard(ctx *Context, name string, args DashboardArgs, opts ...ResourceOption) (*Dashboard, error)
public Dashboard(string name, DashboardArgs args, CustomResourceOptions? opts = null)
public Dashboard(String name, DashboardArgs args)
public Dashboard(String name, DashboardArgs args, CustomResourceOptions options)
type: gcp:monitoring:Dashboard
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. DashboardArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. DashboardArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. DashboardArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DashboardArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. DashboardArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var dashboardResource = new Gcp.Monitoring.Dashboard("dashboardResource", new()
{
    DashboardJson = "string",
    Project = "string",
});
Copy
example, err := monitoring.NewDashboard(ctx, "dashboardResource", &monitoring.DashboardArgs{
	DashboardJson: pulumi.String("string"),
	Project:       pulumi.String("string"),
})
Copy
var dashboardResource = new Dashboard("dashboardResource", DashboardArgs.builder()
    .dashboardJson("string")
    .project("string")
    .build());
Copy
dashboard_resource = gcp.monitoring.Dashboard("dashboardResource",
    dashboard_json="string",
    project="string")
Copy
const dashboardResource = new gcp.monitoring.Dashboard("dashboardResource", {
    dashboardJson: "string",
    project: "string",
});
Copy
type: gcp:monitoring:Dashboard
properties:
    dashboardJson: string
    project: string
Copy

Dashboard Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Dashboard resource accepts the following input properties:

DashboardJson This property is required. string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
DashboardJson This property is required. string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson This property is required. String
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson This property is required. string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboard_json This property is required. str
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson This property is required. String
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the Dashboard resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Dashboard Resource

Get an existing Dashboard resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DashboardState, opts?: CustomResourceOptions): Dashboard
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dashboard_json: Optional[str] = None,
        project: Optional[str] = None) -> Dashboard
func GetDashboard(ctx *Context, name string, id IDInput, state *DashboardState, opts ...ResourceOption) (*Dashboard, error)
public static Dashboard Get(string name, Input<string> id, DashboardState? state, CustomResourceOptions? opts = null)
public static Dashboard get(String name, Output<String> id, DashboardState state, CustomResourceOptions options)
resources:  _:    type: gcp:monitoring:Dashboard    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DashboardJson string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
DashboardJson string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson String
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson string
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboard_json str
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
dashboardJson String
The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Import

Dashboard can be imported using any of these accepted formats:

  • projects/{{project}}/dashboards/{{dashboard_id}}

  • {{dashboard_id}}

When using the pulumi import command, Dashboard can be imported using one of the formats above. For example:

$ pulumi import gcp:monitoring/dashboard:Dashboard default projects/{{project}}/dashboards/{{dashboard_id}}
Copy
$ pulumi import gcp:monitoring/dashboard:Dashboard default {{dashboard_id}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.