{"id":18465543,"url":"https://github.com/numtide/terraform-provider-linuxbox","last_synced_at":"2025-04-08T08:31:56.622Z","repository":{"id":38311145,"uuid":"217586090","full_name":"numtide/terraform-provider-linuxbox","owner":"numtide","description":"Configure Linux machines with Terraform","archived":false,"fork":false,"pushed_at":"2025-01-11T23:01:53.000Z","size":301,"stargazers_count":34,"open_issues_count":13,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T23:55:51.157Z","etag":null,"topics":["terraform-provider"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/providers/numtide/linuxbox/latest/docs","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-10-25T17:45:43.000Z","updated_at":"2025-04-01T01:51:46.000Z","dependencies_parsed_at":"2024-06-19T02:41:26.075Z","dependency_job_id":"893a3ff3-6b31-405d-9e5f-668f93d2709d","html_url":"https://github.com/numtide/terraform-provider-linuxbox","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fterraform-provider-linuxbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fterraform-provider-linuxbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fterraform-provider-linuxbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fterraform-provider-linuxbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtide","download_url":"https://codeload.github.com/numtide/terraform-provider-linuxbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804595,"owners_count":20999018,"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":["terraform-provider"],"created_at":"2024-11-06T09:13:30.935Z","updated_at":"2025-04-08T08:31:56.210Z","avatar_url":"https://github.com/numtide.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linuxbox terraform provider\n\nBasic building block for Seed DevOps.\n\nThis provider allows:\n* Executing of commands via SSH as a resource.\n* Calculating checksum from list of source paths/files.\n* Building Docker containers from Dockerfiles.\n* Copying built Docker images to destinations hosts vis SSH.\n* Controlling Docker containers on destination hosts via SSH.\n* Creating Docker networks on destination hosts via SSH.\n\n## Installation\n\nEasiest and most efficient way of installing the provider is to generate the provider shim using [generate-terraform-provider-shim](https://github.com/numtide/generate-terraform-provider-shim):\n\n```console\n$ generate-terraform-provider-shim numtide/terraform-provider-linuxbox\n```\n\nGenerated provider shims (one per found ARCH of the provider) are a small Bash script and can be easily checked in with the rest of the terraform files.\n\nif a version that satisfies Semver constraints is required, this can be specified at generation time:\n\n```console\n$ generate-terraform-provider-shim --version '\u003c 0.2.0, \u003e= 0.1.0' numtide/terraform-provider-linuxbox\n```\n\n## Use\n\n### Configuring Provider\n\nProvider accepts one optional argument: `ssh_session_limit`.\nThis is the limits number of sessions that will be open through SSH connection to a host.\nCurrent default limit is `5`.\n\nSample provider declaration with setting the `ssh_session_limit` lower looks like this:\n\n```hcl\nprovider \"linuxbox\" {\n  ssh_session_limit = 3\n}\n```\n\n### SSH Configuration used by every SSH resource.\n\nEvery Linuxbox resource that uses SSH will accept following parameters:\n\n* **ssh_key**: This is the private key used to authenticate user when connecting to the destination host.\n\n* **ssh_user**: Username used to authenticated when connecting to the destination host.\nBy default, this username is `root`.\nIf the username is not root, make sure that the user has the right permissions on the destination host to execute required operations.\n\n* **host_address**: Address (dns name or IP address) of the target host.\n\n### Performing setup of a remote machine using SSH.\nPhilosophy of Linuxbox is similar to the one of Ansible.\nWe don't require any kind of agent or a service to be run on the remote machine apart from SSH.\nEvery step of a machine setup can be represented as a separate Terraform resource.\nBy doing so, we make sure that setup steps are executed only once and in order given\nby `depends_on` or other dependency resolving mechanism of Terraform.\nThis enables parallelisation of execution of certain tasks (for example: adding a swap and installing Docker) which this will be automatically handled by Terraform.\n\nEvery setup step is defined using `linuxbox_run_setup` resource.\n\nSince setup is a Terraform resource, user has to provide 3 parts to it:\n* List of commands to be executed to perform setup (`setup`). This performed when `terraform apply` is executed.\n* Command that will tell if the result of the setup is available on the machine (`check`). that is what `terraform plan` will query)\n* Command that will remove the result of the setup ... for examle, removing the installed package or removing the swap.\n\nonly `setup` is mandatory.\nIf `check` is omitted, plan will alway report resource being present (can be misleading if in the meantime someone has logged in into the machine and has deleted the installed package).\n\nIf `delete` is omitted, removing/destroying the resource in terrafom won't have any effect on what is installed on the destination machine.\n\nFor example, following setup will install docker on the target ubuntu 18.04 machine:\n\n```hcl\nresource \"linuxbox_run_setup\" \"install_docker\" {\n  host_address = digitalocean_droplet.test.ipv4_address\n  ssh_key      = tls_private_key.ssh_key.private_key_pem\n\n  setup = [\n    \"apt update\",\n    \"apt install -y apt-transport-https ca-certificates curl software-properties-common\",\n    \"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\",\n    \"add-apt-repository \\\"deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable\\\"\",\n    \"apt update\",\n    \"apt install -y docker-ce\",\n  ]\n\n  check = \"docker -v\"\n\n  delete = \"apt-get purge -y docker-ce docker-ce-cli\"\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fterraform-provider-linuxbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtide%2Fterraform-provider-linuxbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fterraform-provider-linuxbox/lists"}