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

Fn::Range intrinsic function that would return a list of Strings, based on integers that are passed to it #148

Open
arthurboghossian opened this issue Nov 3, 2023 · 1 comment

Comments

@arthurboghossian
Copy link
Contributor

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

Tell us about your request

A new Fn::Range intrinsic function, which would take in either 1 or 2 integer parameters, and would return the corresponding range of integers in String format.

Tell us about the problem you are trying to solve. What are you trying to do, and why is it hard?

Have multiple CommaDelimitedList parameters that I would like to reference within the Resources I create in the Fn::ForEach intrinsic function (see example below). If this function exists, can leverage this and the Fn::Length intrinsic function to achieve what I want.

{
  "Fn::Range": [
    "5"
  ]
}

would return ["0", "1", "2", "3", "4"]

{
  "Fn::Range": [
    "4",
    "7"
  ]
}

would return ["4", "5", "6"]

Are you currently working around this issue?

I'd have to define a Mappings section with the corresponding mapping between the list of parameters that would be iterated over, and the other parameter values for the other properties I've defined.

Note: an alternative solution to this could be Item 2 in #118

What is the expected behavior with this new feature

Want to be able to do something like this:

Parameters:
  TopicNameList:
    Type: CommaDelimitedList
    Default: 'A,B,C'
  DisplayNameList:
    Type: CommaDelimitedList
    Default: 'D,E,F'
Resources:
  'Fn::ForEach::Topics':
    - Identifier
    - 'Fn::Range':
        - 'Fn::Length': !Ref TopicNameList
    - Topic${Identifier}:
        Type: AWS::SNS::Topic
        Properties:
          TopicName: !Select [!Ref Identifier, !Ref TopicNameList]
          DisplayName: !Select [!Ref Identifier, !Ref DisplayNameList]
@josb
Copy link

josb commented Nov 7, 2023

Please make them Numbers. Type support in CloudFormation is already poor, let's not make it worse.

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

No branches or pull requests

2 participants