-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: adds root module example + more docs #1
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,48 @@ | ||||||||||||||||||||||||
# root-module | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
This is a template root module. | ||||||||||||||||||||||||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance the module description The current description "This is a template root module" is too generic. Consider providing a more specific description that explains the purpose and functionality of this root module example. -This is a template root module.
+# Example Root Module
+
+This root module demonstrates how to compose child modules together to create a complete infrastructure. It showcases best practices for:
+- Module composition
+- Variable management
+- Resource organization 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
<!-- README TEMPLATE: AFTER READING THE BELOW SECTION, DELETE THE BELOW SECTION AND REPLACE WITH YOUR OWN CONTENT --> | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Documentation Recommendations (DO NOT INCLUDE THIS INTO THE REAL README) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
- Module description: Briefly explain what the root module sets up (e.g., infrastructure for RDS Postgres instances). | ||||||||||||||||||||||||
- Use [terraform-docs](https://github.com/terraform-docs/terraform-docs) to ensure that variables, outputs, child module, and resource documentation is included. | ||||||||||||||||||||||||
- Maintain current information: Keep the README updated as the infrastructure evolves. | ||||||||||||||||||||||||
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove documentation recommendations from template The "Documentation Recommendations" section with the note "(DO NOT INCLUDE THIS INTO THE REAL README)" should not be part of the template itself. Consider moving these recommendations to a separate documentation guide or contributing guidelines document.
Comment on lines
+5
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Move documentation recommendations to a separate guide The "Documentation Recommendations" section marked with "(DO NOT INCLUDE THIS INTO THE REAL README)" should be moved to a separate documentation guide or contributing guidelines document. Consider creating a new file |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
<!-- README TEMPLATE: ENDING DELETE MARKER --> | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Requirements | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| Name | Version | | ||||||||||||||||||||||||
| ------------------------------------------------------------------------ | ------- | | ||||||||||||||||||||||||
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | ~> 1.0 | | ||||||||||||||||||||||||
| <a name="requirement_random"></a> [random](#requirement_random) | ~> 3.0 | | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Providers | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
No providers. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Modules | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| Name | Source | Version | | ||||||||||||||||||||||||
| ----------------------------------------------------------------- | ------------------------ | ------- | | ||||||||||||||||||||||||
| <a name="module_random_pet"></a> [random_pet](#module_random_pet) | masterpointio/random/pet | 0.1.0 | | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Resources | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
No resources. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Inputs | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| Name | Description | Type | Default | Required | | ||||||||||||||||||||||||
| --------------------------------------------------- | ----------------------------- | -------- | ------- | :------: | | ||||||||||||||||||||||||
| <a name="input_length"></a> [length](#input_length) | The length of the random name | `number` | `2` | no | | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Outputs | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
No outputs. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This example.auto.tfvars file provides a sample set of input variable values for the root module. | ||
# Terraform automatically loads any `.auto.tfvars` files, applying these values without requiring additional command-line flags. | ||
# Rename or remove this file to fit your needs. | ||
|
||
length = 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
locals { | ||
# Get the current timestamp and format it as YYYYMMDD | ||
prefix = formatdate("YYYYMMDD", timestamp()) | ||
} | ||
gberenice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module "random_pet" { | ||
source = "masterpointio/random/pet" | ||
version = "0.1.0" | ||
|
||
length = var.length | ||
prefix = local.prefix | ||
} | ||
gberenice marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
provider "random" { | ||
# Configuration options | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "length" { | ||
description = "The length of the random name" | ||
type = number | ||
default = 2 | ||
validation { | ||
condition = var.length > 0 | ||
error_message = "The length must be a positive number." | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = "1.8.7" | ||
|
||
required_providers { | ||
random = { | ||
source = "hashicorp/random" | ||
version = "~> 3.0.0" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.