What the agent does
The agent reads the three variables in variables.tf, their use in main.tf and examples/acl/main.tf, and the provider's own s3_bucket_acl docs before editing. It keeps acl = null as the default and keeps the string "null", which main.tf treats as no ACL, next to the eight canned ACLs. object_ownership accepts only BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter.
lifecycle_rule gets ten separate validation blocks: a rule needs enabled or status, expiration takes one of date, days or expired_object_delete_marker, storage classes come from the provider's list, and noncurrent settings set exactly one of days or noncurrent_days. The new tests/validation.tftest.hcl runs plan-only against mock_provider "aws", so no credentials and no AWS calls.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "A Linear issue labeled agent asks for validation blocks on the S3 bucket module's acl, lifecycle_rule and object_ownership variables, with clear diagnostics for invalid values. Read variables.tf, main.tf, versions.tf and existing examples before editing. Preserve documented valid forms, null/default behavior and the existing ACL string-null compatibility unless the issue explicitly authorizes its removal. Check the provider contract for allowed values and define precise lifecycle constraints without changing unrelated inputs. Add native Terraform tests with valid cases and expect_failures for the relevant variables, using plan-only/provider-mocked execution where appropriate and no production AWS access. Keep the module's declared consumer compatibility intact; explain the test runtime requirements. Run terraform init -backend=false, terraform fmt -check, terraform validate and terraform test. Open a pull request linking the supplied Linear issue with real command output and any untested provider behavior.",
"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
Tried on terraform-aws-modules/terraform-aws-s3-bucket at 9afa4fc: 3 files changed, 398 insertions(+), 2 deletions(-) in README.md, variables.tf and a new tests/validation.tftest.hcl. Init, fmt -check and validate exited 0 before and after; terraform test went from Success! 0 passed, 0 failed. to Success! 19 passed, 0 failed. The agent had to install Terraform 1.9.8; the AWS provider resolved to 6.71.0. No Linear issue was supplied, so it worked from the request text and has no issue to link.
For the reviewer: the rules are stricter in four places, each needing a yes. A rule with both days and noncurrent_days is now refused (before, days silently won), so is a rule with neither enabled nor status, dates must be full RFC3339 timestamps, and object_ownership = null is refused. The tests need Terraform 1.7 or newer for mock_provider; the module's >= 1.5.7 is unchanged and was not run.
Run it on every Linear issue labelled agent
An automation with a linear trigger on linear.issue.labeled and the label agent runs the Linear label to PR prompt with the labelled issue as context. The issue should name the variables to validate and say whether the string "null" ACL may go.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
The first plan-only run caught a docs mismatch: the provider calls lifecycle dates a full date, but a bare 2030-01-31 failed at plan with "Invalid RFC3339 String Value", so the validation requires a timestamp. The run also found that a lifecycle rule with no filter fails at plan in main.tf lines 494 and 496, and left it for a separate change.
Frequently asked questions
Do older Terraform versions break on the new checks?
The agent says no: each validation references only its own variable, which 1.5.7 allows, and older Terraform ignores tests/. That comes from reading the code, not a run on 1.5.7.
Why does every test lifecycle rule set `filter = {}`?
On Terraform 1.9.8 a rule with no filter fails with "Attempt to get attribute from null value". The tests step around that existing bug rather than fix it here.