{"id":17276748,"url":"https://github.com/loafoe/terraform-provider-ssh","last_synced_at":"2025-04-09T11:11:16.543Z","repository":{"id":37342708,"uuid":"333586571","full_name":"loafoe/terraform-provider-ssh","owner":"loafoe","description":"Copy files and run commands remotely via SSH, with bastion and proxy support","archived":false,"fork":false,"pushed_at":"2025-02-20T08:18:30.000Z","size":303,"stargazers_count":57,"open_issues_count":16,"forks_count":18,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T09:07:18.953Z","etag":null,"topics":["bastion-host","ssh-client","terraform","terraform-provider"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/providers/loafoe/ssh/latest","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loafoe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-27T23:18:04.000Z","updated_at":"2025-02-20T08:18:32.000Z","dependencies_parsed_at":"2023-02-18T16:32:10.123Z","dependency_job_id":"26fcfc10-9f82-4da4-b053-80a3aff2142f","html_url":"https://github.com/loafoe/terraform-provider-ssh","commit_stats":{"total_commits":118,"total_committers":7,"mean_commits":"16.857142857142858","dds":0.3728813559322034,"last_synced_commit":"0bb62bad2a470b824bedb47db2869b11389f8a75"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Fterraform-provider-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Fterraform-provider-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Fterraform-provider-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loafoe%2Fterraform-provider-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loafoe","download_url":"https://codeload.github.com/loafoe/terraform-provider-ssh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027407,"owners_count":21035594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bastion-host","ssh-client","terraform","terraform-provider"],"created_at":"2024-10-15T09:01:03.997Z","updated_at":"2025-04-09T11:11:16.511Z","avatar_url":"https://github.com/loafoe.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# SSH Terraform provider\n\n- Documentation: https://registry.terraform.io/providers/loafoe/ssh/latest/docs\n\n## Overview\n\nThis is a Terraform provider to copy files, run commands remotely and capture results via SSH. Unlike the Terraform provisioners which are described as\n a \"last resort\" this provider embraces the concept of pushing and executing content to compute instances over SSH. Apart from bastion\n hosts it also supports tunneling over HTTP proxies. This is very useful if you are running Terraform from inside a corporate\n network and need to reach out to your instances.\n\n## Using the provider\n\nTo install this provider, copy and paste this code into your Terraform configuration. Then, run terraform init.\n\n```terraform\nterraform {\n  required_providers {\n    ssh = {\n      source = \"loafoe/ssh\"\n    }\n  }\n}\n```\n## Example\n\n```hcl\nresource \"ssh_resource\" \"example\" {\n  host         = \"remote-server.test\"\n  bastion_host = \"jumpgate.remote-host.com\"\n  user         = \"alpine\"\n  agent        = true\n\n  file {\n    content     = \"echo '{\\\"hello\\\":\\\"world\\\"}' \u0026\u0026 exit 0\"\n    destination = \"/home/alpine/test.sh\"\n    permissions = \"0700\"\n  }\n\n  timeout = \"3m\"\n\n  commands = [\n    \"/home/alpine/test.sh\",\n  ]\n}\n\noutput \"result\" {\n  value = try(jsondecode(ssh_resource.example.result), {})\n}\n```\n\nThe above example snippet uploads a generated shell script, executes it remotely and captures the\noutput for further use in Terraform.\n\n### With triggers\n\n```hcl\nresource \"ssh_resource\" \"deploy-kubevip\" {\n  count = local.deploy_kubevip == true ? 1 : 0\n\n  triggers = {\n    template = data.template_file.kubevip_config[count.index].rendered\n  }\n\n  file {\n    content     = data.template_file.kubevip_config[count.index].rendered\n    destination = \"/tmp/deploy-kubevip.sh\"\n    permissions = \"0644\"\n  }\n\n  commands = [\n    \"chmod +x /tmp/deploy-kubevip.sh\",\n    \"sudo /tmp/deploy-kubevip.sh\"\n  ]\n\n  user        = local.ssh_user_server\n  private_key = local.ssh_key_server\n  host        = local.servernodes.0\n}\n```\n\n## Development requirements\n\n-\t[Terraform](https://www.terraform.io/downloads.html) 1.3.0 or newer\n-\t[Go](https://golang.org/doc/install) 1.21 or newer (to build the provider plugin)\n\n## Issues\n\n- If you have an issue: report it on the [issue tracker](https://github.com/loafoe/terraform-provider-ssh/issues)\n\n## LICENSE\n\nLicense is MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floafoe%2Fterraform-provider-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floafoe%2Fterraform-provider-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floafoe%2Fterraform-provider-ssh/lists"}