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

Pengalaman VBAC : Tips dan Informasi

Anak pertama saya dilahirkan dengan metode sectio caesaria (SC). Waktu itu, pada usia 37 minggu akhir kami kontrol ke dokter kandungan dan dinyatakan bahwa air ketuban keruh, sehingga diperlukan tindakan operasi SC. Saat itu juga dicoba induksi, diharapkan dapat menstimulasi terjadinya kelahiran spontan. Namun, hingga batas waktu yang disepakati, belum ada perkembangan berarti. Selain itu, perlu diketahui bahwa saya kurang tau pasti detail kenapa air ketuban saat itu keruh, padahal awal minggu ke 37 masih sangat baik kondisinya. ...

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