App Integrations
Pull request bot
What the LevelFour bot posts on GitHub pull requests and GitLab merge requests that change Terraform, and the commands you can reply to it with.
Once GitHub or GitLab is connected, the LevelFour bot reads every pull request or merge request that changes Terraform. It posts the cost impact of the change back on the request, and it proposes cheaper settings where it finds them. It behaves the same on both providers.
What it posts
| Item | Where | What it shows |
|---|---|---|
| Cost comment | The conversation | The cost of the changed resources before and after, and the monthly spend. The bot edits this one comment on each push instead of adding new ones |
| LevelFour status | The checks panel on GitHub, the pipeline status on GitLab | That the analysis ran, and its summary |
| Inline suggestions | On the changed lines of the diff | A concrete change to a resource, ready to apply |
The LevelFour status reports the analysis, not a budget. On GitHub it passes, or reads neutral when the bot has suggestions for you. On GitLab it passes. It fails only when the analysis itself could not run, so it is not a gate on cost.
A change that touches no Terraform resources gets no cost comment, and the status says why.
Reply with a command
Mention the bot in a comment on the pull request or merge request, followed by a command. The bot reacts to your comment when it picks it up, then replies or updates the cost comment.
| Command | What it does |
|---|---|
@levelfourai help | Posts the list of commands |
@levelfourai dismiss <reason> | Dismisses the bot's suggestions on this request. A reason is required |
@levelfourai snooze <reason> | Hides the suggestions until the next push. A reason is required |
@levelfourai ignore <type>.<name> | Leaves one Terraform resource out of future analyses |
@levelfourai apply all | Commits every inline suggestion to the request's branch |
@levelfourai apply <type>.<name> | Commits only the suggestions for that resource |
<type>.<name> is the Terraform resource address, the way the resource is declared in your .tf files:
@levelfourai ignore aws_ebs_volume.logsDismissing, snoozing and ignoring add a line to the top of the cost comment naming who did it, and the reason for a dismiss or snooze, so the next reviewer sees the decision.
Applying suggestions
apply writes the suggestions into one commit on the branch and replies with its short SHA. On GitLab it also resolves the suggestion threads it applied.
On GitHub, if the branch moved after the bot's last analysis, the bot refuses rather than overwrite newer work. Push, let the cost comment update, and run apply again. apply also needs the LevelFour app to hold write access to repository contents. If it does not, the bot says so, and an organization owner approves the permission in GitHub.
Tune it per repository
A .levelfour/config.yml at the root of the default branch turns the bot off for a repository, drops the inline suggestions, caps how many it posts, or skips paths and resource types. PR bot configuration has every field.
Next
- PR bot configuration is the
.levelfour/config.ymlreference - GitHub and GitLab cover connecting each provider