1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. monitoring
  5. MonitoredProject
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.monitoring.MonitoredProject

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    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",
    });
    const primary = new gcp.monitoring.MonitoredProject("primary", {
        metricsScope: "my-project-name",
        name: basic.projectId,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    basic = gcp.organizations.Project("basic",
        project_id="m-id",
        name="m-id-display",
        org_id="123456789")
    primary = gcp.monitoring.MonitoredProject("primary",
        metrics_scope="my-project-name",
        name=basic.project_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/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"),
    		})
    		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
    	})
    }
    
    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",
        });
    
        var primary = new Gcp.Monitoring.MonitoredProject("primary", new()
        {
            MetricsScope = "my-project-name",
            Name = basic.ProjectId,
        });
    
    });
    
    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")
                .build());
    
            var primary = new MonitoredProject("primary", MonitoredProjectArgs.builder()
                .metricsScope("my-project-name")
                .name(basic.projectId())
                .build());
    
        }
    }
    
    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'
    

    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 string
    The unique name of the resource.
    args MonitoredProjectArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args MonitoredProjectArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MonitoredProjectArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
    });
    
    example, err := monitoring.NewMonitoredProject(ctx, "monitoredProjectResource", &monitoring.MonitoredProjectArgs{
    	MetricsScope: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var monitoredProjectResource = new MonitoredProject("monitoredProjectResource", MonitoredProjectArgs.builder()
        .metricsScope("string")
        .name("string")
        .build());
    
    monitored_project_resource = gcp.monitoring.MonitoredProject("monitoredProjectResource",
        metrics_scope="string",
        name="string")
    
    const monitoredProjectResource = new gcp.monitoring.MonitoredProject("monitoredProjectResource", {
        metricsScope: "string",
        name: "string",
    });
    
    type: gcp:monitoring:MonitoredProject
    properties:
        metricsScope: string
        name: string
    

    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

    The MonitoredProject resource accepts the following input properties:

    MetricsScope 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 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 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 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 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 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 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 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 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 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 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 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 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 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 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 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 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 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 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 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 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 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 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 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}}
    
    $ pulumi import gcp:monitoring/monitoredProject:MonitoredProject default {{name}}
    

    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.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi