{"id":14957773,"url":"https://github.com/robertpeteuil/terraform-installer","last_synced_at":"2025-05-02T07:31:58.177Z","repository":{"id":56503490,"uuid":"119876200","full_name":"robertpeteuil/terraform-installer","owner":"robertpeteuil","description":"Installer for HashiCorp Terraform - Automatic Download, Extract and Install of Latest or Specific Version","archived":false,"fork":false,"pushed_at":"2023-02-10T23:53:55.000Z","size":86,"stargazers_count":75,"open_issues_count":0,"forks_count":41,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-29T23:15:09.410Z","etag":null,"topics":["automated-deployment","automation","bash-script","hashicorp","hashicorp-downloads","hashicorp-terraform","installer","linux","macos","terraform","terraform-installer","terraform-scripts","windows"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertpeteuil.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":"2018-02-01T18:28:22.000Z","updated_at":"2024-10-01T10:28:48.000Z","dependencies_parsed_at":"2024-09-22T04:01:48.674Z","dependency_job_id":"f369744d-4b31-4d31-9a10-f08afd49b70f","html_url":"https://github.com/robertpeteuil/terraform-installer","commit_stats":{"total_commits":68,"total_committers":4,"mean_commits":17.0,"dds":0.05882352941176472,"last_synced_commit":"74443d4d84ea82eefa1f80cfcc41cc02b0ba1a06"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertpeteuil%2Fterraform-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertpeteuil","download_url":"https://codeload.github.com/robertpeteuil/terraform-installer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224305842,"owners_count":17289446,"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":["automated-deployment","automation","bash-script","hashicorp","hashicorp-downloads","hashicorp-terraform","installer","linux","macos","terraform","terraform-installer","terraform-scripts","windows"],"created_at":"2024-09-24T13:15:33.673Z","updated_at":"2024-11-12T16:03:20.160Z","avatar_url":"https://github.com/robertpeteuil.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Installer for HashiCorp Terraform - Automated Installation\n\n## Automatically Download, Extract and Install Latest or Specific Version\n\n[![release](https://img.shields.io/github/release/robertpeteuil/terraform-installer.svg?colorB=2067b8)](https://github.com/robertpeteuil/terraform-installer)\n[![bash](https://img.shields.io/badge/language-bash-89e051.svg?style=flat-square)](https://github.com/robertpeteuil/terraform-installer)\n[![license](https://img.shields.io/github/license/robertpeteuil/terraform-installer.svg?colorB=2067b8)](https://github.com/robertpeteuil/terraform-installer)\n\n---\n\n**Note:**  An updated script with additional capabilities and multi-product support has been published to the [hashicorp-installer](https://github.com/robertpeteuil/hashicorp-installer) repo.  It defaults to installing Terraform and can be a drop-in replacement for this script.\n\n---\n\nThe **terraform-install** script automates the process of downloading and installing Terraform.  It provides an ideal method for installing installing updates or a specific version.\n\nThis script detects the latest version, OS and CPU-Architecture and allows installation to local or system locations.  Optional parameters allow installing a specific version and installing to /usr/local/bin without prompting.\n\nExample - install last pre-0.13 release: `./terraform-install.sh -i 0.12.29`\n\nOptions:\n\n- `-i VERSION`:  Install specific version\n- `-a`:          Automatically use `sudo` to install to /usr/local/bin\n  - allows for unattended installation via scripts or CD tools\n  - can be set as default behavior by uncommenting line 14 (`sudoInstall=true`)\n  - sudo password may be required unless NOPASSWD is enabled\n- `-c`:          leave binary in working directory (for CI/DevOps use)\n- `-h`:          help\n- `-v`:          display version\n\nThis installer is similar to my [Packer Installer](https://github.com/robertpeteuil/packer-installer) and [Vault Installer](https://github.com/robertpeteuil/vault-installer)\n\n## Download and Use Locally\n\nDownload Installer\n\n``` shell\ncurl -LO https://raw.github.com/robertpeteuil/terraform-installer/master/terraform-install.sh\nchmod +x terraform-install.sh\n```\n\nDownload installer via my bootstrap server (iac.sh or https://iac.sh)\n\n``` shell\ncurl iac.sh/terraform \u003e getinst.sh\nbash getinst.sh\n# installer downloaded as terraform-install.sh in current directory\n```\n\n### Run local installer\n\n``` shell\n./terraform-install.sh\n\n# usage: terraform-install.sh [-i VERSION] [-a] [-c] [-h] [-v]\n#      -i VERSION\t: specify version to install in format '' (OPTIONAL)\n#      -a\t\t: automatically use sudo to install to /usr/local/bin\n#      -c\t\t: leave binary in working directory (for CI/DevOps use)\n#      -h\t\t: help\n#      -v\t\t: display vault-install.sh version\n```\n\n## System Requirements\n\n- System with Bash Shell (Linux, macOS, Windows Subsystem for Linux)\n- `unzip` - terraform downloads are in zip format\n- `curl` or `wget` - script will use either one to retrieve metadata and download\n\nOptional\n\n- `jq` - if installed, latest version parsed from hashicorp downloads\n  - Useful if latest github release differs from version on hashicorp downloads\n  - Avoids github api limit of 60 requests per hour (unauthenticated)\n\n## Script Process Details\n\n- Determines Version to Download and Install\n  - Uses Version specified by `-i VERSION` parameter (if specified)\n  - Otherwise determines Latest Version\n    - If `jq` installed parse version from hashicorp downloads\n    - Otherwise use GitHub API to retrieve latest version\n- Calculates Download URL based on Version, OS and CPU-Architecture\n- Verifies URL Validity before Downloading in Case:\n  - VERSION incorrectly specified with `-i`\n  - Download URL Format Changed on terraform Website\n- Determines Install Destination\n  - The destination can be specified with `-c` option, or passing `TF_INSTALL_DIR` environment variable\n  - The default is `/usr/local/bin` if it is writable, or with `-a`\n  - Otherwise the user is prompted for options\n  - Performed before Download/Install Process in case user selects `abort`\n- Installation Process\n  - Download, Download SHA, Verify SHA of zip, Extract, Install, Cleanup and Display Results\n\n### CPU Architecture Detection\n\nCPU architecture is detected for each OS accordingly:\n\n- Linux / Windows (WSL since this is a Bash script)\n  - detected with `lscpu` or by inspecting `/proc/cpuinfo`\n  - Arm variants use `arm` as it's the only `arm` version available (for now)\n- macOS - uses Default Arch `amd64` as it's the only version available on macOS\n- Default Value - `amd64`\n\n## Disclaimer\n\nI am a HashiCorp employee, but this is a personal project and not officially endorsed or supported by HashiCorp.\n\n## License\n\nApache 2.0 License - Copyright (c) 2020    Robert Peteuil\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertpeteuil%2Fterraform-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertpeteuil%2Fterraform-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertpeteuil%2Fterraform-installer/lists"}