# Add Renovate to a Terraform Module Repository

Yes. An agent writes a Renovate config that bumps provider floors, registry modules in examples, pre-commit hook revisions and actions, dry-runs it and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-renovate/terraform/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the repository into its own cloud sandbox and reads every place a version is written before configuring a bot to change them. In a module like terraform-aws-modules/terraform-aws-vpc, the root `versions.tf` requires Terraform `>= 1.0` and the `aws` provider `>= 6.28`, the `modules/flow-log` submodule requires Terraform `>= 1.5.7`, and each directory under `examples` has its own `versions.tf` with the same floors. The examples also pull registry modules with pessimistic constraints: `terraform-aws-modules/security-group/aws` at `~> 6.0` in `examples/complete`, and `s3-bucket` at `~> 5.0`, `cloudwatch//modules/log-group` at `~> 5.0` and `iam//modules/iam-role` at `~> 6.0` in `examples/flow-log`. `.pre-commit-config.yaml` pins `pre-commit-terraform` at `v1.108.1` and `pre-commit-hooks` at `v6.0.0`, and `.github/workflows/pre-commit.yml` carries `TERRAFORM_DOCS_VERSION: v0.24.0` and `TFLINT_VERSION: v0.64.0` as plain environment variables. Releases come from `release.yml` through `cycjimmy/semantic-release-action@v6.0.0` with `.releaserc.json` on the conventional commits preset, where a `fix` commit cuts a patch release and a `chore` commit cuts nothing, and `pr-title.yml` only accepts `fix`, `feat`, `docs`, `ci` and `chore` titles. There is no `renovate.json` and no `dependabot.yml`.

It writes `renovate.json` so that each of those version sources is managed and each pull request has a title the release process understands. It extends `config:recommended` and `:semanticCommits`, sets `semanticCommitType` to `chore` for everything so a bot bump never cuts a release on its own, and enables the `terraform`, `pre-commit` and `github-actions` managers; `pre-commit` is off in Renovate's defaults, so it is turned on by name. For the Terraform manager it sets `rangeStrategy` to `bump` so a `~> 5.0` module constraint moves to `~> 6.0` when a new major is published and the provider floor in every `versions.tf` moves together, with a `packageRules` entry that groups the `aws` provider across root, submodules, examples and wrappers into one pull request so the floors never disagree. Registry modules in examples get their own group, and actions get a third.

Two versions live outside any manager, so it adds a `customManagers` regex entry for the `TERRAFORM_DOCS_VERSION` and `TFLINT_VERSION` lines in `pre-commit.yml`, each mapped to its GitHub release datasource, which keeps the CI tool versions moving with the hook versions in `.pre-commit-config.yaml`. The `release.yml` comment that holds `conventional-changelog-conventionalcommits` at a 9.x version on purpose becomes a `packageRules` entry that disables major updates for that package, so the bot does not reopen a bump the maintainers already rejected. A `schedule` of one early morning a week and a `prConcurrentLimit` keep the first week from being a wall of pull requests.

It proves the config in the sandbox: it runs the Renovate CLI with `--platform=local` and `--dry-run` against the checkout, which prints every dependency each manager found and what it would update without talking to GitHub, and it compares that list with the files it read so nothing is missed and nothing is matched twice. It also runs `renovate-config-validator` on the file. The pull request shows the dry-run output grouped by manager, and the README gains a short section on how to pause Renovate for a release week and how the major-version rule is meant to be used.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add Renovate to this Terraform module repository. Read every versions.tf in the root, submodules, examples and wrappers, every module source with a version in the examples, the pre-commit config, every workflow and the release config first, and list every place a version is written and which manager covers it. Write renovate.json extending the recommended config with semantic commits of type chore so a bump never cuts a release, the terraform, pre-commit and github-actions managers enabled, bump as the range strategy for Terraform constraints, one group for the provider across every directory, one for registry modules and one for actions, a custom regex manager for tool versions written as environment variables in workflows, a rule that disables major updates for any package a comment says must stay on its line, and a weekly schedule with a concurrency limit. Validate the file with the config validator, run the Renovate CLI in local dry-run mode and compare its findings with your list, add a README section on pausing and on the major rule, and open a pull request with the dry-run output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request adding `renovate.json` and a README section. The description has a table of every version source in the repository, root and submodule provider floors, example module constraints, hook revisions, workflow actions and the two tool version variables, each with the manager or regex that covers it and the group its updates will land in, followed by the dry-run output showing the same dependencies detected.

