How to Write a Modern Terraform Provider: Tools and Patterns
summary
Explains concrete patterns and SDK v2 features for building real Terraform providers: use context-aware CRUD so operations cancel on Ctrl‑C, return a read function to represent partial creates, surface problems with Diagnostics (warnings vs errors and attribute paths), and run providers under delve debugging and the SDK acceptance testing framework. Recommends a thin provider + fat generated API client, single marshalling layer, reuse schemas like tags, mark optional+computed attributes, and generate docs from code to keep examples and versions correct.
AI-written summary · about
chapters (17)
- 0:00Introduction to Terraform providers
- 3:12What is Terraform explained
- 4:56Terraform provider ecosystem
- 6:41Modern provider tooling
- 9:46Context-aware CRUD functions
- 12:59Diagnostics for better errors
- 14:24Debugging Terraform providers
- 15:05Acceptance testing framework
- 16:10Marshalling resource data
- 17:12Read function for partial updates
- 19:02Optional and computed attributes
- 20:06Reusing common schemas
- 21:29Consistent resource structure
- 23:16API client design patterns
- 25:25Generating API clients
- 26:09Documentation best practices
- 27:56Automating releases with GoReleaser
related talks
26mEverything as Code with Terraform
23mWhen Infrastructure as Code Ends: Creating Terraform Providers
35mTerraform Practices - The Good, the Bad and the Ugly
41mTerraform Practices - The Good, the Bad, and the Ugly
49mLet's dive into Terraform provider creation
29mTerraform Practices - The Good, the Bad, and the Ugly
25mThe Path to Modern Infrastructure Automation
46mTerraform best practices with examples and arguments
