1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. logging
  5. LogScope
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

gcp.logging.LogScope

Explore with Pulumi AI

Describes a group of resources to read log entries from

To get more information about LogScope, see:

Example Usage

Logging Log Scope Basic

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

const loggingLogScope = new gcp.logging.LogScope("logging_log_scope", {
    parent: "projects/my-project-name",
    location: "global",
    name: "projects/my-project-name/locations/global/logScopes/my-log-scope",
    resourceNames: [
        "projects/my-project-name",
        "projects/my-project-name/locations/global/buckets/_Default/views/view1",
        "projects/my-project-name/locations/global/buckets/_Default/views/view2",
    ],
    description: "A log scope configured with Terraform",
});
Copy
import pulumi
import pulumi_gcp as gcp

logging_log_scope = gcp.logging.LogScope("logging_log_scope",
    parent="projects/my-project-name",
    location="global",
    name="projects/my-project-name/locations/global/logScopes/my-log-scope",
    resource_names=[
        "projects/my-project-name",
        "projects/my-project-name/locations/global/buckets/_Default/views/view1",
        "projects/my-project-name/locations/global/buckets/_Default/views/view2",
    ],
    description="A log scope configured with Terraform")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := logging.NewLogScope(ctx, "logging_log_scope", &logging.LogScopeArgs{
			Parent:   pulumi.String("projects/my-project-name"),
			Location: pulumi.String("global"),
			Name:     pulumi.String("projects/my-project-name/locations/global/logScopes/my-log-scope"),
			ResourceNames: pulumi.StringArray{
				pulumi.String("projects/my-project-name"),
				pulumi.String("projects/my-project-name/locations/global/buckets/_Default/views/view1"),
				pulumi.String("projects/my-project-name/locations/global/buckets/_Default/views/view2"),
			},
			Description: pulumi.String("A log scope configured with Terraform"),
		})
		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 loggingLogScope = new Gcp.Logging.LogScope("logging_log_scope", new()
    {
        Parent = "projects/my-project-name",
        Location = "global",
        Name = "projects/my-project-name/locations/global/logScopes/my-log-scope",
        ResourceNames = new[]
        {
            "projects/my-project-name",
            "projects/my-project-name/locations/global/buckets/_Default/views/view1",
            "projects/my-project-name/locations/global/buckets/_Default/views/view2",
        },
        Description = "A log scope configured with Terraform",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.LogScope;
import com.pulumi.gcp.logging.LogScopeArgs;
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 loggingLogScope = new LogScope("loggingLogScope", LogScopeArgs.builder()
            .parent("projects/my-project-name")
            .location("global")
            .name("projects/my-project-name/locations/global/logScopes/my-log-scope")
            .resourceNames(            
                "projects/my-project-name",
                "projects/my-project-name/locations/global/buckets/_Default/views/view1",
                "projects/my-project-name/locations/global/buckets/_Default/views/view2")
            .description("A log scope configured with Terraform")
            .build());

    }
}
Copy
resources:
  loggingLogScope:
    type: gcp:logging:LogScope
    name: logging_log_scope
    properties:
      parent: projects/my-project-name
      location: global
      name: projects/my-project-name/locations/global/logScopes/my-log-scope
      resourceNames:
        - projects/my-project-name
        - projects/my-project-name/locations/global/buckets/_Default/views/view1
        - projects/my-project-name/locations/global/buckets/_Default/views/view2
      description: A log scope configured with Terraform
Copy

Create LogScope Resource

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

Constructor syntax

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

@overload
def LogScope(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             resource_names: Optional[Sequence[str]] = None,
             description: Optional[str] = None,
             location: Optional[str] = None,
             name: Optional[str] = None,
             parent: Optional[str] = None)
func NewLogScope(ctx *Context, name string, args LogScopeArgs, opts ...ResourceOption) (*LogScope, error)
public LogScope(string name, LogScopeArgs args, CustomResourceOptions? opts = null)
public LogScope(String name, LogScopeArgs args)
public LogScope(String name, LogScopeArgs args, CustomResourceOptions options)
type: gcp:logging:LogScope
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. LogScopeArgs
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. LogScopeArgs
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. LogScopeArgs
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. LogScopeArgs
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. LogScopeArgs
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 logScopeResource = new Gcp.Logging.LogScope("logScopeResource", new()
{
    ResourceNames = new[]
    {
        "string",
    },
    Description = "string",
    Location = "string",
    Name = "string",
    Parent = "string",
});
Copy
example, err := logging.NewLogScope(ctx, "logScopeResource", &logging.LogScopeArgs{
	ResourceNames: pulumi.StringArray{
		pulumi.String("string"),
	},
	Description: pulumi.String("string"),
	Location:    pulumi.String("string"),
	Name:        pulumi.String("string"),
	Parent:      pulumi.String("string"),
})
Copy
var logScopeResource = new LogScope("logScopeResource", LogScopeArgs.builder()
    .resourceNames("string")
    .description("string")
    .location("string")
    .name("string")
    .parent("string")
    .build());
Copy
log_scope_resource = gcp.logging.LogScope("logScopeResource",
    resource_names=["string"],
    description="string",
    location="string",
    name="string",
    parent="string")
Copy
const logScopeResource = new gcp.logging.LogScope("logScopeResource", {
    resourceNames: ["string"],
    description: "string",
    location: "string",
    name: "string",
    parent: "string",
});
Copy
type: gcp:logging:LogScope
properties:
    description: string
    location: string
    name: string
    parent: string
    resourceNames:
        - string
Copy

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

ResourceNames This property is required. List<string>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


Description string
Describes this log scopes.
Location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
Name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
Parent Changes to this property will trigger replacement. string
The parent of the resource.
ResourceNames This property is required. []string
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


Description string
Describes this log scopes.
Location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
Name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
Parent Changes to this property will trigger replacement. string
The parent of the resource.
resourceNames This property is required. List<String>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


description String
Describes this log scopes.
location Changes to this property will trigger replacement. String
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. String
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. String
The parent of the resource.
resourceNames This property is required. string[]
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


description string
Describes this log scopes.
location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. string
The parent of the resource.
resource_names This property is required. Sequence[str]
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


description str
Describes this log scopes.
location Changes to this property will trigger replacement. str
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. str
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. str
The parent of the resource.
resourceNames This property is required. List<String>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


description String
Describes this log scopes.
location Changes to this property will trigger replacement. String
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. String
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. String
The parent of the resource.

Outputs

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

CreateTime string
Output only. The creation timestamp of the log scopes.
Id string
The provider-assigned unique ID for this managed resource.
UpdateTime string
Output only. The last update timestamp of the log scopes.
CreateTime string
Output only. The creation timestamp of the log scopes.
Id string
The provider-assigned unique ID for this managed resource.
UpdateTime string
Output only. The last update timestamp of the log scopes.
createTime String
Output only. The creation timestamp of the log scopes.
id String
The provider-assigned unique ID for this managed resource.
updateTime String
Output only. The last update timestamp of the log scopes.
createTime string
Output only. The creation timestamp of the log scopes.
id string
The provider-assigned unique ID for this managed resource.
updateTime string
Output only. The last update timestamp of the log scopes.
create_time str
Output only. The creation timestamp of the log scopes.
id str
The provider-assigned unique ID for this managed resource.
update_time str
Output only. The last update timestamp of the log scopes.
createTime String
Output only. The creation timestamp of the log scopes.
id String
The provider-assigned unique ID for this managed resource.
updateTime String
Output only. The last update timestamp of the log scopes.

Look up Existing LogScope Resource

Get an existing LogScope 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?: LogScopeState, opts?: CustomResourceOptions): LogScope
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        parent: Optional[str] = None,
        resource_names: Optional[Sequence[str]] = None,
        update_time: Optional[str] = None) -> LogScope
func GetLogScope(ctx *Context, name string, id IDInput, state *LogScopeState, opts ...ResourceOption) (*LogScope, error)
public static LogScope Get(string name, Input<string> id, LogScopeState? state, CustomResourceOptions? opts = null)
public static LogScope get(String name, Output<String> id, LogScopeState state, CustomResourceOptions options)
resources:  _:    type: gcp:logging:LogScope    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 creation timestamp of the log scopes.
Description string
Describes this log scopes.
Location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
Name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
Parent Changes to this property will trigger replacement. string
The parent of the resource.
ResourceNames List<string>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


UpdateTime string
Output only. The last update timestamp of the log scopes.
CreateTime string
Output only. The creation timestamp of the log scopes.
Description string
Describes this log scopes.
Location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
Name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
Parent Changes to this property will trigger replacement. string
The parent of the resource.
ResourceNames []string
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


UpdateTime string
Output only. The last update timestamp of the log scopes.
createTime String
Output only. The creation timestamp of the log scopes.
description String
Describes this log scopes.
location Changes to this property will trigger replacement. String
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. String
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. String
The parent of the resource.
resourceNames List<String>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


updateTime String
Output only. The last update timestamp of the log scopes.
createTime string
Output only. The creation timestamp of the log scopes.
description string
Describes this log scopes.
location Changes to this property will trigger replacement. string
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. string
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. string
The parent of the resource.
resourceNames string[]
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


updateTime string
Output only. The last update timestamp of the log scopes.
create_time str
Output only. The creation timestamp of the log scopes.
description str
Describes this log scopes.
location Changes to this property will trigger replacement. str
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. str
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. str
The parent of the resource.
resource_names Sequence[str]
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


update_time str
Output only. The last update timestamp of the log scopes.
createTime String
Output only. The creation timestamp of the log scopes.
description String
Describes this log scopes.
location Changes to this property will trigger replacement. String
The location of the resource. The only supported location is global so far.
name Changes to this property will trigger replacement. String
The resource name of the log scope. For example: `projects/my-project/locations/global/logScopes/my-log-scope`
parent Changes to this property will trigger replacement. String
The parent of the resource.
resourceNames List<String>
Names of one or more parent resources : * `projects/[PROJECT_ID]` May alternatively be one or more views : * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` A log scope can include a maximum of 50 projects and a maximum of 100 resources in total.


updateTime String
Output only. The last update timestamp of the log scopes.

Import

LogScope can be imported using any of these accepted formats:

  • {{parent}}/locations/{{location}}/logScopes/{{name}}

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

$ pulumi import gcp:logging/logScope:LogScope default {{parent}}/locations/{{location}}/logScopes/{{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.