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

Cloudformation inllining #65

Merged
merged 3 commits into from
Oct 9, 2018
Merged

Conversation

toshke
Copy link
Member

@toshke toshke commented Sep 5, 2018

Improvements

  1. Docker image updated to run of ruby 2.5

  2. cfpublish command will show both launch stack url and template url for updating the stack

  3. MappingParam changes - if there is no mapping (e.g. EnvironmentType) for given mapping parameter, it will bubble to outer component, like rest of the parameters, rather than failing on compilation.

  4. Cfhighlander::Util::Debug class available for core developers, to dump cloudformation model at any stage of compilation at the disk. This was useful during this feature development, to narrow down bug hunt to particular compilation phase.

New Features

FnJoin

FnJoin added as available intrinsic function in highlander templates.

Implements #27 - Render mode for components

Rendering component resources in resulting cloudformation stack is available in 2 modes. This modes
are controlled using render keyword of Component DSL statement

Substack - creates additional substack for cfhighlander component and points to it using CloudFormation
Stack
resource type
This is also default render mode - if no render mode is specified Substack will be used

Inline - places all defined resources from inner component in outer component cloudformation template. Resources,
Outputs, Conditions, Parameters and Mappings are all inlined - please note that some of the template elements may be renamed in this
process in order to assure unique names.

There are some limitations when using inline components - Inlined component parameters, having values as outputs from another component (inlined or not)
can't be referenced in component conditions. However, conditions referencing mapping values or parameters passed as mapping values,
are allowed.

SIDE EFFECTS Side effect of moving from substack based to fully inlined stack may be revealing some of the implicit dependencies within an environment

Example: Component A defines Hosted Zone, while component B defines Record Set for given hosted zone. Record set is defined
by referencing Zone Name (rather than ZoneId), meaning there is no explicit dependency between the resources. When both components
are rendered as substack, implicit dependency is created if there is at least one output from component A passed as parameter
to component B. Rendering components inlined removes this implicitly defined dependency, as a consequence stack deletion or creation
may be halted, as record set is being created/deleted before prior the record set.

WARNING Be aware of resource, condition, parameter, output and mapping limits on a single template
when rendering inner components inlined.

EXAMPLE All of the VPC resources will be rendered in outer component template, while bastion
will be referenced as substack in example below.

CfhighlanderTemplate do

    Component template:'vpc@1.5.0', name: 'vpc', render: Inline
    Component template:'bastion@1.2.0', name: 'bastion', render: Substack

end

Copy link
Member

@aaronwalker aaronwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other changes request :)

README.md Outdated
@@ -683,6 +683,46 @@ CfhighlanderTemplate do
end

```
## Render mode for components

Rendering component resources in resulting cloudformation stack is available in 2 modes. This modes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/This/These

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

.gitignore Show resolved Hide resolved
vpc_config = { 'maximum_availability_zones' => 5 }

hosted_zone = FnJoin('.',[Ref('AWS::Region'), Ref('AWS::AccountId'), 'cfhighlander.info'])
vpc_template = 'github:toshke/hl-component-vpc#inline_poc'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe push these to a branch on the upstream repos and they update the test. We can then update the tests once they are merged. Or should be even reference external components in the core tests? maybe create a seperate testsuite?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test.cfhighlander.rb is actually not used in rspec tests - c.cfhighlander.rb is. i've removed this file for commit - it was there as an example.

Copy link
Member

@Guslington Guslington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toshke toshke merged commit f058695 into theonestack:develop Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants