Not sure which ID to use?
If you use an incorrect ID format, the provider will return an error message guiding you to the correct format. For example: Error: invalid alert ID format "12345", expected 'exploration_id/alert_id'.
Manage your Better Stack resources automatically with Terraform. Using Terraform allows you to define your monitoring and logging configurations as code, making it easy to version, reuse, and automate your setup.
The Better Stack Uptime provider for Terraform allows you to manage your Uptime resources, including monitors, heartbeats, integrations, on-call configuration, and status pages.
For detailed information on available resources and their configurations, please see the Uptime provider documentation.
The provider is built on top of the Uptime API and is open-source.
The Better Stack Telemetry provider for Terraform allows you to manage your Telemetry resources, including telemetry sources, metrics, dashboards, and alerts.
For more information, please see the Telemetry provider documentation.
The provider is built on top of the Telemetry API and is open-source.
If you have resources that were created through the Better Stack UI or API, you can bring them under Terraform management using the terraform import command. This allows you to manage your existing infrastructure as code without having to recreate it.
The process involves two main steps: importing the resource into your Terraform state and then writing the corresponding configuration code.
First, define an empty resource block in your Terraform configuration file (e.g., main.tf). This tells Terraform where to import the state.
Next, run the terraform import command, providing the resource address and the resource ID from Better Stack.
Most resources use a simple numeric ID, which you can find in the URL in the Better Stack UI. Some nested resources use a composite ID, typically in the format parent_id/resource_id.
If you use an incorrect ID format, the provider will return an error message guiding you to the correct format. For example: Error: invalid alert ID format "12345", expected 'exploration_id/alert_id'.
After the import is successful, the resource exists in your Terraform state, but your configuration file is still empty. You need to write the configuration to match the imported state.
You can inspect the imported resource's state to see all its attributes:
The output will show the full configuration for the resource. Copy this into your .tf file to complete the process.
After adding the configuration, run terraform plan to verify that your code matches the state. There should be no changes to apply.
That's it. Your existing resource is now fully managed by Terraform. 🎉
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.