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

Can't use parameters of type List<> #282

Open
ndeloof opened this issue May 12, 2020 · 4 comments
Open

Can't use parameters of type List<> #282

ndeloof opened this issue May 12, 2020 · 4 comments

Comments

@ndeloof
Copy link
Contributor

ndeloof commented May 12, 2020

I'd like to define a template parameter as List<AWS::EC2::Subnet::Id>
but I can't set directly Subnets: cloudformation.Ref("SubnetIds") as expected API type is []string while Ref return a single string.

I tried using []string{ cloudformation.Split(",", cloudformation.Ref("SubnetIds")), this produces template:

"Subnets": [
              {
                "Fn::Split": [
                  ",",
                  {
                    "Ref": "SubnetIds"
                  }
                ]
              }
]

This seems valid to me, but fail to validate :
ValidationError: Template error: every Fn::Split object requires two parameters, (1) a string delimiter and (2) a string to be split or a function that returns a string to be split.

Did I miss something ? Is there a better approach to manage List<> references ?

@xrn
Copy link
Contributor

xrn commented Jul 29, 2020

@ndeloof did you solved that issue maybe?

@ndeloof
Copy link
Contributor Author

ndeloof commented Jul 29, 2020

nope

@xrn
Copy link
Contributor

xrn commented Sep 22, 2020

I need also to achieve this - seems that cloudformation.Split(",", cloudformation.Ref("SubnetIds") is incorrect from the perspective of cloudformation. Second side is that goformation is expecting []string probably in this place it should be replaced to interface{}

@xrn
Copy link
Contributor

xrn commented Sep 23, 2020

@ndeloof I solved that problem - please take a look on #309 and then use just cloudformation.Join(",", cloudformation.Ref("SubnetIds")) <- this will return String [A,B] - then you can use split, select etc

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