r/Terraform • • 23d ago

Discussion terraform-provider-system (agentless SSH: files, users, packages) has been quiet since May 2024. Who still uses it? I have a changeset I'd like to propose upstream.

neuspaces/terraform-provider-system manages files, folders, users, groups, packages and services on a remote host over SSH, with no agent — the escape hatch for pets in an otherwise immutable setup.

Last commit: 31 May 2024. v0.5.0 is still the latest release. 45 stars, 11 forks, 4 open issues — and the registry reports ~523k downloads, so a fair number of terraform init runs are still pulling it.

I use it for a handful of servers, and I've spent a sprint on a changeset against it. Before I open an issue upstream and send pull requests, I'd like a reality check from people who actually run this thing. I am not publishing a competing provider. The work sits in a plain GitHub fork, on a branch that keeps the module path and the provider address as they are, with no trace of a fork in the tree — it is shaped to be merged upstream, not released beside it.

The change I'm least sure about

Refusing to connect when host_key is not set. Today the provider silently falls back to ssh.InsecureIgnoreHostKey() if you leave host_key out. Every such connection is open to MITM and nothing in the plan says so. My branch makes ConfigureProvider fail unless you set host_key (also proxy.ssh.host_key behind a bastion) or opt out with a new insecure_ignore_host_key = true, which warns on every run and names the block whose key is missing. ssh-keyscan -t ed25519 <host> gets you the value.

That breaks every existing configuration on upgrade, which is why I'm asking instead of just sending it:

  • Hard failure with an explicit opt-out, or warn first and fail a release later?
  • Does anyone actually set host_key today, or is everyone on the implicit insecure path?
  • If you go through a bastion, does requiring proxy.ssh.host_key hurt?

The rest of the changeset

  • overwrite for system_file and system_folder — adopt an existing path on create instead of failing. This is upstream PR #11 by raynigon (issue #4), rebased and finished: symlinks still fail, even when they point at an entry of the right kind, so nothing is ever written through a link.
  • create_home for system_user — upstream PR #10 by ii1818nn (issue #9). The default keeps passing --no-create-home, so behaviour doesn't depend on CREATE_HOME in /etc/login.defs.
  • system_file.source is no longer ForceNew: changed content is rewritten in place instead of destroy + create. Tell me if you relied on the replacement.
  • Removing source from a resource no longer recreates the file empty and throws the remote content away.
  • Fixed: switching between content, content_sensitive and source in one apply wrote nothing at all.
  • Dependencies to Go 1.27 and SDKv2 2.40.1. govulncheck on v0.5.0 reports 28 reachable vulnerabilities, nine of them in the SSH path; the branch reports none, and the check gates CI.
  • CI on GitHub-hosted runners: Terraform 1.6 / 1.10 / 1.11 / 1.14 / 1.17 and OpenTofu 1.6 / current, acceptance against Debian, Alpine and Fedora containers built inside the workflow, so a pull request from a fork needs no pre-published images. The README claimed 0.12+; the real floor is 1.6. Protocol stays 5, existing state is unaffected.
  • An acceptance test for the thing I care about most: a state file written by the released v0.5.0 binary must produce an empty plan with the new code, on all three target systems, across the whole CLI matrix, with no change to required_providers.

The full matrix is green — three target systems by seven CLIs, twenty-one acceptance runs, compatibility test included.

One thing the matrix found, and I'd like an opinion on it

The provider offers a password as both the password and the keyboard-interactive method. Against an sshd built without PAM — the Alpine target, for one — the server answers the keyboard-interactive request with USERAUTH_FAILURE and no challenge at all, and current golang.org/x/crypto/ssh aborts the authentication loop with unexpected message type 51 (expected 60) rather than reporting the exhausted method list. It behaves that way since it started to require a challenge before it accepts the result of a method; the version v0.5.0 pins has no such requirement.

