1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. monitoring
  5. MonitoredProject
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.monitoring.MonitoredProject

Explore with Pulumi AI

A project being monitored by a Metrics Scope.

To get more information about MonitoredProject, see:

Example Usage

Monitoring Monitored Project Basic

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

const basic = new gcp.organizations.Project("basic", {
    projectId: "m-id",
    name: "m-id-display",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const primary = new gcp.monitoring.MonitoredProject("primary", {
    metricsScope: "my-project-name",
    name: basic.projectId,
});
Copy
import pulumi
import pulumi_gcp as gcp

basic = gcp.organizations.Project("basic",
    project_id="m-id",
    name="m-id-display",
    org_id="123456789",
    deletion_policy="DELETE")
primary = gcp.monitoring.MonitoredProject("primary",
    metrics_scope="my-project-name",
    name=basic.project_id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("m-id"),
			Name:           pulumi.String("m-id-display"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		_, err = monitoring.NewMonitoredProject(ctx, "primary", &monitoring.MonitoredProjectArgs{
			MetricsScope: pulumi.String("my-project-name"),
			Name:         basic.ProjectId,
		})
		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 basic = new Gcp.Organizations.Project("basic", new()
    {
        ProjectId = "m-id",
        Name = "m-id-display",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var primary = new Gcp.Monitoring.MonitoredProject("primary", new()
    {
        MetricsScope = "my-project-name",
        Name = basic.ProjectId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.gcp.monitoring.MonitoredProject;
import com.pulumi.gcp.monitoring.MonitoredProjectArgs;
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 basic = new Project("basic", ProjectArgs.builder()
            .projectId("m-id")
            .name("m-id-display")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var primary = new MonitoredProject("primary", MonitoredProjectArgs.builder()
            .metricsScope("my-project-name")
            .name(basic.projectId())
            .build());

    }
}
Copy
resources:
  primary:
    type: gcp:monitoring:MonitoredProject
    properties:
      metricsScope: my-project-name
      name: ${basic.projectId}
  basic:
    type: gcp:organizations:Project
    properties:
      projectId: m-id
      name: m-id-display
      orgId: '123456789'
      deletionPolicy: DELETE
Copy

Create MonitoredProject Resource

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

Constructor syntax

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

@overload
def MonitoredProject(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     metrics_scope: Optional[str] = None,
                     name: Optional[str] = None)
func NewMonitoredProject(ctx *Context, name string, args MonitoredProjectArgs, opts ...ResourceOption) (*MonitoredProject, error)
public MonitoredProject(string name, MonitoredProjectArgs args, CustomResourceOptions? opts = null)
public MonitoredProject(String name, MonitoredProjectArgs args)
public MonitoredProject(String name, MonitoredProjectArgs args, CustomResourceOptions options)
type: gcp:monitoring:MonitoredProject
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. MonitoredProjectArgs
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. MonitoredProjectArgs
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. MonitoredProjectArgs
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. MonitoredProjectArgs
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. MonitoredProjectArgs
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 monitoredProjectResource = new Gcp.Monitoring.MonitoredProject("monitoredProjectResource", new()
{
    MetricsScope = "string",
    Name = "string",
});
Copy
example, err := monitoring.NewMonitoredProject(ctx, "monitoredProjectResource", &monitoring.MonitoredProjectArgs{
	MetricsScope: pulumi.String("string"),
	Name:         pulumi.String("string"),
})
Copy
var monitoredProjectResource = new MonitoredProject("monitoredProjectResource", MonitoredProjectArgs.builder()
    .metricsScope("string")
    .name("string")
    .build());
Copy
monitored_project_resource = gcp.monitoring.MonitoredProject("monitoredProjectResource",
    metrics_scope="string",
    name="string")
Copy
const monitoredProjectResource = new gcp.monitoring.MonitoredProject("monitoredProjectResource", {
    metricsScope: "string",
    name: "string",
});
Copy
type: gcp:monitoring:MonitoredProject
properties:
    metricsScope: string
    name: string
Copy

MonitoredProject 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 MonitoredProject resource accepts the following input properties:

MetricsScope
This property is required.
Changes to this property will trigger replacement.
string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


Name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
MetricsScope
This property is required.
Changes to this property will trigger replacement.
string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


Name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
metricsScope
This property is required.
Changes to this property will trigger replacement.
String
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. String
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
metricsScope
This property is required.
Changes to this property will trigger replacement.
string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
metrics_scope
This property is required.
Changes to this property will trigger replacement.
str
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. str
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
metricsScope
This property is required.
Changes to this property will trigger replacement.
String
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. String
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}

Outputs

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

CreateTime string
Output only. The time when this MonitoredProject was created.
Id string
The provider-assigned unique ID for this managed resource.
CreateTime string
Output only. The time when this MonitoredProject was created.
Id string
The provider-assigned unique ID for this managed resource.
createTime String
Output only. The time when this MonitoredProject was created.
id String
The provider-assigned unique ID for this managed resource.
createTime string
Output only. The time when this MonitoredProject was created.
id string
The provider-assigned unique ID for this managed resource.
create_time str
Output only. The time when this MonitoredProject was created.
id str
The provider-assigned unique ID for this managed resource.
createTime String
Output only. The time when this MonitoredProject was created.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing MonitoredProject Resource

Get an existing MonitoredProject 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?: MonitoredProjectState, opts?: CustomResourceOptions): MonitoredProject
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        metrics_scope: Optional[str] = None,
        name: Optional[str] = None) -> MonitoredProject
func GetMonitoredProject(ctx *Context, name string, id IDInput, state *MonitoredProjectState, opts ...ResourceOption) (*MonitoredProject, error)
public static MonitoredProject Get(string name, Input<string> id, MonitoredProjectState? state, CustomResourceOptions? opts = null)
public static MonitoredProject get(String name, Output<String> id, MonitoredProjectState state, CustomResourceOptions options)
resources:  _:    type: gcp:monitoring:MonitoredProject    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:
CreateTime string
Output only. The time when this MonitoredProject was created.
MetricsScope Changes to this property will trigger replacement. string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


Name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
CreateTime string
Output only. The time when this MonitoredProject was created.
MetricsScope Changes to this property will trigger replacement. string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


Name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
createTime String
Output only. The time when this MonitoredProject was created.
metricsScope Changes to this property will trigger replacement. String
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. String
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
createTime string
Output only. The time when this MonitoredProject was created.
metricsScope Changes to this property will trigger replacement. string
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. string
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
create_time str
Output only. The time when this MonitoredProject was created.
metrics_scope Changes to this property will trigger replacement. str
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. str
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
createTime String
Output only. The time when this MonitoredProject was created.
metricsScope Changes to this property will trigger replacement. String
Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}


name Changes to this property will trigger replacement. String
Immutable. The resource name of the MonitoredProject. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}

Import

MonitoredProject can be imported using any of these accepted formats:

  • v1/locations/global/metricsScopes/{{name}}

  • {{name}}

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

$ pulumi import gcp:monitoring/monitoredProject:MonitoredProject default v1/locations/global/metricsScopes/{{name}}
Copy
$ pulumi import gcp:monitoring/monitoredProject:MonitoredProject default {{name}}
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.