Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

examples for using intrinsic functions #31

Closed
iancoffey opened this issue Aug 24, 2017 · 9 comments
Closed

examples for using intrinsic functions #31

iancoffey opened this issue Aug 24, 2017 · 9 comments

Comments

@iancoffey
Copy link

iancoffey commented Aug 24, 2017

It would be great to have an example or two around building resources that make use of the intrinsic functions inside templates. The cloudformation package seems to have no concept of them. Im unclear how to achieve this, but perhaps Im missing something.

@pesama
Copy link
Contributor

pesama commented Aug 24, 2017

Hi Ian,

GoFormation currently uses intrinsic function resolution to resolve parameters present within the scope of the template. This allow GoFormation to be able to work with this template - excerpt:

Parameters: 
  FunctionTimeout:
    Type: Number
    Default: 20
Resources:
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      ...
      Timeout: 
        Ref: FunctionTimeout

Can you please elaborate more on what you mean by the cloudformation package seems to have no concept of them? What would you like to see as an example?

@iancoffey
Copy link
Author

iancoffey commented Aug 24, 2017

@pesama Thanks! I think I get what you're referring to. Perhaps a README example might be a good idea? Im going to close this, cheers.

@iancoffey
Copy link
Author

iancoffey commented Aug 24, 2017

@pesama Pardon, I spoke too soon! To answer your question, I was referring to there being no obvious equivalent to something like this. As in, when building resources that make use of Ref for example, how should that be specified in the resource struct?

The example you gave is yaml, determining how would you build that same resource definition from AWSServerlessFunction quickly was the specific question.

@pesama
Copy link
Contributor

pesama commented Aug 24, 2017

Thanks for the clarification @iancoffey. Currently, GoFormation's functionality for creating a template from a struct will use only direct values on the properties. Hence, I'm reopening this issue and tagging it as feature request.

@ktruckenmiller
Copy link

ktruckenmiller commented Jan 27, 2018

Yeah I'm having trouble with this as well. I'm new to go, so obviously this syntax won't work. But how would I pass a Sub or Ref to this env var to this using goformation?

Environment: &cloudformation.AWSLambdaFunction_Environment{
      Variables: map[string]string{
          "CLUSTER": cluster.Cluster.Name,
          "ASGPREFIX": Sub("${ClusterName}-asg-${Version}"),
          "REGION": Ref("AWS::Region"),
  },
},

@sfzylad
Copy link

sfzylad commented Feb 26, 2018

@pesama Thanks for accepting this as feature request. Will be great to see it working. Can you give some estimate when-ish to expect this to be addressed?

Thank you,

@defunct73
Copy link

@pesama coming up on a year for this request, is there any ETA? Not being able to specify !Sub, !Join, !Ref, etc... as values makes it a non-starter for using this library.

@PaulMaddox
Copy link
Contributor

I've just created a PR to add this functionality - it will be merged as soon as the travis ci build/tests finish.

@PaulMaddox
Copy link
Contributor

This is now merged - check out the examples in the README for details of how to use cloudformation.Ref() and other intrinsic functions.

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

6 participants