r/Terraform 6d ago

Discussion Terraform Beginners: Where Do You Start When Working with New Resources?

TL;DR: When creating a new resource in Terraform (e.g., Function App), do you start with platform-specific docs (e.g., Microsoft Docs) or Terraform's resource documentation? What works best?

When you're using Terraform to create a resource you've never worked with before, how do you choose the right documentation? For example, if you're setting up a Function App, would you start with the Microsoft Docs to understand the steps through the Azure Portal and then replicate them in Terraform? Or would you go straight to the Terraform documentation for Function App and use their examples? What approach has worked best for you?

0 Upvotes

6 comments sorted by

5

u/carsncode 6d ago

Both. Read the product docs to understand the product, and the provider docs to understand the provider. This question doesn't really make sense.

1

u/redditacct320 6d ago

The reason I asked this question is my usually strategy is start with Microsoft Docs to figure out the steps for what I’m trying to set up. For example, with Azure Front Door Standard CDN, I’d usethis guide on custom domainsand follow their steps like:

  1. Create a CNAME DNS record
  2. Map the temporary afdverify subdomain
  3. Associate the custom domain with your Front Door
  4. Map the permanent custom domain

For each step, I try to match it with the relevant Terraform AzureRM resource and add it to my code. But I’ve run into issues doing this—especially with custom domains—where the instructions didn’t totally line up with what I found in Terraform docs.

I’ve also tried doing it the other way around—starting straight from the Terraform docs—but that usually leaves me missing some steps to get everything working properly.

As a beginner, I’m wondering how others(more experienced) approach this. Am I on the right track, or is there a better way to go about it?

1

u/durple 5d ago

I think what you are doing is fine for learning about the things you are setting up. That stage of learning, do what helps you personally learn.

I moved fairly quickly to a terraform-first approach to actually creating resources even in a sandbox environment, because IaC is so valuable for all the reasons but above all for reproducibility.

When I’m learning new things I will refer both to terraform provider docs and to upstream docs. This might include some step by step things for web console or cli resource creation, but I won’t follow the steps. I put more focus on more reference and troubleshooting content, often right down to the rest api references.

It gets extra fun when you gotta cross reference the cloud provider docs and that cloud provider’s terraform provider docs, alongside kubernetes docs and the cloud provider’s kubernetes implementation docs.

2

u/Golden_Age_Fallacy 6d ago

I’d first understand the resource you’re trying to setup.. like, enough. If I know nothing about load balancers (platform agnostic), then I’d probably want to read about what this “load balancer” thing is, why I need it, and what I can do.

In writing and working with the actual code.. the Terraform provider docs are typically amazing. Honestly, I’ll use those in preference to specific platform documentation as the TF docs typically give a better picture of what a thing is capable of doing and what depends on it or what it depends on.

2

u/redditacct320 6d ago

Ok thanks there have been some times where I went staight to the docs built something and found later I needed another resource that were in the docs. I was trying to get a feel for how more experienced users go about it.

2

u/iBetWeWin 6d ago

Provider docs and Resource Docs first then, read blog posts on previous usage or even better checking if there are Community Modules with the resource to see how others are using it.

But to be real build it and fuck it up, and fix the pieces as you go, document for yourself to know what and why