The last fika โšฐ๏ธ

Provision resources with code

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
access
dev with
request
raises a request
Hey mate, could you please create xxx.xxx on staging + prod?
Sure, Let me have a look
Looks good, let's create it
Thank you, senpai ๐Ÿฅท
Automate as much as we can ๐Ÿฆพ
dev with
access
raises a request
Sure, Let me have a look
a 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-pubsub
What !#@ 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 tool

Basically, 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 HCL

HCL = HashiCorp Configuration Language

Basically a declarative config file (like JSON, YAML) but with a different syntax

Wanna see? ๐Ÿ˜‰

DEMO
Is 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 ๐Ÿฅฐ

The last fika

By Shubham Zanwar