Skip to main content

Managed Resources

An infrastructure as code (IaC) tool, such as logflare-iac, can manage sources, endpoints and alerts through the Management API. Mark these resources as managed. The web UI then locks them, so a change in the UI does not drift from the code.

Mark a resource as managed​

Set these optional fields with a POST or PUT request to /api/sources, /api/endpoints or /api/alerts. The GET responses return them.

  • managed_by: the name of the tool, for example logflare-iac. At most 64 characters: letters, digits, ., _ and -.
  • managed_by_url: an absolute http:// or https:// URL, for example the repository that holds the resource definition. At most 2048 characters. It needs managed_by.

Send null to clear a field. An empty string returns an error. A managed_by_url without managed_by returns an error.

curl -X PUT 'https://api.logflare.app/api/alerts/YOUR-ALERT-TOKEN' \
-H 'X-API-KEY: YOUR-ACCESS-TOKEN' \
-H 'Content-Type: application/json' \
-d '{"managed_by": "logflare-iac", "managed_by_url": "https://github.com/acme/logflare-infra"}'

What the web UI does​

While managed_by is set, the web UI shows a notice with the tool name and the managed_by_url link. It hides the actions that change or delete the resource, and refuses them on the server. You can still view the resource and run its queries.

The UI also refuses to delete a backend or a source when a managed resource in the same account depends on it. This check runs before the delete. It is not atomic with an IaC apply that runs at the same time.

The Management API does not check managed_by. A write through the API always works.

Unlock a resource​

Use one of these:

  • Click Unlock on the notice in the web UI, then confirm. This clears managed_by and managed_by_url.
  • Set managed_by and managed_by_url to null through the Management API.

If the IaC tool still manages the resource, its next apply locks the resource again and replaces your changes. Remove the resource from the tool first.