Bootstrapping ArgoCD With Terraform

Overview Kubernetes has lot of flexibility and features. But, in order to make use of it to the full potential, it requires us to install some essentials tools in it. One of the example of the most used tools in industry right now is ArgoCD. ArgoCD allows us to manage the applications inside the Kubernetes cluster. This post written to help you on how to bootstrapping the Kubernetes cluster. What is Bootstrapping? Bootstrapping is to make your system ready by ensuring it loads your essential components In Kubernetes, we have options to bootstrap the cluster with several examples: Having ingress controller, prometheus operator, and telemetry collector Having applications management / delivery tools installed like ArgoCD or FluxCD In this case we want to bootstrap ArgoCD to the cluster, so that for all the remaining components can be managed using Application or ApplicationSet in ArgoCD Why Bootstrapping? Bootstrapping will only contains the minimum essentials tools get installed This will make the cluster management less painful We can manage the essentials tools altogether with cluster provisioning definition We can separate the other essentials tools management into different layer (for ArgoCD, using Application or ApplicationSet) How to Bootstrapping Kubernetes Cluster? Terraform widely known tools to provisioning Kubernetes cluster It has Helm provider support Helm chart is versioned and more easier than dealing with plain manifests (especially if we have it already in artifacthub, haha) We can leverage Terraform and Helm to bootstrap the cluster So we can manage the cluster provisioning (using whatever your cloud platform is), and manage the essentials components (in this case ArgoCD) See below Terraform snippet to bootstrapping the ArgoCD with the cluster. The snippet assuming that the kubeconfig is there locally. So if you want to have it together with your cluster definition, you might need to adjust the kubernetes and helm provider in order to authenticate to the cluster. ...

February 27, 2024 · 4 min · 831 words · Me

Use Terraform to Deploy Hugo to Vercel

Overview As I mentioned in previous post, Terraform has Vercel provider. With this, we can configure our Vercel project through Terraform. This post will show you how to do that. Before that, here is some reasons on using Terraform to deploy Vercel. Vercel has web UI and CLI. Web UI requires me navigate through the web interface. I’m not a fan of it, not efficient CLI is relatively simple. It requires me to install the CLI tools. I want to avoid this to reduce packages bloat in my device. Terraform provide you state for each resources. So the actual resources aligned with what we define. I already use Terraform in other projects. So this will reduce the overhead to maintain different stacks. Deploying to Vercel with Terraform Ensure we have the Vercel API token created Create new main.tf with following: terraform { required_providers { vercel = { source = "vercel/vercel" version = "1.1.0" } } } locals { personal_site_envs = { HUGO_VERSION = { value = "0.123.2" target = [ "development", "preview", "production" ] } HUGO_ENV = { value = "production" target = [ "development", "preview", "production" ] } } } resource "vercel_project" "personal_site" { name = "personal-site" framework = "hugo" install_command = "yum install -y golang" git_repository = { production_branch = "master" type = "github" repo = "<username>/<hugo_repo>" } vercel_authentication = { deployment_type = "none" } } resource "vercel_project_environment_variable" "personal_site" { for_each = local.personal_site_envs project_id = vercel_project.personal_site.id key = each.key value = each.value.value target = each.value.target } resource "vercel_project_domain" "personal_site" { for_each = local.personal_site_domains project_id = vercel_project.personal_site.id domain = each.key } In the current directory, run the following: export VERCEL_API_TOKEN=<INSERT_YOUR_API_TOKEN> terraform init terraform plan Check the plan output If the plan looks good, apply the changes with terraform apply If everything works well, the project will be created and configured automatically by Terraform definition above. You might need to make dummy changes to the repo to trigger the build or trigger it manually from the UI. ...

February 26, 2024 · 2 min · 379 words · Me

Deploy Hugo to Vercel

Overview Hugo is one of popular static site generator out there. There are some options to deploy Hugo such as manually using VM, netlify, or using Vercel. This post will give you information on how to deploy Hugo to Vercel. Hugo requires theme and layouts to be able to work. There are some ways to use install a theme and most of the common way are using git submodule. Why Vercel? My Hugo site was deployed using Netlify and everything is running well. But, I have some other projects that needs to be managed. While Netlify is good, we don’t have IaC provider for it. I checked for other options and found out Vercel has Terraform provider support! Just like Netlify, we also has Free options in Vercel, so thats another good thing to have! ...

February 26, 2024 · 3 min · 492 words · Me

Kenapa Saya Memilih Arch Linux untuk Workstation?

Linux adalah salah satu sistem operasi yang banyak dikenal oleh pengguna komputer selain Microsoft Windows dan Apple MacOS. Terlebih saat ini sudah tersedia banyak pilihan distribusi linux yang dikembangkan, bahkan ada yang dikembangkan oleh perusahaan seperti Ubuntu oleh Canonical, Red Hat Enterprise Linux oleh Red Hat, SUSE Linux Enterprise oleh SUSE. Lalu sebagai seorang pengembang aplikasi, distribusi apa yang saya pilih untuk workstation saya? Arch Linux! Kenapa? Simak lebih lanjut. ...

July 24, 2020 · 3 min · 610 words · Me

Pengalaman VBAC : Cerita Kami di Tiga Minggu Terakhir

Memasuki minggu ke 38 awal, belum ada perkembangan berarti. Sehingga istri saat itu ingin coba kontrol ke dokter lain yang bukan partner saat itu. Alangkah kecewanya dan geram saya saat itu ketika memasuki ruangan, kami hanya ditanya berapa jarak kehamilan dengan operasi SC terakhir. Lalu, tanpa penjelasan apapun langsung berkata kurang lebih seperti ini “SC lagi ya, jam 10 saya kosong, mau ga? Atau kalau ga mau hari ini ya hari Selasa” (kami di dokter tersebut sekitar jam 07:00 WIB). Gila saja, sontak saya langsung bilang, tidak usah. Dan balasan yang saya terima adalah “Kenapa ga mau SC? Kan yang penting mah keluar anaknya sehat, hari ini mah jam 10 periksa, besoknya udah bisa lihat bayinya”. Tanpa pikir panjang, kami keluar dan mengabaikan dokter tersebut. ...

July 24, 2020 · 4 min · 748 words · Me