feat: add standard Terraform files guide - #64
Conversation
- Detailed explanation of core files: main.tf, variables.tf, outputs.tf, data.tf - Coverage of supporting files: providers.tf, versions.tf, .terraform.lock.hcl - Advanced patterns including checks.tf, imports.tf, and context.tf - Best practices for locals placement and file organization - Guidance on avoiding "terralith" anti-patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for masterpoint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughA new blog post, "The Standard Terraform and OpenTofu Files + Their Uses" by Matt Gowie, was added describing the roles and recommended contents of standard Terraform/OpenTofu files, organization patterns, advanced usage, and examples for maintainable Infrastructure as Code. (≈29 words) Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
content/blog/standard-terraform-files-their-uses.md (2)
11-15: Strengthen word choice and clarity.
Replace “completely different” with “entirely different” and consider using “comprise” instead of “make up” to elevate the prose.- you've definitely seen this problem: everyone organizes their TF files differently. Some teams jam everything into a single main.tf file, while others scatter resources across dozens of specialized files. This isn't just an aesthetic issue — it creates real headaches when you're trying to understand or fix infrastructure code. + you've definitely seen this problem: everyone organizes their TF files differently. Some teams jam everything into a single main.tf file, while others scatter resources across dozens of specialized files. This isn't just an aesthetic issue — it creates real headaches when you're trying to understand or fix infrastructure code. ... - different contributors frequently follow completely different organizational patterns, creating a confusing patchwork that slows everyone down. + different contributors frequently follow entirely different organizational patterns, creating a confusing patchwork that slows everyone down. ... - When the files that make up a TF project have standard names, locations and meanings, you know exactly where to look when something needs changing. + When the files that comprise a TF project have standard names, locations, and meanings, you know exactly where to look when something needs changing.🧰 Tools
🪛 LanguageTool
[style] ~13-~13: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...(COMPLETELY_ENTIRELY)
[style] ~15-~15: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...(CONSTITUTE_COMPRISE)
23-23: Fix comma usage and spacing.
Add a comma before “but” and a space after the closing parenthesis for readability.- (it doesn't technically need to be named main.tf but that is the industry convention).This file + (it doesn't technically need to be named main.tf, but that is the industry convention). This file🧰 Tools
🪛 LanguageTool
[uncategorized] ~23-~23: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...(COMMA_COMPOUND_SENTENCE_2)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/blog/standard-terraform-files-their-uses.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/blog/standard-terraform-files-their-uses.md
[style] ~13-~13: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...
(COMPLETELY_ENTIRELY)
[style] ~15-~15: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...
(CONSTITUTE_COMPRISE)
[uncategorized] ~23-~23: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...
(COMMA_COMPOUND_SENTENCE_2)
[uncategorized] ~110-~110: Possible missing comma found.
Context: ...llows consumers to upgrade on their own timeline rather than having their infrastructure...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~142-~142: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...
(EN_WEAK_ADJECTIVE)
[grammar] ~146-~146: Do not use the singular ‘an’ before the plural noun ‘checks’.
Context: ...ndards-driven TF project often includes an optional checks.tf file that centralizes your validatio...
(VB_A_JJ_NNS)
[misspelling] ~169-~169: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...that root module. Here's an example of a imports.tf file: ```hcl # Example in i...
(EN_A_VS_AN)
[grammar] ~184-~184: Do not use the singular ‘a’ before the plural noun ‘imports’.
Context: ...The IAM role's name in AWS } ``` Using a distinct imports.tf file immediately clarifies which par...
(VB_A_JJ_NNS)
[uncategorized] ~244-~244: Possible missing comma found.
Context: ...configuration runs with a compatible TF version and fails if none are available. This p...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~253-~253: Possible missing comma found.
Context: ...operator allows patch and minor version updates while preventing major version changes ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~257-~257: Possible missing comma found.
Context: ...cross environments. Unlike the previous files which you create manually, TF automatic...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~282-~282: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...
(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[grammar] ~284-~284: The verb ‘terraform’ does not usually follow articles like ‘the’. Check that ‘terraform’ is spelled correctly; using ‘terraform’ as a noun may be non-standard.
Context: ... to update providers to newer versions, the terraform init -upgrade command will refresh the ...
(A_INFINITIVE)
[typographical] ~300-~300: Consider adding a comma after ‘technically’ for more clarity.
Context: ...y assigning names to expressions. While technically you can place locals anywhere, followin...
(RB_LY_COMMA)
[uncategorized] ~391-~391: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...
(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~391-~391: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...
(VERB_NOUN_CONFUSION)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - masterpoint
- GitHub Check: Header rules - masterpoint
- GitHub Check: Pages changed - masterpoint
🔇 Additional comments (3)
content/blog/standard-terraform-files-their-uses.md (3)
1-9: Ensure frontmatter aligns with other posts.
Check that the YAML frontmatter includes all required fields (e.g.,tags,categories) to match existing blog templates, and verify that theimagepath exists and follows naming conventions.Please confirm that this frontmatter matches the site’s standard metadata template and that
/img/updates/terraform-files-organization.pngis present in the repo.
29-30: Verify internal links.
Ensure that all internal links (e.g.,/blog/terralith-monolithic-terraform-architecture/,/blog/terraform-null-label/,/blog/terraform-null-label-advanced/,/contact/) are valid and resolve correctly on the live site.You can run a link checker against the built site or manually confirm each target exists.
33-46: Confirm HCL code block syntax.
The Terraform examples should consistently use ```hcl fences and be properly closed. These code blocks look well-formed.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
content/blog/standard-tf-files.md (4)
12-15: Refine adverb usageConsider replacing “completely” in “creating a confusing patchwork” with a stronger alternative like “entirely” or “wholly” to avoid redundancy.
🧰 Tools
🪛 LanguageTool
[style] ~14-~14: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...(COMPLETELY_ENTIRELY)
24-24: Punctuation fixesAdd a comma before “but” in “named main.tf, but” and insert a space after the closing parenthesis so it reads “…convention). This file defines…”
🧰 Tools
🪛 LanguageTool
[uncategorized] ~24-~24: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...(COMMA_COMPOUND_SENTENCE_2)
128-141: Reduce intensifierConsider removing “very” in “very simple cases” to strengthen the guidance.
391-393: Fix minor punctuationHyphenate “follow up advanced post” to “follow-up advanced post” and consider adding a comma before “and we’d encourage you” for clarity.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~392-~392: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~392-~392: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...(VERB_NOUN_CONFUSION)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
static/img/updates/standard-tf-files.pngis excluded by!**/*.png
📒 Files selected for processing (1)
content/blog/standard-tf-files.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/blog/standard-tf-files.md
[style] ~14-~14: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...
(COMPLETELY_ENTIRELY)
[style] ~16-~16: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...
(CONSTITUTE_COMPRISE)
[uncategorized] ~24-~24: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...
(COMMA_COMPOUND_SENTENCE_2)
[uncategorized] ~111-~111: Possible missing comma found.
Context: ...llows consumers to upgrade on their own timeline rather than having their infrastructure...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~143-~143: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...
(EN_WEAK_ADJECTIVE)
[grammar] ~147-~147: Do not use the singular ‘an’ before the plural noun ‘checks’.
Context: ...ndards-driven TF project often includes an optional checks.tf file that centralizes your validatio...
(VB_A_JJ_NNS)
[misspelling] ~170-~170: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...that root module. Here's an example of a imports.tf file: ```hcl # Example in i...
(EN_A_VS_AN)
[grammar] ~185-~185: Do not use the singular ‘a’ before the plural noun ‘imports’.
Context: ...The IAM role's name in AWS } ``` Using a distinct imports.tf file immediately clarifies which par...
(VB_A_JJ_NNS)
[uncategorized] ~245-~245: Possible missing comma found.
Context: ...configuration runs with a compatible TF version and fails if none are available. This p...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~254-~254: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...ning principles. The ~> operator allows patch and minor version updates while prevent...
(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
[uncategorized] ~254-~254: Possible missing comma found.
Context: ...operator allows patch and minor version updates while preventing major version changes ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~258-~258: Possible missing comma found.
Context: ...cross environments. Unlike the previous files which you create manually, TF automatic...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~283-~283: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...
(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[grammar] ~285-~285: The verb ‘terraform’ does not usually follow articles like ‘the’. Check that ‘terraform’ is spelled correctly; using ‘terraform’ as a noun may be non-standard.
Context: ... to update providers to newer versions, the terraform init -upgrade command will refresh the ...
(A_INFINITIVE)
[typographical] ~301-~301: Consider adding a comma after ‘technically’ for more clarity.
Context: ...y assigning names to expressions. While technically you can place locals anywhere, followin...
(RB_LY_COMMA)
[uncategorized] ~392-~392: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...
(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~392-~392: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...
(VERB_NOUN_CONFUSION)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - masterpoint
- GitHub Check: Header rules - masterpoint
- GitHub Check: Pages changed - masterpoint
🔇 Additional comments (14)
content/blog/standard-tf-files.md (14)
1-10: Frontmatter Validity CheckThe YAML frontmatter is well-formed and contains all required fields for the new blog post.
30-31: Confirm internal linkPlease verify that the referenced post
/blog/terralith-monolithic-terraform-architecture/exists and the URL is correct.
61-74: Variables.tf example is clearThe HCL snippet correctly demonstrates declaring variables with descriptions, types, defaults, and validation rules.
91-104: Outputs.tf snippet is accurateThe example shows descriptive output blocks with clear naming conventions and helpful descriptions.
154-160: Checks.tf example is soundThe HCL snippet accurately demonstrates resource-level validation using Terraform’s
checkblocks.
172-183: Imports.tf example is clearThe import block examples correctly illustrate how to declare imports in Terraform v1.5+.
197-210: Providers.tf example is correctThe HCL fragment properly shows provider configurations, including aliased providers for multi‐region setups.
229-241: Versions.tf snippet is accurateThe example correctly demonstrates specifying Terraform and provider version constraints using semantic versioning.
263-275: Lock file example is validThe
.terraform.lock.hclsnippet properly shows provider blocks with version constraints and cryptographic hashes.
289-291: Multi-platform lock command is correctThe bash snippet for
terraform providers lockacross multiple platforms is accurate and clear.
308-316: Locals usage example is appropriateThe
localsblock snippet cleanly demonstrates deriving and grouping computed values.
330-336: Directory structure example is clearThe tree layout succinctly illustrates when and how to split
.tffiles by logical component.
353-363: Context.tf example is well-formattedThe snippet effectively shows using the null-label module for standardized metadata and tagging.
371-381: Context pattern usage is accurateThe HCL fragment demonstrates how provider-level default tags combine with
module.this.tags.
…files guide - Fixed inconsistent indentation in all HCL code snippets - Properly aligned arguments in variable, output, and resource blocks - Improved readability of for expressions and validation blocks - All code examples now follow consistent Terraform formatting standards
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
content/blog/standard-tf-files.md (4)
25-26: Add missing comma and space in parentheses.Add a comma before
butinside the parenthetical and ensure a space follows the closing parenthesis:-Every TF project needs a main file (it doesn't technically need to be named main.tf but that is the industry convention).This main file defines... +Every TF project needs a main file (it doesn't technically need to be named main.tf, but that is the industry convention). This main file defines...🧰 Tools
🪛 LanguageTool
[uncategorized] ~25-~25: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...(COMMA_COMPOUND_SENTENCE_2)
170-178: Use 'an' before 'imports.tf' for vowel sound.Since
imports.tf filebegins with a vowel sound, change the article fromatoan:-Using a imports.tf file +Using an imports.tf file🧰 Tools
🪛 LanguageTool
[misspelling] ~174-~174: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...that root module. Here's an example of a imports.tf file: ```hcl # Example in i...(EN_A_VS_AN)
285-289: Wrap CLI command in backticks and adjust article.For consistency and clarity, format the Terraform command in backticks and remove the extraneous article:
-…to update providers to newer versions, the terraform init -upgrade command will refresh… +…to update providers to newer versions, `terraform init -upgrade` will refresh…🧰 Tools
🪛 LanguageTool
[style] ~287-~287: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[grammar] ~289-~289: The verb ‘terraform’ does not usually follow articles like ‘the’. Check that ‘terraform’ is spelled correctly; using ‘terraform’ as a noun may be non-standard.
Context: ... to update providers to newer versions, the terraform init -upgrade command will refresh the ...(A_INFINITIVE)
396-400: Hyphenate 'follow-up' and add comma before 'and'.Update the phrase to use a hyphen and include a comma for compound sentence correctness:
-](/blog/terraform-null-label/) and [read more about utilizing context.tf in our follow up advanced post… +](/blog/terraform-null-label/), and [read more about utilizing context.tf in our follow-up advanced post…🧰 Tools
🪛 LanguageTool
[uncategorized] ~399-~399: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~399-~399: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...(VERB_NOUN_CONFUSION)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/blog/standard-tf-files.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
content/blog/standard-tf-files.md
[style] ~15-~15: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...
(COMPLETELY_ENTIRELY)
[style] ~17-~17: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...
(CONSTITUTE_COMPRISE)
[uncategorized] ~25-~25: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...
(COMMA_COMPOUND_SENTENCE_2)
[uncategorized] ~112-~112: Possible missing comma found.
Context: ...llows consumers to upgrade on their own timeline rather than having their infrastructure...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~144-~144: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...
(EN_WEAK_ADJECTIVE)
[grammar] ~148-~148: Do not use the singular ‘an’ before the plural noun ‘checks’.
Context: ...ndards-driven TF project often includes an optional checks.tf file that centralizes your validatio...
(VB_A_JJ_NNS)
[misspelling] ~174-~174: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...that root module. Here's an example of a imports.tf file: ```hcl # Example in i...
(EN_A_VS_AN)
[grammar] ~189-~189: Do not use the singular ‘a’ before the plural noun ‘imports’.
Context: ...The IAM role's name in AWS } ``` Using a distinct imports.tf file immediately clarifies which par...
(VB_A_JJ_NNS)
[uncategorized] ~249-~249: Possible missing comma found.
Context: ...configuration runs with a compatible TF version and fails if none are available. This p...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~258-~258: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...ning principles. The ~> operator allows patch and minor version updates while prevent...
(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
[uncategorized] ~258-~258: Possible missing comma found.
Context: ...operator allows patch and minor version updates while preventing major version changes ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~262-~262: Possible missing comma found.
Context: ...cross environments. Unlike the previous files which you create manually, TF automatic...
(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~287-~287: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...
(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[grammar] ~289-~289: The verb ‘terraform’ does not usually follow articles like ‘the’. Check that ‘terraform’ is spelled correctly; using ‘terraform’ as a noun may be non-standard.
Context: ... to update providers to newer versions, the terraform init -upgrade command will refresh the ...
(A_INFINITIVE)
[typographical] ~305-~305: Consider adding a comma after ‘technically’ for more clarity.
Context: ...y assigning names to expressions. While technically you can place locals anywhere, followin...
(RB_LY_COMMA)
[uncategorized] ~399-~399: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...
(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~399-~399: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...
(VERB_NOUN_CONFUSION)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - masterpoint
- GitHub Check: Header rules - masterpoint
- GitHub Check: Pages changed - masterpoint
🔇 Additional comments (2)
content/blog/standard-tf-files.md (2)
1-11: Verify front matter compliance with blog schema.Ensure that all required front matter fields (
visible,draft,title,author,slug,date, etc.) adhere to the site's schema and formatting rules, and that the HTML in thecalloutrenders correctly.
10-414: Verify internal and external link validity.Please ensure that every internal reference (e.g.,
/blog/terralith-monolithic-terraform-architecture/,/contact/) and external URL resolves correctly without broken links.🧰 Tools
🪛 LanguageTool
[style] ~15-~15: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...(COMPLETELY_ENTIRELY)
[style] ~17-~17: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...(CONSTITUTE_COMPRISE)
[uncategorized] ~25-~25: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...n't technically need to be named main.tf but that is the industry convention).This f...(COMMA_COMPOUND_SENTENCE_2)
[uncategorized] ~112-~112: Possible missing comma found.
Context: ...llows consumers to upgrade on their own timeline rather than having their infrastructure...(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~144-~144: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...(EN_WEAK_ADJECTIVE)
[grammar] ~148-~148: Do not use the singular ‘an’ before the plural noun ‘checks’.
Context: ...ndards-driven TF project often includes an optional checks.tf file that centralizes your validatio...(VB_A_JJ_NNS)
[misspelling] ~174-~174: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...that root module. Here's an example of a imports.tf file: ```hcl # Example in i...(EN_A_VS_AN)
[grammar] ~189-~189: Do not use the singular ‘a’ before the plural noun ‘imports’.
Context: ...The IAM role's name in AWS } ``` Using a distinct imports.tf file immediately clarifies which par...(VB_A_JJ_NNS)
[uncategorized] ~249-~249: Possible missing comma found.
Context: ...configuration runs with a compatible TF version and fails if none are available. This p...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~258-~258: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...ning principles. The ~> operator allows patch and minor version updates while prevent...(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
[uncategorized] ~258-~258: Possible missing comma found.
Context: ...operator allows patch and minor version updates while preventing major version changes ...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~262-~262: Possible missing comma found.
Context: ...cross environments. Unlike the previous files which you create manually, TF automatic...(AI_HYDRA_LEO_MISSING_COMMA)
[style] ~287-~287: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[grammar] ~289-~289: The verb ‘terraform’ does not usually follow articles like ‘the’. Check that ‘terraform’ is spelled correctly; using ‘terraform’ as a noun may be non-standard.
Context: ... to update providers to newer versions, the terraform init -upgrade command will refresh the ...(A_INFINITIVE)
[typographical] ~305-~305: Consider adding a comma after ‘technically’ for more clarity.
Context: ...y assigning names to expressions. While technically you can place locals anywhere, followin...(RB_LY_COMMA)
[uncategorized] ~399-~399: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...en extensively on the null-label pattern and we'd encourage you to adopt this to imp...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~399-~399: When ‘follow-up’ is used as a noun or modifier, it needs to be hyphenated.
Context: ... more about utilizing context.tf in our follow up advanced post](/blog/terraform-null-lab...(VERB_NOUN_CONFUSION)
|
@Gowiem is it something we forgot to publish? |
|
@gberenice yes. Circling back around to this soon, but your blog post is up next. |
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
content/blog/standard-tf-files.md (1)
21-112: Content structure, examples, and guidance are strong.Clear separation of concerns, solid examples (main.tf, variables.tf, outputs.tf), and actionable guidance. Well aligned with best practices.
🧹 Nitpick comments (5)
content/blog/standard-tf-files.md (5)
289-290: Minor wording polish.Tighten phrasing per style hint (“exactly the same” → “identical”).
-When new team members clone your repository, the lock file guarantees they'll use exactly the same provider versions during local development. +When new team members clone your repository, the lock file guarantees they'll use identical provider versions during local development.
331-331: Hyphenate “open-source” (compound adjective).Small readability polish.
-Instead, aim for a single, well-organized block that groups related transformations together with clear names and comments when needed. Want to see an example of some intense locals logic in TF that is well organized and commented? [Check out our terraform-spacelift-automation open source module's main.tf](https://github.com/masterpointio/terraform-spacelift-automation/blob/main/main.tf) and your eyes will go wide. +Instead, aim for a single, well-organized block that groups related transformations together with clear names and comments when needed. Want to see an example of some intense locals logic in TF that is well organized and commented? [Check out our terraform-spacelift-automation open-source module's main.tf](https://github.com/masterpointio/terraform-spacelift-automation/blob/main/main.tf) and your eyes will go wide.
399-399: Use “look up” (verb) instead of “lookup” (noun).Minor grammar fix.
-Additionally, having this metadata consistently available means you can generate outputs that follow standard naming patterns, making it easier to lookup information between modules. +Additionally, having this metadata consistently available means you can generate outputs that follow standard naming patterns, making it easier to look up information between modules.
144-145: Tone tighten (optional).Drop “very” for a crisper sentence.
-... it's not always the most practical approach for very simple cases. +... it's not always the most practical approach for simple cases.
1-415: Final verification checklist.
- Run trunk fmt to satisfy Prettier.
- Keep draft: true until you’re ready to ship.
- Ensure featured image exists under static/img/updates/.
- Validate all /blog/ links resolve to content files in the repo (script provided above).
- Consider converting any remaining internal links to site-absolute paths.
I can help batch-apply the suggested diffs if you’d like.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
static/img/updates/standard-tf-files.pngis excluded by!**/*.png
📒 Files selected for processing (1)
content/blog/standard-tf-files.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
content/**/*.md
📄 CodeRabbit Inference Engine (CLAUDE.md)
content/**/*.md: All content is in Markdown files under /content/
Front matter in Markdown files controls metadata and page behavior
Use absolute paths in content (e.g., /blog/ not blog/)
Reference images from /img/ (maps to /static/img/)
Set draft: true in front matter to hide from production
Files:
content/blog/standard-tf-files.md
content/blog/**/*.md
📄 CodeRabbit Inference Engine (CLAUDE.md)
Blog post Markdown files should be created under content/blog/ and follow the pattern hugo new blog/my-post-title.md
Files:
content/blog/standard-tf-files.md
🧠 Learnings (1)
📚 Learning: 2025-02-16T12:25:44.771Z
Learnt from: gberenice
PR: masterpointio/masterpoint.io#46
File: content/updates/steps-to-break-up-a-terralith.md:0-0
Timestamp: 2025-02-16T12:25:44.771Z
Learning: During Terralith migration, both resource blocks and module blocks can be deleted from the original Terralith root module after they have been imported into the new root module.
Applied to files:
content/blog/standard-tf-files.md
🪛 GitHub Check: Trunk Check
content/blog/standard-tf-files.md
[failure] 1-1: prettier
Incorrect formatting, autoformat by running 'trunk fmt'
🪛 LanguageTool
content/blog/standard-tf-files.md
[style] ~15-~15: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...
(COMPLETELY_ENTIRELY)
[style] ~17-~17: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...
(CONSTITUTE_COMPRISE)
[grammar] ~121-~121: There might be a mistake here.
Context: ...AMI IDs - existing VPC attributes or IDs - IAM policy details Centralizing these i...
(QB_NEW_EN)
[style] ~144-~144: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...
(EN_WEAK_ADJECTIVE)
[style] ~289-~289: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...
(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[uncategorized] ~331-~331: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... out our terraform-spacelift-automation open source module's main.tf](https://github.com/ma...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~399-~399: Ensure spelling is correct
Context: ...rd naming patterns, making it easier to lookup information between modules. We've wri...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (1)
content/blog/standard-tf-files.md (1)
146-167: Good coverage of checks.tf and policy assertions.Accurately explains when and why to use Terraform check blocks and keeps examples concise.
| Want to know all about versioning in Terraform and OpenTofu? Read our definitive article on that topic: [The Ultimate Terraform Versioning Guide](/blog/ultimate-terraform-versioning-guide). | ||
|
|
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify referenced slugs still exist.
This cross-reference depends on the linked article’s slug staying stable. Confirm the target content exists and the slug hasn’t changed.
Run:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Extract all internal blog links from this file and verify a corresponding content file exists.
FILE='content/blog/standard-tf-files.md'
mapfile -t LINKS < <(rg -nPo '/blog/[^\s)"]+' "$FILE" | sed -E 's/^.*(\/blog\/[^\s)"]+).*$/\1/' | sed -E 's/#.*$//' | sort -u)
status=0
for link in "${LINKS[@]}"; do
slug=$(basename "$link")
slug=${slug%/}
# Try to find a matching content file
matches=$(fd -a --glob "$slug.md" content/blog || true)
if [[ -z "$matches" ]]; then
echo "WARN: Could not find content file for $link (expected content/blog/$slug.md)"
status=1
else
echo "OK: $link -> $matches"
fi
done
exit $statusLength of output: 325
To work around the /dev/fd issue, let’s explicitly check the one slug we care about:
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
slug="ultimate-terraform-versioning-guide"
expected="content/blog/${slug}.md"
if [[ -f "$expected" ]]; then
echo "OK: ${expected} exists for /blog/${slug}"
exit 0
else
echo "WARN: Could not find content file for /blog/${slug} (expected ${expected})"
exit 1
fiLength of output: 492
Broken Internal Link – /blog/ultimate-terraform-versioning-guide not found
The referenced slug doesn’t resolve to any file in content/blog/:
• In content/blog/standard-tf-files.md (lines 260–261),
the link
[The Ultimate Terraform Versioning Guide](/blog/ultimate-terraform-versioning-guide)points to content/blog/ultimate-terraform-versioning-guide.md, which doesn’t exist.
Please verify the correct slug or add/rename the target file so this link resolves.
🤖 Prompt for AI Agents
In content/blog/standard-tf-files.md around lines 260-261, the internal link
[/blog/ultimate-terraform-versioning-guide] points to
content/blog/ultimate-terraform-versioning-guide.md which does not exist; either
update the markdown link to the correct existing slug (replace the href with the
actual path/filename of the versioning guide) or create/rename the target file
to content/blog/ultimate-terraform-versioning-guide.md so the link resolves;
ensure the link uses the site’s canonical slug format and run a local link check
after the change.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
|
||
| Want to know all about versioning in Terraform and OpenTofu? Read our definitive article on that topic: [The Ultimate Terraform Versioning Guide](/blog/ultimate-terraform-versioning-guide). | ||
|
|
||
| ### .terraform.lock.hcl: The Dependency Lock File |
There was a problem hiding this comment.
Should we explicitly emphasize that it's about the root module?
There was a problem hiding this comment.
Good idea. Added a separate suggestion with language about that 👍
Co-authored-by: Veronika Gnilitska <30597968+gberenice@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
content/blog/standard-tf-files.md (5)
88-105: Example mismatch: outputs reference private subnets not defined in the main.tf sample.The outputs.tf snippet includes private_subnet_ids, but the main.tf example only defines public subnets. This may confuse readers.
Two options:
- Option A (simpler): remove the private_subnet_ids output from the example.
output "public_subnet_ids" { description = "List of public subnet IDs" value = aws_subnet.public[*].id } - -output "private_subnet_ids" { - description = "List of private subnet IDs" - value = aws_subnet.private[*].id -}
- Option B: add a matching private subnet resource block in the main.tf example (and show locals/private CIDRs if desired). Happy to draft that if you prefer.
Also applies to: 33-47
151-163: Safer check example: guard against missing encryption blocks.Indexing into nested blocks can throw errors if the block isn’t present. Using try() avoids hard failures and keeps the example robust.
Apply:
check "s3_encryption" { assert { - condition = alltrue([ - for bucket in aws_s3_bucket.logs : - bucket.server_side_encryption_configuration[0].rule[0].apply_server_side_encryption_by_default[0].sse_algorithm == "AES256" - ]) + condition = alltrue([ + for bucket in aws_s3_bucket.logs : + try( + bucket.server_side_encryption_configuration[0].rule[0].apply_server_side_encryption_by_default[0].sse_algorithm == "AES256", + false + ) + ]) error_message = "All S3 buckets must have server-side encryption enabled with AES256." } }
202-221: Tagging consistency: align providers default_tags with the context.tf pattern (optional).You introduce module.this.tags via context.tf, but providers.tf uses var.default_tags. To reduce cognitive load, consider consistently using the context module’s tags in both places.
Apply:
provider "aws" { region = var.aws_region assume_role { role_arn = var.deployment_role_arn } default_tags { - tags = var.default_tags + tags = module.this.tags } }If you keep var.default_tags for didactic reasons, a one-liner note explaining why both appear would help.
Also applies to: 354-394
13-19: Minor editorial polish (readability and house style).Small wording tweaks to tighten prose and match style hints.
Apply:
-...different contributors frequently follow completely different organizational patterns... +...different contributors frequently follow entirely different organizational patterns... -When the files that make up a TF project have standard names, locations and meanings... +When the files that comprise a TF project have standard names, locations, and meanings... -...not always the most practical approach for very simple cases. +...not always the most practical approach for simple cases. -...they'll use exactly the same provider versions... +...they'll use the same provider versions... -...terraform-spacelift-automation open source module's main.tf... +...terraform-spacelift-automation open-source module's main.tf... -...making it easier to lookup information between modules. +...making it easier to look up information between modules.Also applies to: 143-143, 288-288, 330-330, 398-398
294-296: Platform-lock tip: consider including linux_arm64 for CI runners on Graviton.If your CI or prod uses ARM on Linux (AWS Graviton), add linux_arm64 to reduce checksum churn.
Apply:
-terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 -platform=windows_amd64 +terraform providers lock -platform=linux_amd64 -platform=linux_arm64 -platform=darwin_arm64 -platform=windows_amd64
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
content/blog/standard-tf-files.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
content/**/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
content/**/*.md: All content is in Markdown files under /content/
Front matter in Markdown files controls metadata and page behavior
Use absolute paths in content (e.g., /blog/ not blog/)
Reference images from /img/ (maps to /static/img/)
Set draft: true in front matter to hide from production
Files:
content/blog/standard-tf-files.md
content/blog/**/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Blog post Markdown files should be created under content/blog/ and follow the pattern hugo new blog/my-post-title.md
Files:
content/blog/standard-tf-files.md
🧠 Learnings (1)
📚 Learning: 2025-02-16T12:25:44.771Z
Learnt from: gberenice
PR: masterpointio/masterpoint.io#46
File: content/updates/steps-to-break-up-a-terralith.md:0-0
Timestamp: 2025-02-16T12:25:44.771Z
Learning: During Terralith migration, both resource blocks and module blocks can be deleted from the original Terralith root module after they have been imported into the new root module.
Applied to files:
content/blog/standard-tf-files.md
🪛 LanguageTool
content/blog/standard-tf-files.md
[style] ~15-~15: Consider using a different adverb to strengthen your wording.
Context: ...ifferent contributors frequently follow completely different organizational patterns, crea...
(COMPLETELY_ENTIRELY)
[style] ~17-~17: Try using a synonym here to elevate your writing.
Context: ...nd troubleshooting. When the files that make up a TF project have standard names, locat...
(CONSTITUTE_COMPRISE)
[grammar] ~120-~120: There might be a mistake here.
Context: ...AMI IDs - existing VPC attributes or IDs - IAM policy details Centralizing these i...
(QB_NEW_EN)
[style] ~143-~143: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ... always the most practical approach for very simple cases. For instance, if a module uses o...
(EN_WEAK_ADJECTIVE)
[style] ~288-~288: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...y, the lock file guarantees they'll use exactly the same provider versions during local developm...
(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
[uncategorized] ~330-~330: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... out our terraform-spacelift-automation open source module's main.tf](https://github.com/ma...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~398-~398: Ensure spelling is correct
Context: ...rd naming patterns, making it easier to lookup information between modules. We've wri...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (1)
content/blog/standard-tf-files.md (1)
21-413: Clean Link Audit Passed: No Hardcoded URLs or Broken Links FoundVerification confirms:
- No
https?://(www\.)?masterpoint\.io/(blog|updates)/links remain.- All markdown links are properly closed.
No further changes needed here.
| --- | ||
| visible: true | ||
| draft: false | ||
| title: "The Standard Terraform and OpenTofu Files + Their Uses" | ||
| author: Matt Gowie | ||
| slug: standard-tf-files | ||
| date: 2025-10-07 | ||
| description: "A comprehensive guide to the various files that make up a Terraform and OpenTofu project. Learn what belongs in main.tf, variables.tf, outputs.tf, and other essential files for maintainable Infrastructure as Code." | ||
| image: /img/updates/standard-tf-files.png | ||
| callout: <p>👋 <b>If your team is struggling with inconsistent Terraform organization or looking to establish better practices for Infrastructure as Code, we'd love to help. To discuss how we can support your infrastructure goals with proven patterns and strategies, <a href='/contact'>get in touch!</a></b></p> | ||
| --- |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Front matter: set draft to true while under review; future-dated post may auto-schedule.
- Set draft: true to keep this unpublished until the review wraps.
- The date is October 7, 2025, which is in the future. If you intend to schedule publish, keep it; otherwise update when you flip draft to false.
Apply:
---
visible: true
-draft: false
+draft: true
title: "The Standard Terraform and OpenTofu Files + Their Uses"
author: Matt Gowie
slug: standard-tf-files
-date: 2025-10-07
+date: 2025-10-07
description: "A comprehensive guide to the various files that make up a Terraform and OpenTofu project. Learn what belongs in main.tf, variables.tf, outputs.tf, and other essential files for maintainable Infrastructure as Code."
image: /img/updates/standard-tf-files.png
callout: <p>👋 <b>If your team is struggling with inconsistent Terraform organization or looking to establish better practices for Infrastructure as Code, we'd love to help. To discuss how we can support your infrastructure goals with proven patterns and strategies, <a href='/contact'>get in touch!</a></b></p>
---Run to format and verify the hero image exists at the expected path:
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
# Auto-format
if command -v trunk >/dev/null 2>&1; then
trunk fmt
else
echo "NOTE: trunk not installed in CI sandbox; run 'trunk fmt' locally."
fi
# Verify image exists under /static/img matching the /img URL
expected="static/img/updates/standard-tf-files.png"
if [[ -f "$expected" ]]; then
echo "OK: Found $expected"
else
echo "ERROR: Missing $expected (referenced by image: /img/updates/standard-tf-files.png)"
exit 2
fiLength of output: 400
Front matter update & checks
- Please set
draft: trueto keep this post unpublished while it’s under review. - Note the
date: 2025-10-07is in the future; leave it for scheduling or update it when you flipdrafttofalse. - Formatting isn’t applied automatically in this sandbox—run
trunk fmtlocally to ensure consistent formatting. - Verified that
static/img/updates/standard-tf-files.pngexists for theimage: /img/updates/standard-tf-files.pngreference.
Apply the following changes:
---
visible: true
-draft: false
+draft: true
title: "The Standard Terraform and OpenTofu Files + Their Uses"
author: Matt Gowie
slug: standard-tf-files
-date: 2025-10-07
+date: 2025-10-07
description: "A comprehensive guide to the various files that make up a Terraform and OpenTofu project. Learn what belongs in main.tf, variables.tf, outputs.tf, and other essential files for maintainable Infrastructure as Code."
image: /img/updates/standard-tf-files.png
callout: <p>👋 <b>If your team is struggling with inconsistent Terraform organization or looking to establish better practices for Infrastructure as Code, we'd love to help. To discuss how we can support your infrastructure goals with proven patterns and strategies, <a href='/contact'>get in touch!</a></b></p>
---📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| --- | |
| visible: true | |
| draft: false | |
| title: "The Standard Terraform and OpenTofu Files + Their Uses" | |
| author: Matt Gowie | |
| slug: standard-tf-files | |
| date: 2025-10-07 | |
| description: "A comprehensive guide to the various files that make up a Terraform and OpenTofu project. Learn what belongs in main.tf, variables.tf, outputs.tf, and other essential files for maintainable Infrastructure as Code." | |
| image: /img/updates/standard-tf-files.png | |
| callout: <p>👋 <b>If your team is struggling with inconsistent Terraform organization or looking to establish better practices for Infrastructure as Code, we'd love to help. To discuss how we can support your infrastructure goals with proven patterns and strategies, <a href='/contact'>get in touch!</a></b></p> | |
| --- | |
| --- | |
| visible: true | |
| draft: true | |
| title: "The Standard Terraform and OpenTofu Files + Their Uses" | |
| author: Matt Gowie | |
| slug: standard-tf-files | |
| date: 2025-10-07 | |
| description: "A comprehensive guide to the various files that make up a Terraform and OpenTofu project. Learn what belongs in main.tf, variables.tf, outputs.tf, and other essential files for maintainable Infrastructure as Code." | |
| image: /img/updates/standard-tf-files.png | |
| callout: <p>👋 <b>If your team is struggling with inconsistent Terraform organization or looking to establish better practices for Infrastructure as Code, we'd love to help. To discuss how we can support your infrastructure goals with proven patterns and strategies, <a href='/contact'>get in touch!</a></b></p> | |
| --- |
🤖 Prompt for AI Agents
In content/blog/standard-tf-files.md around lines 1 to 11, change the
front-matter flag draft: false to draft: true so the post remains unpublished
during review, leave the date (2025-10-07) as-is for scheduled publishing, run
trunk fmt locally and commit the formatted file to ensure consistent formatting,
and confirm the referenced image path (/img/updates/standard-tf-files.png) is
correct (static/img/updates/standard-tf-files.png exists) before pushing.
| ### imports.tf: Resource Import Declarations | ||
|
|
||
| When you need to manage existing infrastructure with TF, one of the first steps is bringing those current resources into your TF state. The imports.tf file, which uses import blocks (available since Terraform v1.5), offers a clear and manageable way to do this. It's a more structured approach compared to the older imperative terraform import command-line operation, making the process more transparent and automatable. | ||
|
|
||
| Instead of relying on CLI commands, you define import blocks directly in your TF configuration files. While these can be placed in any .tf file, organizing them in a dedicated imports.tf is a common practice. Each import block identifies an existing piece of infrastructure and assigns it a TF resource address. Using this approach means your import process is documented in code, making it reviewable by your team, captured in your git history, and consistently repeatable across many instances of that root module. | ||
|
|
||
| Here's an example of a imports.tf file: | ||
|
|
||
| ```hcl | ||
| # Example in imports.tf | ||
| import { | ||
| to = aws_s3_bucket.legacy_logs # The address Terraform will use for this S3 bucket | ||
| id = "company-logs-bucket" # The S3 bucket's actual name in AWS | ||
| } | ||
|
|
||
| import { | ||
| to = aws_iam_role.existing_lambda_role | ||
| id = "lambda-execution-role" # The IAM role's name in AWS | ||
| } | ||
| ``` |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Align version requirements with features used (checks + import blocks require Terraform ≥ 1.5).
You showcase check blocks and import blocks, both introduced in Terraform 1.5. The versions.tf example currently allows Terraform >= 1.3, which can mislead readers.
Apply:
terraform {
- required_version = ">= 1.3.0, < 2.0.0"
+ # Uses check blocks and import blocks, which require Terraform >= 1.5
+ required_version = ">= 1.5.0, < 2.0.0"Also applies to: 231-248
🤖 Prompt for AI Agents
In content/blog/standard-tf-files.md around lines 167 to 186 (and also apply
same change to lines 231 to 248), the examples show using check blocks and
import blocks (features added in Terraform 1.5) while the versions.tf snippet
permits Terraform >= 1.3; update the versions.tf example(s) to require Terraform
>= 1.5 so the documented features match the declared provider/terraform version
constraints—modify the required_version and any related provider constraints to
1.5+ and ensure the text notes Terraform 1.5 as the minimum where checks/imports
are demonstrated.
|
|
||
| The source attribute is particularly important in organizations that use private provider registries or forks of official providers. | ||
|
|
||
| Want to know all about versioning in Terraform and OpenTofu? Read our definitive article on that topic: [The Ultimate Terraform Versioning Guide](/blog/ultimate-terraform-versioning-guide). |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Potentially broken internal link: verify the slug exists.
The link to /blog/ultimate-terraform-versioning-guide may not exist in content/blog. Confirm and adjust the slug or add the target file.
Run:
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
slug="ultimate-terraform-versioning-guide"
target="content/blog/${slug}.md"
if [[ -f "$target" ]]; then
echo "OK: $target exists"
else
echo "WARN: $target not found; update the href or add the post."
echo "Known blog files with similar names:"
fd -a --glob '*version*terraform*' content/blog || true
exit 1
fiLength of output: 541
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
# Search for blog files with "terraform" and "version" patterns in the slug
echo "Checking for Terraform versioning guide filenames:"
fd -a --ignore-case '*terraform*version*guide*' content/blog
# Broader search for any "version" and "guide" combinations in blog posts
echo "Checking for versioning guide filenames:"
fd -a --ignore-case '*version*guide*' content/blogLength of output: 498
Broken link: missing blog post for “Ultimate Terraform Versioning Guide”
Snippet (content/blog/standard-tf-files.md:259):
Want to know all about versioning in Terraform and OpenTofu? Read our definitive article on that topic: [The Ultimate Terraform Versioning Guide](/blog/ultimate-terraform-versioning-guide).The file content/blog/ultimate-terraform-versioning-guide.md does not exist. Please choose one of the following fixes:
- Add a new post at
content/blog/ultimate-terraform-versioning-guide.mdwith that slug - Update the link to the correct slug of the existing versioning guide post (e.g.
/blog/<correct-slug>)
🤖 Prompt for AI Agents
In content/blog/standard-tf-files.md around line 259 the link to
"/blog/ultimate-terraform-versioning-guide" points to a non-existent file
(content/blog/ultimate-terraform-versioning-guide.md); fix by either adding a
new Markdown post at content/blog/ultimate-terraform-versioning-guide.md with
the matching slug and frontmatter, or update the Markdown link to the correct
existing post slug (e.g., replace the URL with /blog/<correct-slug>) so the link
resolves to an actual file.

Summary
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation