cfn-language-discussion icon indicating copy to clipboard operation
cfn-language-discussion copied to clipboard

New Function Request Fn::Generate

Open ghost opened this issue 6 years ago • 4 comments

enhancement request to develop some new functions that generate values, they may be static and are never changed once created or they may be dynamic and are updated on each cloud formation stack update.

This will remove the need to the create of custom resources and the complicity of developing and macros.

/// generates UUID when resource is created. 
{ "Fn::Generate" : [ "UUID", "Static" ] }
/// generates UUID when resource is created and will generate a new value on update. 
{ "Fn::Generate" : [ "UUID", "Dynamic" ] }

/// generates Unix timestamp when resource is created. 
{ "Fn::Generate" : [ "Timestamp", "Static" ] }
/// generates Unix timestamp when resource is created and will generate a new value on update. 
{ "Fn::Generate" : [ "Timestamp", "Dynamic" ] }

/// generates random text value of the length 12  when resource is created. 
{ "Fn::Generate" : [ "RandomText", "Static" ] }
/// generates random text value of the length 12 when resource is created and will generate a new value on update. 
{ "Fn::Generate" : [ "RandomText", "Dynamic" ] }

/// generates random number value of the length 12  when resource is created. 
{ "Fn::Generate" : [ "RandomNumber", "Dynamic" ] }
/// generates random number value of the length 12 when resource is created and will generate a new value on update. 
{ "Fn::Generate" : [ "RandomNumber", "Static" ] }

ghost avatar Aug 02 '19 10:08 ghost

I love this idea.

Instead of "Static" and "Dynamic", maybe we can have the concept of passing a seed value to it?

If you don't provide a seed, then it's considered Dynanic and will be a truly random (at least for UUID, RandomText, RandomNumber, it wouldn't apply to Timestamp).

If you provide a seed, that seed is used to generate the value such that if the seed doesn't change, the value doesn't either.

Bonus points if I can specify the min/max values for the numbers, and the allowed characters for the RandomText.

Ricapar avatar Aug 02 '19 13:08 Ricapar

sounds good to me, lets keep getting this up voted !

On Fri, 2 Aug 2019 at 14:52, Rich Acosta [email protected] wrote:

I love this idea.

Instead of "Static" and "Dynamic", maybe we can have the concept of passing a seed value to it?

If you don't provide a seed, then it's considered Dynanic and will be a truly random (at least for UUID, RandomText, RandomNumber, it wouldn't apply to Timestamp).

If you provide a seed, that seed is used to generate the value such that if the seed doesn't change, the value doesn't either.

Bonus points if I can specify the min/max values for the numbers, and the allowed characters for the RandomText.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/86?email_source=notifications&email_token=AKBPQZQRLOH46GZBHWYUDI3QCQ32HA5CNFSM4II4IY4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3NZYTQ#issuecomment-517708878, or mute the thread https://github.com/notifications/unsubscribe-auth/AKBPQZXRKVVM4KASKKVXUO3QCQ32HANCNFSM4II4IY4A .

--

Steven Cuthill DevOps Manager

[email protected] www.onthemarket.com

Download the OnTheMarket.com app...

https://itunes.apple.com/gb/app/onthemarket.com-property-search/id960416200?mt=8 https://play.google.com/store/apps/details?id=com.onthemarket.mobile&hl=en_GB

Follow us on...

https://www.facebook.com/Onthemarketcom-1500133890261960/ https://twitter.com/OnTheMarketCom https://www.linkedin.com/company/onthemarket

ghost avatar Aug 02 '19 14:08 ghost

I think "Static" and "Dynamic" are good, as they don't rely on the user providing unique values and differentiate between always changing and staying the same. Then "Static" can by default use CloudFormation-provided randomness, but optionally take a seed.

benkehoe avatar Aug 02 '19 15:08 benkehoe

seen AWS::StackId psuedoparameter used for some similar use cases

PatMyron avatar Oct 06 '20 00:10 PatMyron