Skip to content

feat: add dry-run mode to preview API calls and flyctl commands#2

Merged
joshpollara merged 1 commit intomainfrom
feat/dry-run-mode
Mar 17, 2026
Merged

feat: add dry-run mode to preview API calls and flyctl commands#2
joshpollara merged 1 commit intomainfrom
feat/dry-run-mode

Conversation

@joshpollara
Copy link
Member

Summary

  • Adds dry_run provider attribute (also FLY_DRY_RUN env var) that intercepts all mutating operations and shows them as Terraform warnings
  • REST API: non-GET requests return fake success and log method/URL/body
  • flyctl: RunMut/RunJSONMut methods return fake success and log the full command line
  • Read operations pass through normally so Terraform can build an accurate plan

Example output

Warning: Dry Run [1]
  POST https://api.machines.dev/v1/apps/my-app/machines/abc123/lease body={"ttl":60}

Warning: Dry Run [2]
  POST https://api.machines.dev/v1/apps/my-app/machines/abc123 body={...}

Warning: Dry Run [3]
  /usr/local/bin/flyctl ips allocate-v6 -a my-app

Test plan

  • Tested REST API dry-run (machine update) — shows lease/update/release calls as warnings, clean apply
  • Tested flyctl dry-run (IP create) — shows allocate command as warning, clean apply
  • Unit tests pass (make test)
  • Build succeeds (make build)

🤖 Generated with Claude Code

When `dry_run = true` (or `FLY_DRY_RUN=1`), the provider intercepts all
mutating operations and reports them as Terraform warnings instead of
executing them. Read operations pass through normally so Terraform can
build an accurate plan.

Both layers are covered:
- REST API: non-GET requests return fake success and log the method/URL/body
- flyctl: mutating commands (RunMut/RunJSONMut) return fake success and log
  the full command line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joshpollara joshpollara merged commit c8a364b into main Mar 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant