Skip to content
betterstack-alchemyUnofficial

Telemetry.SourceGcpProject

Kind ResourceType id BetterStack.Telemetry.SourceGcpProjectSource src/Telemetry/SourceGcpProject.tsOffline only Tested against the offline mock only: the lifecycle runs against the offline mock only (test/Telemetry/SourceGcpProject.test.ts).

The GCP project connected to a gcp Source, through Workload Identity Federation from the Better Stack GCP module (gcpProjectId + gcpProjectNumber), or by reusing a project another gcp source connected (gcpAccountId, Better Stack’s own id). Exactly one of gcpProjectId and gcpAccountId; gcpProjectId goes with gcpProjectNumber.

There is no create or delete: the resource takes over the source named by sourceId and applies these settings to it. Destroying it only forgets it; nothing changes in Better Stack. The project id, number and account id are never returned, so changes are detected against the previous deploy’s props.

gcpLogFilter must be set in a later request than the one that connects the project, so it is sent by its own update after the connection. Send null to forward every log again (removing it from the config leaves the filter as it is).

A project with a log filter

const gcp = yield* BetterStack.Telemetry.Source("gcp", { platform: "gcp" });
yield* BetterStack.Telemetry.SourceGcpProject("gcp-project", {
sourceId: gcp.id,
gcpProjectId: "my-project",
gcpProjectNumber: "123456789012",
gcpLogFilter: 'severity >= "WARNING"',
});

Read the GCP project connection of a source by its id

const existing = BetterStack.Telemetry.SourceGcpProject.lookup({ sourceId: "123456" });

sourceId string required

The gcp source to connect the project to. Changing it manages another source.

gcpAccountId string

Better Stack's own ID for a Google Cloud project that another gcp source in your organization connected, to reuse that connection. Better Stack's ID differs from the project's ID and number. Only for the gcp platform.

gcpLogFilter string | null

Google Cloud Logging query that selects which logs the source receives. null forwards every log, which is the default. Google Cloud checks the query when it's saved and refuses an invalid one. Only for the gcp platform. Set it once the source's GCP project is connected, in a later request than the one that connects it.

gcpProjectId string

ID of the GCP project to connect. Only for the gcp platform.

gcpProjectNumber string

Number of the GCP project to connect. Only for the gcp platform.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

sourceId string always set

The gcp source the project is connected to.

gcpAccountId string

Better Stack's id of the reused project connection, when the props named one. Never returned by the API.

gcpLogFilter string | null

The Google Cloud Logging query that selects which logs the source receives, null for every log.

gcpProjectId string

The connected project's id, as the props named it. Never returned by the API.

platform string

The source's platform (gcp).

teamId string

Team that owns the source, such as t123.

SourceGcpProject.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

sourceId string required

The gcp source's id.

teamId string

Team that owns the source, such as t123. Defaults to the credentials' team.