Terrakube can be installed in minikube as a sandbox environment with HTTPS, using terrakube with HTTPS will allow to use the Terraform registry and the Terraform remote state backend to be used locally without any issue.
Please follow these instructions:
Requirements:
Install mkcert to generate the local certificates.
We will be using following domains in our test installation:
mkcert -install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊
Local CA certificate path
mkcert -CAROOT
/home/myuser/.local/share/mkcert
Local CA certificate content
cat /home/myuser/.local/share/mkcert/rootCA.pem
Generate certificate for *.minikube.net
These command will generate two files key.pem and cert.pem that we will be using later.
mkcert -key-file key.pem -cert-file cert.pem minikube.net *.minikube.net
Created a new certificate valid for the following names 📜
- "minikube.net"
- "*.minikube.net"
Reminder: X.509 wildcards only go one level deep, so this won't match a.b.minikube.net ℹ️
The certificate is at "cert.pem" and the key at "key.pem" ✅
It will expire on 19 January 2026 🗓
Now we have all the necessary to install Terrakube with HTTPS
If you found the following message "Snippet directives are disabled by the Ingress administrator", please update the ingres-nginx-controller configMap in namespace ingress-nginx adding the following:
The environment has some users, groups and sample data so you can test it quickly.
Visit https://terrakube-ui.minikube.net and login using admin@example.com with password admin
We should be able to use the UI using a valid certificate.
Connect to Terrakube
Using terraform we can connect to the terrakube api and the private registry using the following command with the same credentials that we used to login to the UI.
$terraforminitInitializingTerraformCloud...Noworkspacesfound.Therearenoworkspaceswiththeconfiguredtags (example, myplayground) in your Terraform Cloud organization. To finish initializing, Terraform needs atleastoneworkspaceavailable.Terraformcancreateaproperlytaggedworkspaceforyounow.PleaseenteranametocreateanewTerraformCloudworkspace.Enteravalue:simpleInitializingproviderplugins...-Findinglatestversionofhashicorp/null...-Findinglatestversionofhashicorp/time...-Installinghashicorp/nullv3.2.1...-Installedhashicorp/nullv3.2.1 (signed byHashiCorp)-Installinghashicorp/timev0.9.1...-Installedhashicorp/timev0.9.1 (signed byHashiCorp)Terraformhascreatedalockfile.terraform.lock.hcltorecordtheproviderselectionsitmadeabove.IncludethisfileinyourversioncontrolrepositorysothatTerraformcanguaranteetomakethesameselectionsbydefaultwhenyourun"terraform init"inthefuture.
Terraform apply:
$terraformapplyRunningapplyinTerraformCloud.Outputwillstreamhere.PressingCtrl-Cwillcanceltheremoteapplyifit's still pending. If the apply started itwill stop streaming the logs, but will not stop the apply running remotely.Preparing the remote apply...To view this run in a browser, visit:https://terrakube-api.minikube.net/app/simple/simple/runs/40Waiting for the plan to start...***************************************Running Terraform PLAN***************************************Terraform used the selected providers to generate the following executionplan. Resource actions are indicated with the following symbols: + createTerraform will perform the following actions: # null_resource.next will be created + resource "null_resource" "next" { + id = (known after apply) } # null_resource.previous will be created + resource "null_resource" "previous" { + id = (known after apply) } # time_sleep.wait_5_seconds will be created + resource "time_sleep" "wait_5_seconds" { + create_duration = "5s" + id = (known after apply) }Plan: 3 to add, 0 to change, 0 to destroy.Changes to Outputs: + creation_time = "5s"Do you want to perform these actions in workspace "simple"? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yesnull_resource.previous: Creating...null_resource.previous: Creation complete after 0s [id=6182221597368620892]time_sleep.wait_5_seconds: Creating...time_sleep.wait_5_seconds: Creation complete after 5s [id=2023-10-19T20:25:22Z]null_resource.next: Creating...null_resource.next: Creation complete after 0s [id=9093191930998774410]Apply complete! Resources: 3 added, 0 changed, 0 destroyed.