What bucket are you in? 🪣- "I have full complete access to creating Pub/Sub resources on GCP and know fully what I'm doing" 🎸
- "I have now gained access but am unsure if I'm following the right steps while creating resources" 🙈
- "I just slack/walk up to a 'senior' dev with access (preferably one that knows what they're doing too) and request them to create the resources for me" 🐣
So in best case🌈:Developers need to log into the console and provision the resources on staging + production
And in not-so-best case😖:Developers need to reach out to others with access and explain to them what needs to be created - somtimes even wait a bit with their requests
What's wrong with all this?- Features can take longer to build, especially running around for accesses- May/may not cause frustration among devs
- Could potentially lead to wrong configuration due to mis-comminucation / lack of "reviews"How do we fix this?🛠️dev with
accessdev with
requestraises a requestHey mate, could you please create xxx.xxx on staging + prod?Sure, Let me have a lookLooks good, let's create itThank you, senpai 🥷Automate as much as we can 🦾dev with
accessraises a requestSure, Let me have a looka GA workflow with a service account with correct accesses???Are we missing something?🚨"Umm, Shubham...All's great but...what do I write in the PR?"
Don't worry, I gotchu 🤗you just need a shot of
Going forward, we'll just create a terraform template for the resources we want in
anyfin-pubsubWhat !#@ fuck is terraform?Wiki: "Terraform is an infrastructure-as-code software tool created by HashiCorp. Users define and provide data center infrastructure using a declarative configuration language known as HCL"
Let's break this down...
Terraform is an IaC toolBasically, instead of performing actions on the GCP console, you write a bit of code and this tool handles the creation, updating and if needed, deletion of resources for you
It always stores the state of the latest resources in a state file (we put ours in cloud storage buckets) and everytime there's a change in the terraform code (which will happen through your PRs), it will compare against the state file, make required changes and update the state file
Users define infra using HCLHCL = HashiCorp Configuration Language
Basically a declarative config file (like JSON, YAML) but with a different syntax
Wanna see? 😉
DEMOIs this better than earlier? 📈- Tiny step towards creating a flatter engg org - the devs closest to the requirement have the power to fulfill it
- Develops a new skill amoung us - terraform is great to know these days
- Less prone to issues like misconfiguration
- Allows for an easy way to revert back to an older stable version
- Hopefully, provides a better DX at the end of it all
What's next? 🔮- Let's use it, get annoyed by it, and think of ways to improve it together
- Creating scripts (like yarn knex migrate) to generate preconfigured template files so devs have to spend less time copy-pasting config
Who should I go to to get help?🤝- Struggle (in a time-boxed manner) a little; you might crack it yourself 😉
- But if you feel out of your depth, do reach out🤗
Questions? 🙋Yours truly,
Shubham 🥰