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

cf.dereference() #13

Closed
rclark opened this issue Feb 17, 2017 · 4 comments
Closed

cf.dereference() #13

rclark opened this issue Feb 17, 2017 · 4 comments

Comments

@rclark
Copy link
Contributor

rclark commented Feb 17, 2017

A method that would take:

  • env: object defining values for psuedo parameters like AWS::StackName
  • parameters: object defining values for parameters
  • template: a template

Would return the template with all psuedo parameters and intrinsic functions dereferenced.

cc @ianshward @k-mahoney

@rclark
Copy link
Contributor Author

rclark commented Feb 19, 2017

I got the logic working here, but there's an extremely tedious busywork step that remains. In order to dereference Fn::GetAtt and Ref against resources, you need to know what Ref refers to and what attributes are available for Fn:GetAtt for each resource type.

Resource types, and an example of the Return Values section.

I wrote an HTML scraper, scraped the docs and built a JSON file that isolates the text from Return Values sections for each type, but its not consistent enough to automate conversion --> the JS code needed.

I think I'll just have to prioritize and chip away at the types over time.

@rclark rclark mentioned this issue Feb 19, 2017
3 tasks
@rclark
Copy link
Contributor Author

rclark commented Feb 19, 2017

@k-mahoney @ianshward for your purposes, how accurate do resource dereferences need to be? For example, let's say my resource defines an SQS queue.

{ "Fn::GetAtt" :["MyQueue", "QueueName"] }

This is supposed to give you the name of the queue. If the JSON defining the queue itself included a .Properties.Name value, then we can know exactly what the queue's name will be. But if you didn't specify that property, CloudFormation would assign a name something like:

MyStack-MyQueue-1A2B3C4D

Most of the time, resources don't let you assign a .Properties.Name, so most of the time, we can't really honestly resolve a { "Ref": "SomeThing" }. If we're trying to dereference all the values in the template prior to the template being deployed, there's no way for us to know the random string that CloudFormation will assign to the resource.

Is this important for your use case?

@k-mahoney
Copy link

Thanks again for taking this on @rclark! Still working through wrapping my head around #14.

The dereferencing function as it stands should work well with our proposed use case and the changes we need to make for testing. I don't think expanding coverage for all the assorted resource attributes is critical at this juncture, but I'm happy to contribute on that front if I can.

Hadn't considered the issue of attempting to reference specific IDs generated upon deployment prior to doing so, that's an interesting problem... not a requirement for our use case though.

@rclark
Copy link
Contributor Author

rclark commented Aug 17, 2018

We moved in other directions here.

@rclark rclark closed this as completed Aug 17, 2018
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

Successfully merging a pull request may close this issue.

2 participants