-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Add option to limit output id length #98
Conversation
And add new output full_id which is not limited
main.tf
Outdated
@@ -56,7 +56,14 @@ locals { | |||
|
|||
labels = [for l in local.label_order : local.id_context[l] if length(local.id_context[l]) > 0] | |||
|
|||
id = lower(join(local.delimiter, local.labels)) | |||
full_id = lower(join(local.delimiter, local.labels)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use id_full
to be consistent with the other ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@osterman Updated 👍
By review suggestion
@osterman Sorry to disagree with you, but since this is a new feature, anyone who wants to use it will have to make changes. Therefore, I think we should retain
|
@Nuru @aknysh No, this PR has no breaking behavior or require any changes in existing usages. The |
Then no need to change the original ID at all, and no need to change its logic because many people are using it now. |
I understand why would you want to be able to modify the original ID - to keep the caller code the same (using just the
or
|
Yes exactly, in my mind it was more intuitive to not have to use a different output just because you have set a length limit. If you do set the |
Ya the benefit with @tibbing approach is that it works seamlessly provided we add the max len input. Also since it defaults to zero, it has no effect unless the user overrides it. I like supporting the explicit outputs as well, but that doesn't work unless a module implements support for choosing the id. I think setting the max len should be used sparingly by end users as needed and this gives users an escape hatch when needed, that our modules currently do not provide. |
Co-authored-by: Andriy Knysh <aknysh@users.noreply.github.com>
/terraform-fmt |
/rebuild-readme |
/test all |
what
id_max_length
, that when set to a value greater than 0 will limit the length of ID output to given value.id_fulll
.id_max_length
is 0, so that the change is not breaking any existing usages.why
id_max_length
variable ensures that the max length is never exceeded, no matter the number of included attributes.references