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

Give control over resources names #18

Open
sdib opened this issue Feb 10, 2021 · 8 comments
Open

Give control over resources names #18

sdib opened this issue Feb 10, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@sdib
Copy link

sdib commented Feb 10, 2021

Consumers of the module may want to control the name of the created resources, for example if they have a naming convention to follow.

@jcorioland
Copy link
Collaborator

Hi @sdib - thanks for submitting the issue. This makes a lot of sense. Are you willing to submit a PR for that one?

@jcorioland jcorioland added the enhancement New feature or request label Feb 10, 2021
@sdib
Copy link
Author

sdib commented Feb 11, 2021

Hi @jcorioland, yes I think I can propose something.
I'm wondering how this should be implemented :

  • optional feature ? for me yes to keep backward compatibility
  • 1 new string variable per name pattern or 1 new object variable with as many attributes as names we have or add new attributes to linux / windows configuration existing variables (would break backward compatibility I guess) ?

Any thoughts from your side ?

@jcorioland
Copy link
Collaborator

Hi @sdib - I need to think about it, but for sure it must be optional. Can you try to make a design proposal here so we can discuss about how the TF configuration could looks like with this change? Thank you!

@sdib
Copy link
Author

sdib commented Feb 17, 2021

Hello @jcorioland, here are 2 proposals :

1 =>

variable "name_patterns" {
  type = object({
    linux_network_profile_pattern     = string
    linux_network_interface_pattern   = string
    linux_ip_configuration_pattern    = string
    linux_container_group_pattern     = string
    linux_agent_pattern               = string
    windows_network_profile_pattern   = string
    windows_network_interface_pattern = string
    windows_ip_configuration_pattern  = string
    windows_container_group_pattern   = string
    windows_agent_pattern             = string
  })

  default = null
}

caveat I see with this one, is that if you want to control only 1 resource name, you need to provide a pattern for each (until terraform 0.15 comes with optional attributes). Maybe we want to wait this optional attributes feature from terraform to be available before implementing this ?

2 =>

variable "linux_network_profile_pattern" {
  type = string
  default = null
}

variable "linux_network_interface_pattern" {
  type = string
  default = null
}

variable "linux_ip_configuration_pattern" {
  type = string
  default = null
}

variable "linux_container_group_pattern" {
  type = string
  default = null
}

variable "linux_agent_pattern" {
  type = string
  default = null
}
variable "windows_network_profile_pattern" {
  type = string
  default = null
}
variable "windows_network_interface_pattern" {
  type = string
  default = null
}
variable "windows_ip_configuration_pattern" {
  type = string
  default = null
}
variable "windows_container_group_pattern" {
  type = string
  default = null
}
variable "windows_agent_pattern" {
  type = string
  default = null
}

this one offers more fine grained control, but a lot of inputs and <linux/windows>_container_group_pattern may be confusing with the <linux/windows>_agents_configuration.agent_name_prefix

@jcorioland
Copy link
Collaborator

Hi @sdib, thanks for the two options proposed. I have a preference for the first one also, that is lighter approach as you can define only the properties that are relevant for you on the complex object, if I am not mistaken. This looks good way to proceed to me!

@jcorioland
Copy link
Collaborator

Hey @sdib, have you been able to make some progress on this item?

@aafre
Copy link

aafre commented Feb 19, 2022

I ran into this issue at my org where we have a naming policy for resources. Is there an ETA for this update?

@jcorioland
Copy link
Collaborator

Hi @aafre - unfortunately we have no ETA for this item, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants