Skip to content
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

📝 (docs): Cleanup README.md documentation #19

Merged
merged 1 commit into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 111 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<br/>

Check warning on line 1 in README.md

View workflow job for this annotation

GitHub Actions / markdownlint

[markdownlint] reported by reviewdog 🐶 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "<br/>"] Raw Output: README.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "<br/>"]
<p align="center">
<a href="https://github.com/bendoerr-terraform-modules/terraform-null-label">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.png">
<img src="docs/logo-light.png" alt="Logo">
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/bendoerr-terraform-modules/terraform-null-label/raw/main/docs/logo-dark.png">
<img src="https://github.com/bendoerr-terraform-modules/terraform-null-label/raw/main/docs/logo-light.png" alt="Logo">
</picture>
</a>

<h3 align="center">Ben's Terraform Null Label Module</h3>
<h3 align="center">Ben's Terraform Null Context Module</h3>

<p align="center">
This is how I do it.
Expand All @@ -22,60 +22,105 @@
</p>
</p>

![Contributors](https://img.shields.io/github/contributors/bendoerr-terraform-modules/terraform-null-label?color=dark-green) ![Issues](https://img.shields.io/github/issues/bendoerr-terraform-modules/terraform-null-label) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/bendoerr-terraform-modules/terraform-null-label/test.yml)
![GitHub tag (with filter)](https://img.shields.io/github/v/tag/bendoerr-terraform-modules/terraform-null-label?filter=v*)
![License](https://img.shields.io/github/license/bendoerr-terraform-modules/terraform-null-label)
[<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/graphs/contributors)
[<img alt="GitHub issues" src="https://img.shields.io/github/issues/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues)
[<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/pulls)
[<img alt="GitHub workflow: Terratest" src="https://img.shields.io/github/actions/workflow/status/bendoerr-terraform-modules/terraform-null-label/test.yml?logo=githubactions&label=terratest">](https://github.com/bendoerr-terraform-modules/terraform-null-label/actions/workflows/test.yml)
[<img alt="GitHub workflow: Linting" src="https://img.shields.io/github/actions/workflow/status/bendoerr-terraform-modules/terraform-null-label/lint.yml?logo=githubactions&label=linting">](https://github.com/bendoerr-terraform-modules/terraform-null-label/actions/workflows/lint.yml)
[<img alt="GitHub tag (with filter)" src="https://img.shields.io/github/v/tag/bendoerr-terraform-modules/terraform-null-label?filter=v*&label=latest%20tag&logo=terraform">](https://registry.terraform.io/modules/bendoerr-terraform-modules/label/null/latest)
[<img alt="OSSF-Scorecard Score" src="https://img.shields.io/ossf-scorecard/github.com/bendoerr-terraform-modules/terraform-null-label?logo=securityscorecard&label=ossf%20scorecard&link=https%3A%2F%2Fsecurityscorecards.dev%2Fviewer%2F%3Furi%3Dgithub.com%2Fbendoerr-terraform-modules%2Fterraform-null-label">](https://securityscorecards.dev/viewer/?uri=github.com/bendoerr-terraform-modules/terraform-null-label)
[<img alt="GitHub License" src="https://img.shields.io/github/license/bendoerr-terraform-modules/terraform-null-label?logo=opensourceinitiative">](https://github.com/bendoerr-terraform-modules/terraform-null-label/blob/main/LICENSE.txt)

## About The Project

My opinionated label module.

This Terraform module consumes my `terraform-null-context` and produces
consistent names and tags for all of my resources. It implements a strict naming
and tagging convention that follows the format from
[cloudposse/terraform-null-label](https://github.com/cloudposse/terraform-null-label).

The Cloud Posse label module provides detailed documentation and reasoning
however by itself it has too many knobs and provides more options that I use.
This module configures the Cloud Posse label exactly how I like it while taking
advantage of my context module to carry standard part of the label around.

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/bendoerr-terraform-modules/terraform-null-label/raw/main/docs/usage-dark.png">
<img src="https://github.com/bendoerr-terraform-modules/terraform-null-label/raw/main/docs/usage-light.png" alt="Logo">
</picture>

## Usage

```
```terraform
module "context" {
source = "[email protected]:bendoerr-terraform-modules/terraform-null-context?ref=v0.4.0"
namespace = "brd"
role = "production'
source = "bendoerr-terraform-modules/context/null"
version = "xxx"
namespace = "bd"
role = "production"
region = "us-east-1"
project = "example'
project = "example"
}

module "label_thing" {
source = "[email protected]:bendoerr-terraform-modules/terraform-null-label?ref=v0.4.0"
module "label" {
source = "bendoerr-terraform-modules/label/null"
version = "xxx"
context = module.context.shared
thing = "thing"
name = "function"
}

output "label_id" {
// brd-prod-ue1-example-thing
value = module.label_thing.id
resource "aws_lambda_function" "function" {
function_name = module.label.id # bd-prd-ue1-example-function
tags = module.label.tags # { Name: bd-prd-ue1-example-function,
# Namespace: bd,
# Role: production,
# Region: us-east-1,
# Project: example,
# Environment: prod-ue1,
# }
...
}

resource "aws_route53_record" "function" {
name = "${module.label.dns_name}.${vars.zone_name}" # function.ue1.cloud.bendoerr.me
# assuming vars.zone_name = cloud.bendoerr.me
...
}
```

### Cost

<a href="https://dashboard.infracost.io/org/bendoerr/repos/fb5edc95-efa2-4943-824c-b9e8619a668a?tab=settings"><img src="https://img.shields.io/endpoint?url=https://dashboard.api.infracost.io/shields/json/6e706676-64ba-43db-97b9-bd92f9272474/repos/fb5edc95-efa2-4943-824c-b9e8619a668a/branch/808e8b2b-0fda-4c1a-8a3c-519c8c29edb2" alt="infracost"/></a>

```text
Project: bendoerr-terraform-modules/terraform-null-label

Name Monthly Qty Unit Monthly Cost

OVERALL TOTAL $0.00
──────────────────────────────────
No cloud resources were detected
```

This module creates no resources and will not generate any cost against any
cloud provider you use.

<!-- BEGIN_TF_DOCS -->
### Requirements
bendoerr marked this conversation as resolved.
Show resolved Hide resolved

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
bendoerr marked this conversation as resolved.
Show resolved Hide resolved

### Providers

No providers.

### Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_label"></a> [label](#module\_label) | cloudposse/label/null | 0.25.0 |
bendoerr marked this conversation as resolved.
Show resolved Hide resolved

### Resources

No resources.

### Inputs

| Name | Description | Type | Default | Required |

Check warning on line 123 in README.md

View workflow job for this annotation

GitHub Actions / prettier

[prettier] reported by reviewdog 🐶 Raw Output: README.md:123:-| Name | Description | Type | Default | Required | README.md:124:-|------|-------------|------|---------|:--------:| README.md:125:-| <a name="input_context"></a> [context](#input\_context) | Shared Context from Ben's terraform-null-label | <pre>object({<br> attributes = list(string)<br> dns_namespace = string<br> environment = string<br> instance = string<br> instance_short = string<br> namespace = string<br> region = string<br> region_short = string<br> role = string<br> role_short = string<br> project = string<br> tags = map(string)<br> })</pre> | n/a | yes | README.md:126:-| <a name="input_name"></a> [name](#input\_name) | Name of this resource | `string` | n/a | yes | README.md:127:-| <a name="input_project"></a> [project](#input\_project) | Name of the project or application, this can override the context's project | `string` | `""` | no | README.md:124:+| Name | Description | Type | Default | Required | README.md:125:+| ------------------------------------------------------ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | :------: | README.md:126:+| <a name="input_context"></a> [context](#input_context) | Shared Context from Ben's terraform-null-label | <pre>object({<br> attributes = list(string)<br> dns_namespace = string<br> environment = string<br> instance = string<br> instance_short = string<br> namespace = string<br> region = string<br> region_short = string<br> role = string<br> role_short = string<br> project = string<br> tags = map(string)<br> })</pre> | n/a | yes | README.md:127:+| <a name="input_name"></a> [name](#input_name) | Name of this resource | `string` | n/a | yes | README.md:128:+| <a name="input_project"></a> [project](#input_project) | Name of the project or application, this can override the context's project | `string` | `""` | no |
|------|-------------|------|---------|:--------:|
| <a name="input_context"></a> [context](#input\_context) | Shared Context from Ben's terraform-null-label | <pre>object({<br> attributes = list(string)<br> dns_namespace = string<br> environment = string<br> instance = string<br> instance_short = string<br> namespace = string<br> region = string<br> region_short = string<br> role = string<br> role_short = string<br> project = string<br> tags = map(string)<br> })</pre> | n/a | yes |
| <a name="input_name"></a> [name](#input\_name) | Name of this resource | `string` | n/a | yes |
Expand All @@ -83,7 +128,7 @@

### Outputs

| Name | Description |

Check warning on line 131 in README.md

View workflow job for this annotation

GitHub Actions / prettier

[prettier] reported by reviewdog 🐶 Raw Output: README.md:131:-| Name | Description | README.md:132:-|------|-------------| README.md:133:-| <a name="output_attributes"></a> [attributes](#output\_attributes) | List of attributes | README.md:134:-| <a name="output_delimiter"></a> [delimiter](#output\_delimiter) | Delimiter between `namespace`, `environment`, `stage`, `name` and `attributes` | README.md:135:-| <a name="output_dns_name"></a> [dns\_name](#output\_dns\_name) | Normalized DNS Name | README.md:136:-| <a name="output_environment"></a> [environment](#output\_environment) | Normalized environment | README.md:137:-| <a name="output_id"></a> [id](#output\_id) | Disambiguated ID | README.md:138:-| <a name="output_label_order"></a> [label\_order](#output\_label\_order) | The naming order of the id output and Name tag | README.md:139:-| <a name="output_name"></a> [name](#output\_name) | Normalized name | README.md:140:-| <a name="output_namespace"></a> [namespace](#output\_namespace) | Normalized namespace | README.md:141:-| <a name="output_project"></a> [project](#output\_project) | Normalized project | README.md:142:-| <a name="output_tags"></a> [tags](#output\_tags) | Normalized Tag map | README.md:143:-| <a name="output_tags_as_list_of_maps"></a> [tags\_as\_list\_of\_maps](#output\_tags\_as\_list\_of\_maps) | Additional tags as a list of maps, which can be used in several AWS resources | README.md:132:+| Name | Description | README.md:133:+| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | README.md:134:+| <a name="output_attributes"></a> [attributes](#output_attributes) | List of attributes | README.md:135:+| <a name="output_delimiter"></a> [delimiter](#output_delimiter) | Delimiter between `namespace`, `environment`, `stage`, `name` and `attributes` | README.md:136:+| <a name="output_dns_name"></a> [dns_name](#output_dns_name) | Normalized DNS Name | README.md:137:+| <a name="output_environment"></a> [environment](#output_environment) | Normalized environment | README.md:138:+| <a name="output_id"></a> [id](#output_id) | Disambiguated ID | README.md:139:+| <a name="output_label_order"></a> [label_order](#output_label_order) | The naming order of the id output and Name tag | README.md:140:+| <a name="output_name"></a> [name](#output_name) | Normalized name | README.md:141:+| <a name="output_namespace"></a> [namespace](#output_namespace) | Normalized namespace | README.md:142:+| <a name="output_project"></a> [project](#output_project) | Normalized project | README.md:143:+| <a name="output_tags"></a> [tags](#output_tags) | Normalized Tag map | README.md:144:+| <a name="output_tags_as_list_of_maps"></a> [tags_as_list_of_maps](#output_tags_as_list_of_maps) | Additional tags as a list of maps, which can be used in several AWS resources | README.md:145:+
|------|-------------|
| <a name="output_attributes"></a> [attributes](#output\_attributes) | List of attributes |
| <a name="output_delimiter"></a> [delimiter](#output\_delimiter) | Delimiter between `namespace`, `environment`, `stage`, `name` and `attributes` |
Expand All @@ -96,18 +141,30 @@
| <a name="output_project"></a> [project](#output\_project) | Normalized project |
| <a name="output_tags"></a> [tags](#output\_tags) | Normalized Tag map |
| <a name="output_tags_as_list_of_maps"></a> [tags\_as\_list\_of\_maps](#output\_tags\_as\_list\_of\_maps) | Additional tags as a list of maps, which can be used in several AWS resources |

<!-- END_TF_DOCS -->

## Roadmap

See the [open issues](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues) for a list of proposed features (and known issues).
[<img alt="GitHub issues" src="https://img.shields.io/github/issues/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues)

See the
[open issues](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues)
for a list of proposed features (and known issues).

## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
* If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
* Please make sure you check your spelling and grammar.
* Create individual PR for each suggestion.
[<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/pulls)

Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.

- If you have suggestions for adding or removing projects, feel free to
[open an issue](https://github.com/bendoerr-terraform-modules/terraform-null-label/issues/new)
to discuss it, or directly create a pull request after you edit the
_README.md_ file with necessary changes.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.

### Creating A Pull Request

Expand All @@ -119,13 +176,32 @@

## License

Distributed under the MIT License. See [LICENSE](https://github.com/bendoerr-terraform-modules/terraform-null-label/blob/main/LICENSE.txt) for more information.
[<img alt="GitHub License" src="https://img.shields.io/github/license/bendoerr-terraform-modules/terraform-null-label?logo=opensourceinitiative">](https://github.com/bendoerr-terraform-modules/terraform-null-label/blob/main/LICENSE.txt)

Distributed under the MIT License. See
[LICENSE](https://github.com/bendoerr-terraform-modules/terraform-null-label/blob/main/LICENSE.txt)
for more information.

## Authors

* **Benjamin R. Doerr** - *Terraformer* - [Benjamin R. Doerr](https://github.com/bendoerr/) - *Built Ben's Terraform Modules*
[<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/bendoerr-terraform-modules/terraform-null-label?logo=github">](https://github.com/bendoerr-terraform-modules/terraform-null-label/graphs/contributors)

- **Benjamin R. Doerr** - _Terraformer_ -
[Benjamin R. Doerr](https://github.com/bendoerr/) - _Built Ben's Terraform
Modules_

## Supported Versions

Only the latest tagged version is supported.

## Reporting a Vulnerability

See [SECURITY.md](SECURITY.md).

## Acknowledgements

* [ShaanCoding (ReadME Generator)](https://github.com/ShaanCoding/ReadME-Generator)
* [CloudPossie (Terraform Null Label - Inspiration)](https://github.com/cloudposse/terraform-null-label)
- [ShaanCoding (ReadME Generator)](https://github.com/ShaanCoding/ReadME-Generator)
- [CloudPossie (Terraform Null Label - Inspiration)](https://github.com/cloudposse/terraform-null-label)
- [OpenSSF - Helping me follow best practices](https://openssf.org/)
- [StepSecurity - Helping me follow best practices](https://app.stepsecurity.io/)
- [Infracost - Better than AWS Calculator](https://www.infracost.io/)
Binary file added docs/usage-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/usage-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/complete/complete.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ region_short = "uw2"
instance = "demo"
instance_short = "dmo"
project = "test"
attributes = [
attributes = [
"attr1"
]
tags = {
Expand Down
8 changes: 4 additions & 4 deletions examples/complete/ctx.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "context" {
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
namespace = var.namespace
environment = var.environment
role = var.role
Expand All @@ -18,8 +18,8 @@ output "context" {
}

module "context_with_proj" {
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
namespace = var.namespace
environment = var.environment
role = var.role
Expand Down
42 changes: 21 additions & 21 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
variable "namespace" {
type = string
type = string
description = <<-EOT
Element to ensure resources are generated with names that are globally
unique and do not collide. This should be a short key such as initials.
EOT
}

variable "environment" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Element to identify the region and/or the role. If not provided this element
defaults to <role_short>-<region_short>(-<instance_short>).
EOT
}

variable "role" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
bendoerr marked this conversation as resolved.
Show resolved Hide resolved
A simple name for the hosting provider account or workspace. Included in
tags to ensure that identification is simple across accounts. Examples
bendoerr marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -26,8 +26,8 @@
}

variable "role_short" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Shortened version of the 'role'.
Automatic shortening is done by removal of vowels unless handled by special
bendoerr marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -36,16 +36,16 @@
}

variable "region" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Key for the hosting provider region.
EOT
}

variable "region_short" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Shortened version of the 'region'.
Automatic shortening is done by removal of vowels unless handled by special
bendoerr marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -54,36 +54,36 @@
}

variable "instance" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Element to identify a tenant or copy of an environment (blue-green
deployments). This is not used often.
EOT
}

variable "instance_short" {
type = string
default = ""
type = string
default = ""
description = <<-EOT
Shortened version of the 'instance'.
Automatic shortening is done by removal of vowels.
EOT
}

variable "attributes" {
type = list(string)
default = []
type = list(string)
default = []
description = "Additional id elements that would be appended."
}

variable "tags" {
type = map(string)
default = {}
type = map(string)
default = {}
description = "Additional tags to include."
}

variable "context" {

Check warning on line 86 in examples/complete/variables.tf

View workflow job for this annotation

GitHub Actions / tflint

[tflint] reported by reviewdog 🐶 variable "context" is declared but not used Raw Output: examples/complete/variables.tf:86:1: warning: variable "context" is declared but not used ()
type = any
default = {
attributes = []
Expand All @@ -103,7 +103,7 @@
}

variable "project" {
type = string
default = ""
type = string
default = ""
description = "Name of the project or application, this can override the context's project"
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ locals {
var.name,
local.gvn_project,
var.context.dns_namespace
) : format(
) : format(
"%s.%s",
var.name,
var.context.dns_namespace
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ output "label_order" {
}

output "dns_name" {
value = local.dns_name
value = local.dns_name
description = "Normalized DNS Name"
}
9 changes: 6 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ variable "context" {
tags = map(string)
})
description = "Shared Context from Ben's terraform-null-label"
nullable = false
}

variable "name" {
type = string
type = string
description = "Name of this resource"
nullable = false
}

variable "project" {
type = string
default = ""
type = string
default = ""
description = "Name of the project or application, this can override the context's project"
nullable = false
}
Loading