Skip to content

Commit

Permalink
Adding attributes to to be included in the uid=1000(haffar) gid=1000(…
Browse files Browse the repository at this point in the history
…haffar) groups=1000(haffar),10(wheel),972(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
  • Loading branch information
ahaffar committed Apr 5, 2021
1 parent 4bb7595 commit b03631e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Summary
A Terraform open-source module to automate the creation of `tags`, the `Name` key and other attributes across resources in AWS, the `Name` prefix is based on a customizable order passed by the `prefix_order` variable with a default value of `["enviroemnt", "project_name", "region", "name]` and a configurable `delimiter` variable with value of `-`.
A Terraform open-source module to automate the creation of `tags`, the `Name` key and other attributes across resources in AWS, the `Name` prefix is based on a customizable order passed by the `prefix_order` variable with a default value of `["enviroemnt", "project_name", "region", "name", "attributes"]` and a configurable `delimiter` variable with value of `-`.

## Features

Expand All @@ -9,13 +9,13 @@ The module supports the following:
- A random string will be created using the `random` provider that will be used in case of creating a truncated id, `prefix_legnth_limit` !=0.
- Supporting a configurable `regex_substitute_chars` variable which will replace any non-alphanumeric chars passed to `enviroment`, `project_name`, `region` and, `name`, defaulted to `"/[^(a-z)(A-Z)(0-9)$]/"`.
- A validation mechanism to validate some input variables e.g. `tag_key_case`, `tag_value_case`, `region`
- Optional `attributes` which will be added automatically to `tags` variable.
- Optional `attributes` which will be added automatically to `tags` variable and `id`

## Usage
### Example 1
```hcl
module "label" {
source = "github.com/obytes/terraform-aws-tag.git?ref=v1.0.0"
source = "github.com/obytes/terraform-aws-tag.git?ref=v1.0.1"
environment = "dev"
project_name = "obytes"
region = "me-south-1"
Expand Down Expand Up @@ -62,7 +62,7 @@ tags = {

```hcl
module "label2" {
source = "github.com/obytes/terraform-aws-tag.git?ref=v1.0.0"
source = "github.com/obytes/terraform-aws-tag.git?ref=v1.0.1"
context = module.label1.context
name = "label2"
environment = "prd"
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ locals {
project_name = local.project_name
region = local.region
name = local.name
attributes = join(local.delimiter, local.formatted_attributes)
}

labels = [for l in local.prefix_order : local.id_structure[l] if length(local.id_structure[l]) > 0]
Expand Down
3 changes: 2 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ variable "context" {
attributes = null
tags = {}
additional_tags = {}
prefix_order = ["environment", "project_name", "region", "name"]
prefix_order = ["environment", "project_name", "region", "name", "attributes"]
prefix_length_limit = 0
regex_substitute_chars = null
tag_key_case = "title"
tag_value_case = "lower"
random_string = null
attributes = []
}

validation {
Expand Down

0 comments on commit b03631e

Please sign in to comment.