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

Feature: PreCondition / TemplateCondition #30

Open
vsmart opened this issue Jul 4, 2018 · 1 comment
Open

Feature: PreCondition / TemplateCondition #30

vsmart opened this issue Jul 4, 2018 · 1 comment

Comments

@vsmart
Copy link
Contributor

vsmart commented Jul 4, 2018

Summary We need a feature PreCondition or TemplateCondition that allows for specifying a condition on a resource being included in template building.

Use Case: We currently use Condition: NotInChina for resources that are not applicable to China.

This breaks for resources that are not at all available in China, e.g. KMS.
The template is validated before any conditions are applied, which fails if the resource does not exist in AWS-CN. We need a condition that removes these resources before sending it to CFN.

Example:

KmsAccess: {
   Action: ‘Kms:Decrypt’,
   Effect: ‘Allow’, 
   Resource: ‘kms:keys:*’, 
   PreCondition: ‘NotInChina’
}

The resource should be removed from the template object, before being submitted to Cloudformation.

This may require a change in /cfn-config also, since cloudfriend itself is region/deploy-agnostic I think.

cc @mapbox/platform

@vsmart
Copy link
Contributor Author

vsmart commented Jul 4, 2018

Capturing from chat w @rclark :

If you have to get the resources removed from the template, I think you will have to make the “template” a function that sends the json in a callback
This will help because cfn-config will pass some options to your function
Including the region
Basically your .template.js just exports a function that takes 2 arguments: options and callback
The function needs to build the template, then pass it to callback(null, template)
In cli there is a place in template.js that defines what options will be passed to your function
You would do the filtering in your async template function itself
cli will invoke your async function when it needs your template json
It will expect your function to send it json via callback

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

1 participant