gcp.observability.TraceScope
A trace scope is a collection of resources whose traces are queried together
Example Usage
Observability Trace Scope Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const project = gcp.organizations.getProject({});
const project_2 = new gcp.organizations.Project("project-2", {
projectId: "tf-test_30827",
name: "tf-test_6529",
orgId: "123456789",
deletionPolicy: "DELETE",
});
const observabilityTraceScope = new gcp.observability.TraceScope("observability_trace_scope", {
traceScopeId: "test-scope",
location: "global",
resourceNames: [
project.then(project => `projects/${project.projectId}`),
pulumi.interpolate`projects/${project_2.projectId}`,
],
description: "A trace scope configured with Terraform",
}, {
dependsOn: [project_2],
});
import pulumi
import pulumi_gcp as gcp
project = gcp.organizations.get_project()
project_2 = gcp.organizations.Project("project-2",
project_id="tf-test_30827",
name="tf-test_6529",
org_id="123456789",
deletion_policy="DELETE")
observability_trace_scope = gcp.observability.TraceScope("observability_trace_scope",
trace_scope_id="test-scope",
location="global",
resource_names=[
f"projects/{project.project_id}",
project_2.project_id.apply(lambda project_id: f"projects/{project_id}"),
],
description="A trace scope configured with Terraform",
opts = pulumi.ResourceOptions(depends_on=[project_2]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/observability"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
if err != nil {
return err
}
project_2, err := organizations.NewProject(ctx, "project-2", &organizations.ProjectArgs{
ProjectId: pulumi.String("tf-test_30827"),
Name: pulumi.String("tf-test_6529"),
OrgId: pulumi.String("123456789"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = observability.NewTraceScope(ctx, "observability_trace_scope", &observability.TraceScopeArgs{
TraceScopeId: pulumi.String("test-scope"),
Location: pulumi.String("global"),
ResourceNames: pulumi.StringArray{
pulumi.Sprintf("projects/%v", project.ProjectId),
project_2.ProjectId.ApplyT(func(projectId string) (string, error) {
return fmt.Sprintf("projects/%v", projectId), nil
}).(pulumi.StringOutput),
},
Description: pulumi.String("A trace scope configured with Terraform"),
}, pulumi.DependsOn([]pulumi.Resource{
project_2,
}))
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 project = Gcp.Organizations.GetProject.Invoke();
var project_2 = new Gcp.Organizations.Project("project-2", new()
{
ProjectId = "tf-test_30827",
Name = "tf-test_6529",
OrgId = "123456789",
DeletionPolicy = "DELETE",
});
var observabilityTraceScope = new Gcp.Observability.TraceScope("observability_trace_scope", new()
{
TraceScopeId = "test-scope",
Location = "global",
ResourceNames = new[]
{
$"projects/{project.Apply(getProjectResult => getProjectResult.ProjectId)}",
project_2.ProjectId.Apply(projectId => $"projects/{projectId}"),
},
Description = "A trace scope configured with Terraform",
}, new CustomResourceOptions
{
DependsOn =
{
project_2,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.gcp.observability.TraceScope;
import com.pulumi.gcp.observability.TraceScopeArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
.build());
var project_2 = new Project("project-2", ProjectArgs.builder()
.projectId("tf-test_30827")
.name("tf-test_6529")
.orgId("123456789")
.deletionPolicy("DELETE")
.build());
var observabilityTraceScope = new TraceScope("observabilityTraceScope", TraceScopeArgs.builder()
.traceScopeId("test-scope")
.location("global")
.resourceNames(
String.format("projects/%s", project.projectId()),
project_2.projectId().applyValue(_projectId -> String.format("projects/%s", _projectId)))
.description("A trace scope configured with Terraform")
.build(), CustomResourceOptions.builder()
.dependsOn(project_2)
.build());
}
}
resources:
observabilityTraceScope:
type: gcp:observability:TraceScope
name: observability_trace_scope
properties:
traceScopeId: test-scope
location: global
resourceNames:
- projects/${project.projectId}
- projects/${["project-2"].projectId}
description: A trace scope configured with Terraform
options:
dependsOn:
- ${["project-2"]}
project-2:
type: gcp:organizations:Project
properties:
projectId: tf-test_30827
name: tf-test_6529
orgId: '123456789'
deletionPolicy: DELETE
variables:
project:
fn::invoke:
function: gcp:organizations:getProject
arguments: {}
Create TraceScope Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TraceScope(name: string, args: TraceScopeArgs, opts?: CustomResourceOptions);@overload
def TraceScope(resource_name: str,
args: TraceScopeArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TraceScope(resource_name: str,
opts: Optional[ResourceOptions] = None,
location: Optional[str] = None,
resource_names: Optional[Sequence[str]] = None,
trace_scope_id: Optional[str] = None,
description: Optional[str] = None,
project: Optional[str] = None)func NewTraceScope(ctx *Context, name string, args TraceScopeArgs, opts ...ResourceOption) (*TraceScope, error)public TraceScope(string name, TraceScopeArgs args, CustomResourceOptions? opts = null)
public TraceScope(String name, TraceScopeArgs args)
public TraceScope(String name, TraceScopeArgs args, CustomResourceOptions options)
type: gcp:observability:TraceScope
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 TraceScopeArgs
- 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 TraceScopeArgs
- 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 TraceScopeArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TraceScopeArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TraceScopeArgs
- 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 traceScopeResource = new Gcp.Observability.TraceScope("traceScopeResource", new()
{
Location = "string",
ResourceNames = new[]
{
"string",
},
TraceScopeId = "string",
Description = "string",
Project = "string",
});
example, err := observability.NewTraceScope(ctx, "traceScopeResource", &observability.TraceScopeArgs{
Location: pulumi.String("string"),
ResourceNames: pulumi.StringArray{
pulumi.String("string"),
},
TraceScopeId: pulumi.String("string"),
Description: pulumi.String("string"),
Project: pulumi.String("string"),
})
var traceScopeResource = new TraceScope("traceScopeResource", TraceScopeArgs.builder()
.location("string")
.resourceNames("string")
.traceScopeId("string")
.description("string")
.project("string")
.build());
trace_scope_resource = gcp.observability.TraceScope("traceScopeResource",
location="string",
resource_names=["string"],
trace_scope_id="string",
description="string",
project="string")
const traceScopeResource = new gcp.observability.TraceScope("traceScopeResource", {
location: "string",
resourceNames: ["string"],
traceScopeId: "string",
description: "string",
project: "string",
});
type: gcp:observability:TraceScope
properties:
description: string
location: string
project: string
resourceNames:
- string
traceScopeId: string
TraceScope 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 TraceScope resource accepts the following input properties:
- Location string
- GCP region the TraceScope is stored in. Only
globalis supported. - Resource
Names List<string> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- Trace
Scope stringId - A client-assigned identifier for the trace scope.
- Description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Location string
- GCP region the TraceScope is stored in. Only
globalis supported. - Resource
Names []string - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- Trace
Scope stringId - A client-assigned identifier for the trace scope.
- Description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- location String
- GCP region the TraceScope is stored in. Only
globalis supported. - resource
Names List<String> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope StringId - A client-assigned identifier for the trace scope.
- description String
- Describes this trace scope. The maximum length of the description is 8000 characters.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- location string
- GCP region the TraceScope is stored in. Only
globalis supported. - resource
Names string[] - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope stringId - A client-assigned identifier for the trace scope.
- description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- location str
- GCP region the TraceScope is stored in. Only
globalis supported. - resource_
names Sequence[str] - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace_
scope_ strid - A client-assigned identifier for the trace scope.
- description str
- Describes this trace scope. The maximum length of the description is 8000 characters.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- location String
- GCP region the TraceScope is stored in. Only
globalis supported. - resource
Names List<String> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope StringId - A client-assigned identifier for the trace scope.
- description String
- Describes this trace scope. The maximum length of the description is 8000 characters.
- project 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 TraceScope resource produces the following output properties:
- Create
Time string - The creation timestamp of the trace scope.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- Update
Time string - The last update timestamp of the trace scope.
- Create
Time string - The creation timestamp of the trace scope.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- Update
Time string - The last update timestamp of the trace scope.
- create
Time String - The creation timestamp of the trace scope.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- update
Time String - The last update timestamp of the trace scope.
- create
Time string - The creation timestamp of the trace scope.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- update
Time string - The last update timestamp of the trace scope.
- create_
time str - The creation timestamp of the trace scope.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- update_
time str - The last update timestamp of the trace scope.
- create
Time String - The creation timestamp of the trace scope.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- update
Time String - The last update timestamp of the trace scope.
Look up Existing TraceScope Resource
Get an existing TraceScope 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?: TraceScopeState, opts?: CustomResourceOptions): TraceScope@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,
project: Optional[str] = None,
resource_names: Optional[Sequence[str]] = None,
trace_scope_id: Optional[str] = None,
update_time: Optional[str] = None) -> TraceScopefunc GetTraceScope(ctx *Context, name string, id IDInput, state *TraceScopeState, opts ...ResourceOption) (*TraceScope, error)public static TraceScope Get(string name, Input<string> id, TraceScopeState? state, CustomResourceOptions? opts = null)public static TraceScope get(String name, Output<String> id, TraceScopeState state, CustomResourceOptions options)resources: _: type: gcp:observability:TraceScope get: id: ${id}- 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.
- Create
Time string - The creation timestamp of the trace scope.
- Description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- Location string
- GCP region the TraceScope is stored in. Only
globalis supported. - Name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Resource
Names List<string> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- Trace
Scope stringId - A client-assigned identifier for the trace scope.
- Update
Time string - The last update timestamp of the trace scope.
- Create
Time string - The creation timestamp of the trace scope.
- Description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- Location string
- GCP region the TraceScope is stored in. Only
globalis supported. - Name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Resource
Names []string - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- Trace
Scope stringId - A client-assigned identifier for the trace scope.
- Update
Time string - The last update timestamp of the trace scope.
- create
Time String - The creation timestamp of the trace scope.
- description String
- Describes this trace scope. The maximum length of the description is 8000 characters.
- location String
- GCP region the TraceScope is stored in. Only
globalis supported. - name String
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- resource
Names List<String> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope StringId - A client-assigned identifier for the trace scope.
- update
Time String - The last update timestamp of the trace scope.
- create
Time string - The creation timestamp of the trace scope.
- description string
- Describes this trace scope. The maximum length of the description is 8000 characters.
- location string
- GCP region the TraceScope is stored in. Only
globalis supported. - name string
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- resource
Names string[] - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope stringId - A client-assigned identifier for the trace scope.
- update
Time string - The last update timestamp of the trace scope.
- create_
time str - The creation timestamp of the trace scope.
- description str
- Describes this trace scope. The maximum length of the description is 8000 characters.
- location str
- GCP region the TraceScope is stored in. Only
globalis supported. - name str
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- resource_
names Sequence[str] - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace_
scope_ strid - A client-assigned identifier for the trace scope.
- update_
time str - The last update timestamp of the trace scope.
- create
Time String - The creation timestamp of the trace scope.
- description String
- Describes this trace scope. The maximum length of the description is 8000 characters.
- location String
- GCP region the TraceScope is stored in. Only
globalis supported. - name String
- Identifier. The resource name of the trace scope. For example: projects/my-project/locations/global/traceScopes/my-trace-scope
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- resource
Names List<String> - Names of the projects that are included in this trace scope.
projects/[PROJECT_ID]A trace scope can include a maximum of 20 projects.
- trace
Scope StringId - A client-assigned identifier for the trace scope.
- update
Time String - The last update timestamp of the trace scope.
Import
TraceScope can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/traceScopes/{{trace_scope_id}}{{project}}/{{location}}/{{trace_scope_id}}{{location}}/{{trace_scope_id}}
When using the pulumi import command, TraceScope can be imported using one of the formats above. For example:
$ pulumi import gcp:observability/traceScope:TraceScope default projects/{{project}}/locations/{{location}}/traceScopes/{{trace_scope_id}}
$ pulumi import gcp:observability/traceScope:TraceScope default {{project}}/{{location}}/{{trace_scope_id}}
$ pulumi import gcp:observability/traceScope:TraceScope default {{location}}/{{trace_scope_id}}
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-betaTerraform Provider.
