https://github.com/eitansuez/terraform-tsb-local-k8s
https://github.com/eitansuez/terraform-tsb-local-k8s
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eitansuez/terraform-tsb-local-k8s
- Owner: eitansuez
- Created: 2023-06-13T19:19:51.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-19T15:05:32.000Z (about 3 years ago)
- Last Synced: 2025-02-26T01:27:11.832Z (over 1 year ago)
- Language: HCL
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
This repository is about bootstrapping [tsb-local-k8s](https://github.com/boeboe/tetrate-service-bridge-minikube) with terraform.
The idea is to provision a TSB training environment. `tsb-local-k8s` can do this with a single VM. This terraform script provisions and configures that VM on GCP.
## Prerequisites
- Install the terraform CLI
- For TSB image sync'ing, you should have your image sync username and API key ready.
- A GCP account and a target GCP project with a service account key
## Steps
Create a `terraform.tfvars` file and in it, specify your gcp project name, service account key json file name, and your TSB image sync credentials.
```terraform
gcp_project_name = "my-gcp-project"
credentials_filename = "~/.ssh/my-service-account-key.json"
tsb_image_sync_username = "john-doe"
tsb_image_sync_apikey = "0123456789abcedf0123456789abcdef01234567"
```
Initialize terraform:
```shell
terraform init
```
Apply the terraform:
```shell
terraform apply
```
You can either use the `gcloud` CLI to ssh to the VM using the `ubuntu` user.
```shell
gcloud compute ssh ubuntu@tsb-vm
```
Alternatively, an ssh key pair is created as part of the provisioning process. You will find the script `ssh-to-gcp-vm.sh` in the `output/` subdirectory.
```shell
cd output
./ssh-to-gcp-vm.sh
```
Configuration of the VM is performed with [cloud-init](https://cloudinit.readthedocs.io/), which is asynchronous. Wait a couple of minutes for that process to complete.
On the VM, you can check the status of cloud-init with `cloud-init status` and by tailing the cloud-init output logs at `/var/log/cloud-init-output.log`.
Once on the VM, navigate to the `tsb-local` subdirectory.
```shell
cd tsb-local
```
The remaining time-consuming steps for provisioning TSB are left up to you:
```shell
./repo.sh sync
```
And:
```shell
make up
```