Repository navigation
Publish Package Metadata betterstack@v1.5.10 - #13759
Merged
Merged
Conversation
pulumi-bot
enabled auto-merge (squash)
December 2, 2026 17:38
pulumi-bot
force-pushed
the
betterstack/publish-metadata
branch
from
December 3, 2026 05:44
7818acd to
11279b3
Compare
Contributor
✅
|
| check | command | |
|---|---|---|
| docs generate | ✅ | resourcedocsgen metadata from-urls |
| publisher listed | ✅ | Better Stack is a key in publisher-names.json |
Owner Better Stack
Doc-lint ✅ clean. No relative images or raw HTML.
Provider docs (source as published):
_index.md · 340 lines · open full file
---
# WARNING: this file was fetched from https://raw.githubusercontent.com/BetterStackHQ/pulumi-betterstack/v1.5.10/docs/_index.md
# Do not edit by hand unless you're certain you know what you are doing!
edit_url: https://github.com/BetterStackHQ/pulumi-betterstack/blob/v1.5.10/docs/_index.md
title: Better Stack
meta_desc: Provides an overview of the Better Stack provider for Pulumi.
layout: package
---
The Better Stack provider manages [Better Stack](https://betterstack.com) resources with Pulumi. One provider and one global API token cover uptime monitors, heartbeats, on-call calendars and escalation policies, status pages, log and metric sources, collectors, dashboards, error tracking, and Cloud's servers, networking, storage, managed services and Kubernetes.
## Installation
The provider is available as a package in these languages:
<!-- generated:install -->
* JavaScript/TypeScript: [`@better_stack/pulumi`](https://www.npmjs.com/package/@better_stack/pulumi)
* Python: [`pulumi_betterstack`](https://pypi.org/project/pulumi-betterstack/)
* Go: [`github.com/betterstackhq/pulumi-betterstack/sdk/go/betterstack`](https://pkg.go.dev/github.com/betterstackhq/pulumi-betterstack/sdk/go/betterstack)
* .NET: [`BetterStack.Pulumi`](https://www.nuget.org/packages/BetterStack.Pulumi)
* Java: [`com.betterstack:pulumi`](https://central.sonatype.com/artifact/com.betterstack/pulumi), package `com.betterstack.pulumi`
<!-- /generated:install -->
Pulumi downloads the provider plugin from the [GitHub releases](https://github.com/BetterStackHQ/pulumi-betterstack/releases) on the first `pulumi up`.
## Example Usage
{{< chooser language "typescript,python,go,csharp,java,yaml" >}}
{{% choosable language typescript %}}
```typescript
import * as betterstack from "@better_stack/pulumi";
const website = new betterstack.Monitor("website", {
monitorType: "status",
url: "https://example.com",
});
export const monitorId = website.id;
```
{{% /choosable %}}
{{% choosable language python %}}
```python
import pulumi
import pulumi_betterstack as betterstack
website = betterstack.Monitor("website",
monitor_type="status",
url="https://example.com")
pulumi.export("monitorId", website.id)
```
{{% /choosable %}}
{{% choosable language go %}}
```go
package main
import (
"github.com/betterstackhq/pulumi-betterstack/sdk/go/betterstack"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
website, err := betterstack.NewMonitor(ctx, "website", &betterstack.MonitorArgs{
MonitorType: pulumi.String("status"),
Url: pulumi.String("https://example.com"),
})
if err != nil {
return err
}
ctx.Export("monitorId", website.ID())
return nil
})
}
```
{{% /choosable %}}
{{% choosable language csharp %}}
```csharp
using System.Collections.Generic;
using Pulumi;
using BetterStack = Pulumi.BetterStack;
return await Deployment.RunAsync(() =>
{
var website = new BetterStack.Monitor("website", new()
{
MonitorType = "status",
Url = "https://example.com",
});
return new Dictionary<string, object?>
{
["monitorId"] = website.Id,
};
});
```
{{% /choosable %}}
{{% choosable language java %}}
```java
package myproject;
import com.pulumi.Pulumi;
import com.betterstack.pulumi.Monitor;
import com.betterstack.pulumi.MonitorArgs;
public class App {
public static void main(String[] args) {
Pulumi.run(ctx -> {
var website = new Monitor("website", MonitorArgs.builder()
.monitorType("status")
.url("https://example.com")
.build());
ctx.export("monitorId", website.id());
});
}
}
```
{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
name: betterstack-example
runtime: yaml
resources:
website:
type: betterstack:index/monitor:Monitor
properties:
monitorType: status
url: https://example.com
outputs:
monitorId: ${website.id}
```
{{% /choosable %}}
{{< /chooser >}}
Monitors, heartbeats, sources and some other resources start with deletion protection on, so `pulumi destroy` stops at them until you set the `deletionProtection` input to `false` and run `pulumi up`. Go and C# name it `DeletionProtection`, and Python `deletion_protection`.
### Cloud
The provider creates Cloud resources in the zone set in `betterstack:availabilityZone`:
```bash
pulumi config set betterstack:availabilityZone us-west-2a
```
A Cloud resource needs its own `teamId`, even when `betterstack:teamId` is set. This firewall allows SSH and HTTPS from anywhere. Pass `web.id` in a server's `firewallIds` to attach it:
{{< chooser language "typescript,python,yaml" >}}
{{% choosable language typescript %}}
```typescript
import * as betterstack from "@better_stack/pulumi";
const web = new betterstack.Firewall("web", { teamId: "t123", name: "web" });
for (const [name, port] of [["ssh", 22], ["https", 443]] as const) {
new betterstack.FirewallRule(name, {
firewallId: web.id,
direction: "inbound",
protocol: "tcp",
ipAddresses: ["0.0.0.0/0", "::/0"],
portFrom: port,
});
}
```
{{% /choosable %}}
{{% choosable language python %}}
```python
import pulumi_betterstack as betterstack
web = betterstack.Firewall("web", team_id="t123", name="web")
for name, port in [("ssh", 22), ("https", 443)]:
betterstack.FirewallRule(name,
firewall_id=web.id,
direction="inbound",
protocol="tcp",
ip_addresses=["0.0.0.0/0", "::/0"],
port_from=port)
```
{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
resources:
web:
type: betterstack:index/firewall:Firewall
properties:
teamId: t123
name: web
ssh:
type: betterstack:index/firewallRule:FirewallRule
properties:
firewallId: ${web.id}
direction: inbound
protocol: tcp
ipAddresses: ["0.0.0.0/0", "::/0"]
portFrom: 22
https:
type: betterstack:index/firewallRule:FirewallRule
properties:
firewallId: ${web.id}
direction: inbound
protocol: tcp
ipAddresses: ["0.0.0.0/0", "::/0"]
portFrom: 443
```
{{% /choosable %}}
{{< /chooser >}}
## Configuration
The provider needs a Better Stack API token. Use a global API token from [Better Stack → API tokens → Global tokens](https://betterstack.com/settings/global-api-tokens), or a team API token from [Better Stack → API tokens → Team-based tokens](https://betterstack.com/settings/api-tokens/0). Store it as a secret.
```bash
pulumi config set --secret betterstack:apiToken <your token>
```
Or set the `BETTERSTACK_API_TOKEN` environment variable, which the provider reads when `betterstack:apiToken` isn't set.
A team API token works only with the product it was created for. An Incidents API token works with uptime monitoring, on-call, status pages, team members and roles. A Telemetry API token works with sources, collectors, dashboards, metrics and error tracking. A Cloud API token works with Cloud's servers, networking, storage, managed services and Kubernetes. Teams and ClickHouse connections need a global API token. With another product's resources, a team API token is refused with `401 Invalid Team API token`, though the token itself is valid. To manage more than one product with team API tokens, create one explicit provider per product as under [Several teams](#several-teams), and pass each resource the provider of its product.
<!-- generated:config -->
| Setting | Description |
|---|---|
| `betterstack:apiToken` | Better Stack API token. Falls back to the BETTERSTACK_API_TOKEN environment variable. Secret. |
| `betterstack:teamId` | Selects the team when the API token can reach several. |
| `betterstack:apiRateBurst` | How many requests may go out at once above the rate. Defaults to twice the rate, at least 10, when set to 0. |
| `betterstack:apiRateLimit` | The most requests per second. Defaults to 8, and 0 turns the limit off. |
| `betterstack:apiRetryMax` | How many times a failed request is retried. Defaults to 4. |
| `betterstack:apiRetryWaitMax` | The longest wait before a retry, in seconds, also when Better Stack asks to wait longer. Defaults to 300. |
| `betterstack:apiRetryWaitMin` | The shortest wait before a retry, in seconds. Defaults to 10. |
| `betterstack:apiTimeout` | How long one request may take, in seconds. Defaults to 60, and 0 turns the timeout off. |
| `betterstack:availabilityZone` | Use the zone your resources are in, such as us-west-2a. Each zone is separate. Falls back to the BETTERSTACK_AVAILABILITY_ZONE environment variable. |
<!-- /generated:config -->
## Several teams
The provider's `betterstack:teamId` is the team a resource is created in when the resource doesn't name one, written as the team's ID from Better Stack URLs, such as `t123`. To manage resources in several teams with one API token, set `teamId` on the resources that belong to another team. Changing a resource's `teamId` replaces it, because an object can't move to another team. Set `betterstack:teamId` when the API token can reach several teams, as a global API token can, or set `teamId` on every resource that accepts one.
```typescript
import * as betterstack from "@better_stack/pulumi";
// Created in the team betterstack:teamId selects.
new betterstack.Heartbeat("nightly-backup", {
name: "Nightly backup",
period: 86400,
grace: 3600,
});
new betterstack.Heartbeat("settlement-job", {
teamId: "t456",
name: "Settlement job",
period: 3600,
grace: 600,
});
```
To give each team its own token or settings, create one explicit provider per team and pass it in each resource's options:
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as betterstack from "@better_stack/pulumi";
const apiToken = new pulumi.Config("betterstack").requireSecret("apiToken");
const production = new betterstack.Provider("production", { apiToken, teamId: "t123" });
const staging = new betterstack.Provider("staging", { apiToken, teamId: "t456" });
new betterstack.Monitor("website", {
monitorType: "status",
url: "https://example.com",
}, { provider: production });
new betterstack.Monitor("website-staging", {
monitorType: "status",
url: "https://staging.example.com",
}, { provider: staging });
```
An explicit provider doesn't read the stack's `betterstack:` settings, so the example passes the token on. Without `apiToken`, it reads `BETTERSTACK_API_TOKEN`.
## Deletion protection and `protect`
<!-- generated:deletion-protection -->
Applications, ClickHouse instances, collectors, heartbeats, Kafka clusters, Kafka topics, Kubernetes clusters, monitors, MySQL instances, PostgreSQL databases, PostgreSQL instances, servers, sources, status pages, team members, teams, Valkey instances and volumes have a `deletionProtection` input, `true` by default.
<!-- /generated:deletion-protection -->
While it is on, the provider refuses any `pulumi up` or `pulumi destroy` that would delete the object or replace it, including one that changes a create-only input such as a source's `platform`. To delete or replace one, set `deletionProtection` to `false`, run `pulumi up`, then make the change. Go and C# name the input `DeletionProtection`, and Python `deletion_protection`.
`deletionProtection` exists only in the provider. The setting is kept in the stack's state, and Better Stack's API never sees it, so it doesn't stop a delete made in the web app or with another tool. Pulumi's own [`protect`](https://www.pulumi.com/docs/iac/concepts/options/protect/) resource option is separate. That option makes Pulumi refuse to delete any resource that has it, and is lifted with `pulumi state unprotect`. Use either or both.
To stop managing a protected object without deleting it in Better Stack, set the [`retainOnDelete`](https://www.pulumi.com/docs/iac/concepts/options/retainondelete/) option and remove it from the program, or run `pulumi state delete <urn>`.
## Changes made outside Pulumi
Pulumi doesn't read Better Stack before each update. A change made in the Better Stack web app, or with another tool, shows up only after a refresh:
```bash
pulumi refresh
```
or with `pulumi up --refresh`. Without it, `pulumi preview` compares your program with the last state Pulumi saved, not with what is live.
## Importing existing resources
Every resource can be imported by its Better Stack ID, for example:
```bash
pulumi import betterstack:index/monitor:Monitor website 123456
```
An object that belongs to another one, such as a dashboard chart, is imported by both IDs, like `<dashboard_id>/12345`. Each resource's page lists its import ID.
Checked PR head 9b0f3d9082dc · full run & command output
Contributor
|
Your site preview for commit 11279b3 is ready! 🎉 http://registry--origin-pr-13759-11279b32.s3-website.us-west-2.amazonaws.com/registry/ Changed pages: |
Contributor
|
Site previews for this pull request have been removed. ✨ |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.