What the agent does
The agent clones the repository into its own cloud sandbox and reads the configuration first. In a small ECS-on-Fargate module like Oxalide/terraform-fargate-example, main.tf was written for Terraform 0.11: every attribute is an interpolation-only string such as vpc_id = "${aws_vpc.main.id}" and count = "${var.az_count}", the AWS provider takes its keys from a vault_generic_secret data source, the aws_eip has vpc = true and depends_on = ["aws_internet_gateway.gw"], and the ECS service ends with depends_on = ["aws_alb_listener.front_end"]. variables.tf defaults az_count to the string "2" and app_port to 3000, outputs.tf exposes "${aws_alb.main.dns_name}", and the README is three lines.
Then it reproduces the warnings with the current Terraform. terraform init resolves the current hashicorp/aws 6.x and hashicorp/vault providers and already prints Warning: Quoted references are deprecated for main.tf line 57, explaining that Terraform 0.11 required the quotes and a future version will remove them. terraform validate repeats the warning, notes one more like it, and then stops on something the warning hid: Error: Unsupported argument at line 56, An argument named "vpc" is not expected here, because version 6 of the AWS provider no longer accepts vpc on aws_eip. terraform fmt -diff shows the lines it would rewrite from "${var.aws_region}" to var.aws_region, and leaves the quoted depends_on entries and the list-wrapped splats like ["${aws_subnet.public.*.id}"] alone.
The fix is small and explicit. The agent runs terraform fmt to drop the interpolation wrappers, changes the two depends_on lists to bare references, [aws_internet_gateway.gw] and [aws_alb_listener.front_end], and replaces vpc = true with domain = "vpc", the argument the provider takes now. It does not touch the splat lists, because validate accepts them as written and a rewrite to aws_subnet.public[*].id is only safe to confirm with a plan, which this module cannot produce in a sandbox: it needs a Vault address and AWS credentials, and terraform plan stops at failed to configure Vault address before reading any resource.
After the edit, terraform validate answers Success! The configuration is valid. with no warning, and terraform fmt -check is quiet. The pull request quotes the two warnings and the error from before, and the clean validate from after, and lists the splat lists and the az_count string default as things the owner may want to tidy with a plan in hand.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "terraform validate prints \"Quoted references are deprecated\" for this configuration and then fails. Read every .tf file first, run terraform init -input=false and terraform validate with the current Terraform release, and quote every warning and error with its file and line. Fix them: run terraform fmt to rewrite interpolation-only expressions, change quoted depends_on entries to bare references, and replace any argument the current provider version no longer accepts with the one it documents. Do not change resource names, counts or anything that would alter a plan, and do not run terraform apply. Run terraform validate and terraform fmt -check again, and open a pull request that quotes the output before and after and lists anything you left for a human because it needs a plan to confirm.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- 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.
- 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.
- 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 touching main.tf and outputs.tf: the interpolation wrappers gone, two depends_on lists unquoted, vpc = true replaced by domain = "vpc", and no other resource changed. The description quotes terraform init and terraform validate from before, including the Unsupported argument error, and the line from after that says the configuration is valid, and names the provider versions init resolved so a reviewer can pin them if the module has no lock file committed.
A reviewer checks that the diff is syntax and one renamed argument only: no count changed, no name changed, no new resource, and the aws_eip still ends up in a VPC. Because the sandbox has no Vault or AWS credentials, the pull request says in plain words that plan is not run, so the reviewer runs it once from a workstation that has them before merging. The run's record shows every Terraform command and its full output.
Run it on every failed CI run
Add an automation to the Project with this prompt and a webhook trigger. In the workflow that runs terraform validate, add a step on failure that sends the job's name and the failing output to the trigger's URL with Authorization: Bearer and the secret Rush showed when the trigger was made. One run starts per failed job, reads the output as data after the prompt, and opens one pull request on its own branch; a run whose validate still fails ends needs_review with the output attached.
To start it from your own code instead, send this body to POST /o/{org}/sessions with an API key and a request_id that is a UUID v5 of the CI run id, so a retried delivery returns the run already started rather than a second branch.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
The warning is cheap to read and expensive to trust. In this module the quoted reference is the visible symptom, and the thing that actually breaks validate is an argument a provider major version removed, which only shows against the current provider in a clean init. The agent does that in its own sandbox with the current Terraform and provider releases, and every warning and error stays in the run's record with its file and line, so the pull request argues from what Terraform printed rather than from a migration guide.
It is also the kind of chore that sits for years because nobody wants to touch a module that still applies. On Rush the failed CI job starts one run, the sandbox has nothing else on it, the diff is limited to what validate complained about, and what comes back is a pull request with the clean output attached and an honest list of what still needs a plan, ready for the one person who has the credentials.
Frequently asked questions
Will terraform fmt change what the module does?
No. fmt rewrites "${var.aws_region}" to var.aws_region and nothing else; the value is the same. It deliberately leaves expressions where the meaning could differ, such as a splat wrapped in a list, and the agent leaves those too unless it can confirm the plan is unchanged.
Why did validate fail on vpc = true when the warning was about quotes?
They are two separate things. The quotes are a Terraform language deprecation that still parses. vpc on aws_eip was removed by the AWS provider in its version 6 line, which a fresh terraform init with no lock file selects, so the module that was only warning before now stops. The agent replaces it with domain = "vpc", which is the argument the provider takes.
Does the agent need AWS or Vault credentials?
Not for this job. init, validate and fmt need provider downloads only. plan would need both, and the pull request says that it was not run so a reviewer with credentials runs it once before merging. If you keep a .terraform.lock.hcl, commit it, and the agent will validate against the pinned providers instead of the newest.
Should it also upgrade to the newest Terraform syntax everywhere?
The prompt limits the change to what validate and fmt report. A wider rewrite, such as [*] splats, for_each instead of count, or a required_providers block with version pins, is a second pull request, and the agent lists those candidates in the description rather than mixing them in.