OpsCanary
Back to daily brief
terraformprovidersFoundational

Mastering Terraform Naming Conventions for Providers

5 min read HashiCorp DocsApr 23, 2026
FoundationalCore concept — relevant whether you're new or experienced

Naming conventions in Terraform exist to create a clear and consistent structure that enhances readability and maintainability of your infrastructure as code. When you follow these conventions, you reduce the cognitive load for anyone who needs to work with your Terraform configurations. This is especially important in team environments where multiple engineers might interact with the same codebase.

Resource names must always start with their containing provider's name followed by an underscore. For example, a PostgreSQL database resource would be named postgresql_database. Data source names should also be nouns, and in cases where they return lists, they can be plural, such as aws_availability_zones. Function names, on the other hand, should be verbs and must not include the provider name, like parse_rfc3339. Additionally, attribute names should be all lowercase with underscores separating words, ensuring uniformity across your configurations. Write-only argument names should use a _wo suffix to differentiate them from non-write-only arguments, which helps clarify their purpose.

In production, adhering to these naming conventions can significantly reduce misunderstandings and errors. It’s common to see teams struggle with inconsistent naming, leading to confusion during deployments or when debugging issues. Pay attention to the nuances, like the importance of boolean attributes being oriented so that true means to do something and false means not to do it. This clarity can save you time and headaches down the line.

Key takeaways

  • Start resource names with the provider's name followed by an underscore.
  • Use nouns for data source names, and consider plural forms when returning lists.
  • Name functions as verbs without including the provider name.
  • Keep attribute names all lowercase with underscores separating words.
  • Differentiate write-only arguments with a _wo suffix.

Why it matters

In production, clear naming conventions prevent confusion and streamline collaboration among team members, ultimately leading to more efficient infrastructure management.

Code examples

mdx-inline-code
postgresql_database
mdx-inline-code
aws_availability_zones
mdx-inline-code
parse_rfc3339

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.