github.com/leg100/ots@v0.0.7-0.20210919080622-034055ced4bd/README.md (about) 1 # OTS: Open Terraforming Server 2 3 A prototype open source alternative to terraform enterprise. 4 5 Functionality is currently limited: 6 7 * State backend (state stored in a sqlite database) 8 * Workspace management (supports `terraform workspace` commands) 9 * Local execution mode (plans and applies run locally) 10 11 ## Getting Started 12 13 These steps will get you started with running everything on your local system. You'll setup the server, configure SSL so that terraform trusts the server, and then configure terraform. You'll then be able to run terraform commands using the server as a remote backend. 14 15 ![demo](https://user-images.githubusercontent.com/75728/122782051-49d58200-d2a8-11eb-93d4-87ba353033e1.gif) 16 17 1. Download a [release](https://github.com/leg100/ots/releases). The zip file contains two binaries: a daemon and a client, `otsd` and `ots`. Extract them to a directory in your `PATH`, e.g. `/usr/local/bin`. 18 1. Generate SSL cert and key. For example, to generate a self-signed cert and key for localhost: 19 20 ```bash 21 openssl req -x509 -newkey rsa:4096 -sha256 -keyout key.pem -out cert.crt -days 365 -nodes -subj '/CN=localhost' -addext 'subjectAltName=DNS:localhost' 22 ``` 23 24 1. Ensure your system trusts the generated cert. For example, on Linux: 25 26 ```bash 27 sudo cp cert.crt /usr/local/share/ca-certificates 28 sudo update-ca-certificates 29 ``` 30 31 1. Run the OTS daemon: 32 33 ```bash 34 otsd --ssl --cert-file=cert.crt --key-file=key.pem 35 ``` 36 37 The daemon runs in the foreground and can be left to run. 38 39 1. In another terminal, login to your OTS server (this merely adds some dummy credentials to `~/.terraform.d/credentials.tfrc.json`): 40 41 ```bash 42 ots login 43 ``` 44 45 1. Create an organization: 46 47 ```bash 48 ots organizations new mycorp --email=sysadmin@mycorp.co 49 ``` 50 51 1. Configure the terraform backend and define a resource: 52 53 ```bash 54 cat > main.tf <<EOF 55 terraform { 56 backend "remote" { 57 hostname = "localhost:8080" 58 organization = "mycorp" 59 60 workspaces { 61 name = "dev" 62 } 63 } 64 } 65 66 resource "null_resource" "e2e" {} 67 EOF 68 ``` 69 70 1. Run terraform!: 71 72 ```bash 73 terraform init 74 terraform plan 75 terraform apply 76 ``` 77 78 ## Next Steps 79 80 OTS is a mere prototype but a roadmap of further features could be: 81 82 * User AuthN/Z 83 * Remote execution mode 84 * Agents 85 * Github integration 86 * Policies (OPA?) 87 * Web frontend 88 89 ## Building 90 91 You'll need [Go](https://golang.org/doc/install) installed. 92 93 Clone the repo, and then build and install the binary using the make task: 94 95 ```bash 96 git clone https://github.com/leg100/ots 97 cd ots 98 make install 99 ``` 100 101 That'll create a binary inside your go bins directory (defaults to `$HOME/go/bin`). 102