Code Monkey home page Code Monkey logo

terraform-azurerm-rg's Issues

[BUG] name_suffix does not work as expected or not documented properly

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.4.6

AzureRM Provider Version

3.61.0

Affected Resource(s)/Data Source(s)

azurerm_resource_group

Terraform Configuration Files

I'm using Terragrunt, but essentially what I do is


locals {
  g_vars = read_terragrunt_config(find_in_parent_folders("global.hcl"))
  e_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
  r_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))

  path_suffix = g_vars.locals.path_suffix

  resource_name_suffix = "001"

  tags = merge(
    local.g_vars.inputs.global_tags,
    local.e_vars.inputs.env_tags,
    local.r_vars.inputs.region_tags,
    {
      # any additional local tags
      tf_path = "${local.path_suffix}/${path_relative_to_include()}"
  })
}
inputs = {
  # use values merged from included configs
  location    = dependency.region.outputs.location
  name        = dependency.region.outputs.name
  name_suffix = local.resource_name_suffix

  extra_tags = merge(
    local.tags
  )
}

Debug Output/Panic Output

Terraform will perform the following actions:

  # azurerm_resource_group.main_rg will be created
  + resource "azurerm_resource_group" "main_rg" {
      + id       = (known after apply)
      + location = "eastus"
      + name     = "rg-infra-xxx-prod"
      + tags     = {
          + "client"     = "xxx"
          + "env"        = "prod"
          + "repository" = "xxx"
          + "stack"      = "infra"
          + "tf_managed" = "true"
          + "tf_path"    = "envs/prod/eastus/rg-001"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + resource_group_id       = (known after apply)
  + resource_group_location = "eastus"
  + resource_group_name     = "rg-infra-xxx-prod"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.


### Expected Behaviour

Resource name should be `rg-infra-xxx-prod-001`

### Actual Behaviour

REsource is `rg-infra-xxx-prod`

### Steps to Reproduce

_No response_

### Important Factoids

_No response_

### References

_No response_

[FEAT] Add support for lifecycle ignored tags

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I'm wondering if it would be possible to extend the default tags with new tags indicating who/what and when created a particular resource group, that is, something like:

  tags = {
    created_at = timestamp()
    created_by = data.azuread_directory_object.terraform.object_id
  }

Perhaps it could be added via a new set of tags, along with default and extra, and controlled with new variable creator_tags_enabled.

Perhaps such feature would be sensible across all modules creating resources where tags are supported.
I'd be interested to hear your comments on this idea.

New or Affected Resource(s)/Data Source(s)

azurerm_resource_group

Potential Terraform Configuration

resource "azurerm_resource_group" "main" {
  name     = data.azurecaf_name.main_rg.result
  location = module.azure_region.location

  tags = {
    created_at = timestamp()
    created_by = data.azuread_directory_object.terraform.object_id
  }

References

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.