This module is used to create tags for different resources that are supported by tags.
- Create a well-versioned tagging schema.
- Create tags for different resources that are supported by tags.
- Define a tagging schema that is easy to understand and maintain.
- Create a tagging schema that is easy to implement in different cloud providers.
- Ability to understand resources created with their origin.
- Tags are used to identify resources in the cloud.
- Ability to create inventory reports accross multiple cloud providers and others resources that support tags
- Ability to identify the version of the tagging schema used to create the resources and create automation around it.
main.tf
module "tags" {
source = "CloudAtScale/tags/null"
version = "x.x.x"
git_project_url = var.git_project_url
team = "MyAwesomeTeam"
environment = "MyAwesomeEnvironment"
project_name = "MyAwesomeProject"
extra_tags = {
"extra_tag_1" = "extra_tag_1_value"
"extra_tag_2" = "extra_tag_2_value"
}
}
variables.tf
variable "git_project_url" {
type = string
description = "The URL of the git project"
}
env:
TF_VAR_git_project_url: ${{ github.repository }}
main.tf
module "tags" {
source = "CloudAtScale/tags/null"
version = "x.x.x"
vcs_provider = "gitlab"
git_project_url = var.git_project_url
gitlab_project_id = var.gitlab_project_id
team = "MyAwesomeTeam"
environment = "MyAwesomeEnvironment"
project_name = "MyAwesomeProject"
extra_tags = {
"extra_tag_1" = "extra_tag_1_value"
"extra_tag_2" = "extra_tag_2_value"
}
}
variables.tf
variable "git_project_url" {
type = string
description = "The URL of the git project"
}
variable "gitlab_project_id" {
type = string
description = "The ID of the gitlab project"
}
For Gitlab CI, use:
variables:
TF_VAR_git_project_url: $CI_PROJECT_URL
TF_VAR_gitlab_project_id : $CI_PROJECT_ID
This module is used to create tags for different resources that are supported by tags.
provider "aws" {
region = "us-west-2"
default_tags {
tags = module.tags.all_tags
}
}
Note: Most AWS resources support 50 tags per resource but some resources support only 10 tags per resource like AWS S3 Object. Please refer to the AWS documentation for more information.
All tags are returned in a map:
{
"ProjectName": "MyAwesomeProject",
"Onwer:Team": "MyAwesomeTeam",
"Environment": "MyAwesomeEnvironment",
"extra_tag_1": "extra_tag_1_value",
"extra_tag_2": "extra_tag_2_value",
"Compliance:TaggingSchemaVersion": "1.0.0"
}
Name | Version |
---|---|
terraform | >= 0.12.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | Environment name | string |
n/a | yes |
git_project_url | Git project url | string |
n/a | yes |
project_name | Project name | string |
n/a | yes |
team | Team name | string |
n/a | yes |
delimiter | Delimiter to be used between Prefix and key. | string |
":" |
no |
extra_tags | Extra tags | map(string) |
{} |
no |
gitlab_project_id | Gitlab project id | number |
null |
no |
vcs_provider | VCS provider | string |
"github" |
no |
Name | Description |
---|---|
all_tags | Tags |
environment | Environment |
extra_tags | Extra Tags |
git_project_url | Git Project URL |
gitlab_project_id | Gitlab Project ID |
project_name | Project Name |
team | Team |
vcs_provider | VCS Provider |
This module is most for example to show how to create tags for different resources that are supported by tags with a well-versioned tagging schema.