From 37943ff5e0d927efde8e0e53fa8e0c61b4a67ce2 Mon Sep 17 00:00:00 2001 From: hezijie Date: Sat, 6 May 2023 12:37:41 +0800 Subject: [PATCH] update readme --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/README.md b/README.md index 0f6afdc..078582a 100644 --- a/README.md +++ b/README.md @@ -308,6 +308,60 @@ output "windows_vm_private_ips" { ``` +## Enable or disable tracing tags + +We're using [BridgeCrew Yor](https://github.com/bridgecrewio/yor) and [yorbox](https://github.com/lonegunmanb/yorbox) to help manage tags consistently across infrastructure as code (IaC) frameworks. In this module you might see tags like: + +```hcl +resource "azurerm_resource_group" "rg" { + location = "eastus" + name = random_pet.name + tags = merge(var.tags, (/**/ (var.tracing_tags_enabled ? { for k, v in /**/ { + avm_git_commit = "3077cc6d0b70e29b6e106b3ab98cee6740c916f6" + avm_git_file = "main.tf" + avm_git_last_modified_at = "2023-05-05 08:57:54" + avm_git_org = "lonegunmanb" + avm_git_repo = "terraform-yor-tag-test-module" + avm_yor_trace = "a0425718-c57d-401c-a7d5-f3d88b2551a4" + } /**/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /**/)) +} +``` + +To enable tracing tags, set the variable to true: + +```hcl +module "example" { + source = "{module_source}" + ... + tracing_tags_enabled = true +} +``` + +The `tracing_tags_enabled` is default to `false`. + +To customize the prefix for your tracing tags, set the `tracing_tags_prefix` variable value in your Terraform configuration: + +```hcl +module "example" { + source = "{module_source}" + ... + tracing_tags_prefix = "custom_prefix_" +} +``` + +The actual applied tags would be: + +```text +{ + custom_prefix_git_commit = "3077cc6d0b70e29b6e106b3ab98cee6740c916f6" + custom_prefix_git_file = "main.tf" + custom_prefix_git_last_modified_at = "2023-05-05 08:57:54" + custom_prefix_git_org = "lonegunmanb" + custom_prefix_git_repo = "terraform-yor-tag-test-module" + custom_prefix_yor_trace = "a0425718-c57d-401c-a7d5-f3d88b2551a4" +} +``` + ## Pre-Commit & Pr-Check & Test ### Configurations