TraceScope class
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_78545",
name: "tf-test_48234",
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_78545",
name="tf-test_48234",
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]))
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_78545",
Name = "tf-test_48234",
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 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_78545"),
Name: pulumi.String("tf-test_48234"),
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
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
data "gcp_organizations_getproject" "project" {
}
resource "gcp_observability_tracescope" "observability_trace_scope" {
depends_on = [gcp_organizations_project.project-2]
trace_scope_id = "test-scope"
location = "global"
resource_names = ["projects/${data.gcp_organizations_getproject.project.project_id}", "projects/${gcp_organizations_project.project-2.project_id}"]
description = "A trace scope configured with Terraform"
}
resource "gcp_organizations_project" "project-2" {
project_id = "tf-test_78545"
name = "tf-test_48234"
org_id = "123456789"
deletion_policy = "DELETE"
}
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.ArrayList;
import java.util.Arrays;
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_78545")
.name("tf-test_48234")
.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_78545
name: tf-test_48234
orgId: '123456789'
deletionPolicy: DELETE
variables:
project:
fn::invoke:
function: gcp:organizations:getProject
arguments: {}
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}}
Constructors
- TraceScope(String name, {TraceScopeArgs? args, CustomResourceOptions? options})
-
Creates a new TraceScope.
nameThe Pulumi resource name.argsArguments used to configure this TraceScope. The set of arguments for TraceScope.optionsResource options controlling this resource's behavior. - TraceScope.reference(String urn)
- Creates a typed reference to an existing TraceScope resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createTime
↔ Output<
String> -
The creation timestamp of the trace scope.
latefinal
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
description
↔ Output<
String?> -
Describes this trace scope.
The maximum length of the description is 8000 characters.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
location
↔ Output<
String> -
GCP region the TraceScope is stored in. Only
globalis supported.latefinal -
name
↔ Output<
String> -
Identifier. The resource name of the trace scope.
For example:
projects/my-project/locations/global/traceScopes/my-trace-scope
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
resourceNames
↔ Output<
List< String> > -
Names of the projects that are included in this trace scope.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
traceScopeId
↔ Output<
String> -
A client-assigned identifier for the trace scope.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
updateTime
↔ Output<
String> -
The last update timestamp of the trace scope.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {TraceScopeState? state, CustomResourceOptions? options}) → TraceScope -
Gets an existing TraceScope resource's state with the given
nameandid.