The run's record keeps the `renovate-config-validator` and the local dry run from the sandbox, so a reviewer can see which dependencies each manager found, that the custom regex matched exactly the two environment lines and nothing else, and that the held-back package is excluded from major updates.

Before merging, a reviewer installs the Renovate app on the repository if it is not already, decides whether provider bumps should be `fix` commits that release a patch rather than `chore` commits that do not, and sets the weekly schedule to the day the team reviews dependency pull requests.

## Run it on every Monday morning

Once the config is merged, Renovate opens the pull requests on its own schedule, so the weekly job on Rush is review rather than setup. Create an automation in the Project with a `schedule` trigger, a `cron` such as `0 8 * * 1` in your `timezone`, and a prompt that lists the open Renovate pull requests, checks each one out, runs `pre-commit run --all-files` and `terraform init` plus `terraform validate` in the examples the bump touches, and comments on each pull request with what passed. An automation run has its own `max_runs_per_hour` cap.

A `github` trigger never fires for a pull request a bot opens, so a team that wants a review the moment Renovate opens one has a handler on its server receive the `pull_request` webhook, check its signature and send one `POST /o/{org}/sessions` with the pull request URL in `resources` and a `request_id` that is a UUID v5 of the delivery id, so GitHub's redelivery returns the run already started.

## Why run it on Rush?

A Renovate config for a Terraform module is mostly an inventory: every `versions.tf`, every example's module constraint, every hook revision and every tool version hidden in a workflow variable. Miss one and it drifts silently; match one twice and the bot opens duplicate pull requests. The agent reads the whole repository in its own sandbox, writes the config against what it found, and runs Renovate's own dry run to prove the inventory matches, before the pull request exists.

The same body runs across every module repository an organisation maintains, each pull request carrying its own inventory table and its own dry-run output, with the run's record holding the commands. That is how a team gets the same grouping, the same commit types and the same release safety across dozens of modules kept by different people.

## Frequently asked questions

### Will a Renovate pull request trigger a release?

Not by default. The config sets `semanticCommitType` to `chore`, and `.releaserc.json` only releases on `fix` and `feat` commits, so merging a bump changes nothing for users until a maintainer makes a release. A team that wants provider floor bumps to ship as patches can change the type for that group in one `packageRules` entry, and the README section says where.

### Why bump the provider floor in every directory at once?

Because the root, the submodules, the examples and the wrappers all declare `>= 6.28` for `aws`, and a floor that moves in one place but not another makes an example that no longer validates against its own module. The provider group puts every `versions.tf` in one pull request so the floors stay equal.

### What does bump do to a constraint like ~> 5.0?

It rewrites the constraint to the new release's major, so `~> 5.0` becomes `~> 6.0` when a 6.x module is published and stays put for every 5.x release, which already satisfies it. The dry run in the pull request shows this for the example modules, and the README explains the rule so nobody is surprised by the first major.

### How are the tool versions in the workflow kept in step with the hooks?

With a regex manager. `TERRAFORM_DOCS_VERSION` and `TFLINT_VERSION` are plain environment lines in `pre-commit.yml` that no built-in manager reads, so the config matches them by name and points each at its GitHub release datasource. The hooks in `.pre-commit-config.yaml` are covered by the `pre-commit` manager, so both move on the same schedule.

### Can I pause it during a release week?

Yes. The README section shows the two ways: a Renovate dashboard issue checkbox, or an `enabled: false` rule with a date range in `renovate.json`. The weekly `schedule` and `prConcurrentLimit` already keep a normal week to a handful of pull requests.

## More Terraform jobs

- [Add Consistent Resource Tags to a Terraform Configuration](https://getrush.ai/run/add-resource-tags/terraform/)
- [Generate Terraform Module Docs With terraform-docs and Keep Them Current in CI](https://getrush.ai/run/add-terraform-docs/terraform/)
- [Add TFLint and Format Checks to Terraform CI](https://getrush.ai/run/add-tflint-to-ci/terraform/)

## The same job on other stacks

- [Set Up Renovate for an Ansible Role](https://getrush.ai/run/add-renovate/ansible/)
- [Add Renovate to Keep Docker Compose Image Tags Current](https://getrush.ai/run/add-renovate/docker-compose/)
- [Add Renovate to a Gradle and Maven Project](https://getrush.ai/run/add-renovate/gradle/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