The practical effect: on those servers, a mistyped password now produces a protocol error instead of "unable to authenticate". Authentication itself is unaffected — the correct password connects, the wrong one is refused — but the message is useless to a human. Is this worth translating in the provider, or do you read raw x/crypto errors and shrug?

Later, and only if there's interest: moving the file, folder and link resources to the plugin framework behind terraform-plugin-mux, which costs exactly one in-place update of source on the first plan (the framework can't keep etag=… in that attribute), plus content_wo for write-only content on Terraform 1.11+.

What I'm asking

  1. Do you use this provider? On what, and how many hosts?
  2. What keeps you on 0.5.0, or what made you drop it?
  3. Which of the four open issues actually bites you?
  4. Has anyone reached the maintainers recently? I'd rather contribute than fork, and the repo isn't archived — but eighteen months on a vulnerable SSH stack is why I started.

Branch, if you'd rather read code than prose: https://github.com/metronom72/terraform-provider-system/pull/1

0 Upvotes

12 comments sorted by

5

u/RoseSec_ If it ain’t broke, I haven’t run terraform apply yet 23d ago

What’s the benefit of using this rather than Ansible, pre-baking the image with Packer, or using user data (startup scripts) to do what I need on the fly?

2

u/FreeFlipsie 23d ago

Fully agree - I feel like any time we’re using TF to cross into the OS itself, we’re using the wrong tool for the job.

cloud-init? Sure. But beyond that, TF really isn’t meant for that kinda thing. Ansible’s so much better suited for interacting with the OS itself.

Also I have some strong concerns about a Reddit account dumping an obviously AI-generated wall of text about a potentially abandoned provider & dropping a big PR. The next step could very easily be to either try to take over development, or to position as “the old provider’s abandoned, use mine”, and then trying to sneak who knows what into the code.

1

u/Tinasour 8d ago

I hate how slow ansible is. And i like the declarative nature over idompotency. Im not using it in os level management. But if it was more mature, i would use it

I have used ansible in 2 companies, hated its guts in both of them, and diffs are nothing when compared to tf diffs

-2

u/LevelRelationship732 23d ago

no, I just curious how people manage this cases. also i'm moving form aws and was thinking how to use the same stack as I've been using there.

3

u/FreeFlipsie 23d ago

If you’re migrating anyway, this might be a good chance to change that part!

If it’s something that probably won’t need to change, bake it into your image.

If it’s something that needs to be dynamic or needs to be updated at VM create time, a templated cloud-init created via TF will work great for ya.

But running one-off things post-initial create - I can almost guarantee you’ll have a better time with Ansible 😊

0

u/LevelRelationship732 23d ago

I've setup swarm with cron services and I stuck with hundreds of services with a bunch of bash scripts. and trying to have an order. terraform gave me a clean view how it works.

I've introduced a container grouping for beszel and was searching for terraform adapter for services.

looks like that ansible covers docker swarm and services better than terraform...

thank you for your input

-3

u/LevelRelationship732 23d ago

speaking about ansible - I've been using it 10 years ago. I didn't know that it is still alive

3

u/KellyShepardRepublic 23d ago

There are a lot of providers so maybe they moved on or maybe they went to opentofu. These providers imo do too much. It would preferably be the core and users handle everything else either through modules which could be go, scripts or mixed with ansible for the final mile.

-1

u/LevelRelationship732 23d ago

I've just used aws, gcp with terraform and now I switched to VPS and trying to use the same way. Looking for unified way or similar

9

u/ashtonium 23d ago

People dumping Claude output directly into posts…

-1

u/Fatality 22d ago

It's so bad then they reply claiming to not be AI when it matches the exact format

1

u/MongooseWonderful198 21d ago

I'd prefer the hard failure with an explicit opt-out in a release that clearly announces the breaking change. The migration guide needs one extra step: verify the key you get from ssh-keyscan against a trusted source, such as the server console.

ssh-keyscan retrieves a key but doesn't authenticate the server. Pasting its output from an untrusted network can pin an attacker's key. The OpenSSH manual calls this out. The bastion and target each need that initial verification.