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

[WIP] Add interpolate uuid function #3563

Closed
wants to merge 1 commit into from

Conversation

gjohnson
Copy link

Mostly just an exposed version of the uuid function added by @phinze and @radeksimko for resources.

I thought about adding a size parameter to control the length of the generated id (would make it more of a uid than a legit uuid though), thoughts?

To Do

  • discuss size limit
  • cleanup test to use testFunctionCase
  • docs

@gjohnson
Copy link
Author

This doesn't solve everything in #2269 yet, mostly assumes you'll use ignore_changes for now.

@@ -33,6 +34,7 @@ func init() {
"split": interpolationFuncSplit(),
"base64encode": interpolationFuncBase64Encode(),
"base64decode": interpolationFuncBase64Decode(),
"uuid": interpolationFuncUuid(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run gofmt on this? That will line up these declarations.

@phinze
Copy link
Contributor

phinze commented Oct 29, 2015

This is looking good! A few minor comments and needs a rebase, but then this should be good to go. 👍

@phinze
Copy link
Contributor

phinze commented Oct 29, 2015

I thought about adding a size parameter to control the length of the generated id (would make it more of a uid than a legit uuid though), thoughts?

I'd be down for a second optional parameter that simply trims the string to a given max length - provided we document that it removes the uniqueness properties of RFC 4122 and increases the chance of collision.

uuid() -> "terraform-{uuid}"
uuid("foo-") -> "foo-{uuid}"
uuid("foo-", 12) -> "foo-{uuid}"[:12]

@apparentlymart apparentlymart mentioned this pull request Nov 18, 2015
@jason-riddle
Copy link
Contributor

Curious. What is the status on this?

@bigkraig
Copy link
Contributor

bigkraig commented Feb 9, 2016

👍

@phinze phinze changed the title Add interpolate uuid function [WIP] Add interpolate uuid function Feb 9, 2016
@phinze phinze removed the wip label Feb 9, 2016
@bigkraig
Copy link
Contributor

bigkraig commented Mar 1, 2016

hey @gjohnson any chance you can rebase this?

@phinze
Copy link
Contributor

phinze commented Mar 11, 2016

Hey folks, I ended up revisiting this over in #5575 and taking a slightly different approach on the implementation. If we want a second function that works more like Terraform's internal PrefixedUniqueId we can consider that, but for the function we call uuid() I think it's best for it to be more of a standard style. 👍

Thanks for the work you put into this @gjohnson!

@phinze phinze closed this Mar 11, 2016
@ghost
Copy link

ghost commented Apr 27, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants