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

Allow reducing the suffix length appended to instance templates name_prefix #15374

Closed
ralbertazzi opened this issue Aug 2, 2023 · 5 comments
Closed

Comments

@ralbertazzi
Copy link

ralbertazzi commented Aug 2, 2023

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. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Instance template resources provide a great name_prefix variable that allows using instance templates effectively on top of instance group managers. From what I can observe on the Google Cloud Console (which is validated by the equivalent code) a date-like suffix is appended to the name_prefix so that changes to instance templates in Terraform can result in the creation of different template resources with different names.

In our project we use a high number of instance groups (and corresponding templates) for which we'd like to set self-explanatory names, where ideally the instance group name is equal to the name prefix of its instance template. However, this is sometimes not possible because of the 37 characters length limitation required by the name_prefix. In this case, we have to come up with shorter names that feel like a hack and are not really self-explanatory.

While I see the reason for the suffix to be appended, I'm wondering if it would be possible to make it configurable such that we can append a shorter suffix, leaving more characters to the name_prefix. For instance I see that the suffix has some format 20230801144601276600000001 which contains the creation date up to seconds granularity (20230801144601) plus an extra suffix (276600000001). Since I don't expect in my case to create multiple instance templates with the same name_prefix within 1 second, I would be fine having just the first part of the suffix and dropping the second one. Another idea would be to use a short hash (4-6 characters) of the instance template parameters, which would leave me with almost 60 characters usable for the name_prefix.

New or Affected Resource(s)

  • google_compute_region_instance_template
  • google_compute_instance_template

b/312433567

@rileykarson
Copy link
Collaborator

rileykarson commented Aug 7, 2023

We'd evaluate changing the default for all resources here as part of a major version. We don't want to add a knob, or change the format in a minor version.

@c2thorn
Copy link
Collaborator

c2thorn commented May 28, 2024

Noting that we are intending to reduce the appended suffix in name_prefix globally, essentially changing the default value for many resources. This is a breaking change and is intended for the 6.0.0 major release.

@c2thorn
Copy link
Collaborator

c2thorn commented Aug 14, 2024

Noting that we are intending to reduce the appended suffix in name_prefix globally, essentially changing the default value for many resources. This is a breaking change and is intended for the 6.0.0 major release.

We couldn't land on a new global UUID suffix that we felt wasn't prone to collisions. So we are keeping the current behavior for name_prefix's less than 38 characters, but allowing a new max of up to 54 characters with a shortened UUID suffix.

Current configs should not see the new behavior when upgrading to 6.0 unless changing the name_prefix to a length of 38 - 54 characters.

Resulting name for a name_prefix <= 37 characters:
name_prefix + YYYYmmddHHSSssss + 8 digit incremental counter
Resulting name for a name_prefix 38 - 54 characters:
name_prefix + YYmmdd + 3 digit incremental counter

@c2thorn
Copy link
Collaborator

c2thorn commented Aug 16, 2024

closed with GoogleCloudPlatform/magic-modules#11448

@c2thorn c2thorn closed this as completed Aug 16, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants