Skip to content

Commit 0265659

Browse files
authored
restructure module type docs, reword some references to cfngin (#206)
1 parent 6e5a954 commit 0265659

File tree

13 files changed

+405
-391
lines changed

13 files changed

+405
-391
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#################
2+
Advanced Features
3+
#################
4+
5+
Advanced features and detailed information for using Runway's CFNgin for CloudFormation modules.
6+
7+
.. toctree::
8+
:glob:
9+
:maxdepth: 2
10+
11+
blueprints
12+
hooks
13+
lookups
14+
templates

docs/source/cfngin/blueprints.rst

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
1-
.. _Blueprint: term-cfngin-blueprint
2-
.. _Blueprints: Blueprint
3-
.. _Property Type: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-property-reference.html
4-
.. _Resource Type: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
51
.. _Runway blueprints: https://github.com/onicagroup/runway/tree/master/src/runway/blueprints
62
.. _troposphere: https://github.com/cloudtools/troposphere
73

4+
.. _Blueprint:
5+
.. _Blueprints:
86

97
==========
108
Blueprints
119
==========
1210

13-
Blueprints_ are python classes that dynamically build CloudFormation templates.
14-
Where you would specify a raw Cloudformation template in a stack using the ``template_path`` key, you instead specify a Blueprint_ python file using the ``class_path`` key.
11+
:ref:`Blueprints <term-blueprint>` are python classes that dynamically build CloudFormation templates.
12+
Where you would specify a raw Cloudformation template in a stack using the ``template_path`` key, you instead specify a :ref:`Blueprint <term-blueprint>` python file using the ``class_path`` key.
1513

16-
Traditionally Blueprints_ are built using troposphere_, but that is not absolutely necessary.
14+
Traditionally :ref:`Blueprints <term-blueprint>` are built using troposphere_, but that is not absolutely necessary.
1715

1816
Making your own should be easy, and you can take a lot of examples from `Runway blueprints`_.
19-
In the end, all that is required is that the Blueprint_ is a subclass of ``runway.cfngin.blueprints.base`` and it have the following methods:
17+
In the end, all that is required is that the :ref:`Blueprint <term-blueprint>` is a subclass of ``runway.cfngin.blueprints.base`` and it have the following methods:
2018

2119
.. code-block:: python
2220
23-
# Initializes the Blueprint
24-
def __init__(self, name, context, mappings=None):
21+
# Initializes the Blueprint
22+
def __init__(self, name, context, mappings=None):
2523
26-
# Updates self.template to create the actual template
27-
def create_template(self):
24+
# Updates self.template to create the actual template
25+
def create_template(self):
2826
29-
# Returns a tuple: (version, rendered_template)
30-
def render_template(self):
27+
# Returns a tuple: (version, rendered_template)
28+
def render_template(self):
3129
3230
3331
Variables
@@ -105,8 +103,8 @@ TroposphereType
105103
---------------
106104

107105
The ``TroposphereType`` can be used to generate resources for use in the
108-
Blueprint_ directly from user-specified configuration. Which case applies depends
109-
on what ``type`` was chosen, and how it would be normally used in the Blueprint_
106+
:ref:`Blueprint <term-blueprint>` directly from user-specified configuration. Which case applies depends
107+
on what ``type`` was chosen, and how it would be normally used in the :ref:`Blueprint <term-blueprint>`
110108
(and CloudFormation in general).
111109

112110
Resource Types
@@ -124,6 +122,8 @@ and the corresponding *values* are themselves dictionaries, to be used as
124122
parameters for creating each of multiple ``type`` objects. A list of those
125123
objects will be stored in the variable.
126124

125+
.. _Resource Type: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
126+
127127
Property Types
128128
^^^^^^^^^^^^^^
129129

@@ -138,6 +138,8 @@ When ``many`` is enabled, a list of dictionaries is expected. For each element,
138138
one corresponding call will be made to the ``type`` constructor, and all the
139139
objects produced will be stored (also as a list) in the variable.
140140

141+
.. _Property Type: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-property-reference.html
142+
141143
Optional variables
142144
^^^^^^^^^^^^^^^^^^
143145

@@ -321,8 +323,8 @@ Below is an annotated example:
321323
Utilizing Stack name within your Blueprint
322324
==========================================
323325

324-
Sometimes your Blueprint_ might want to utilize the already existing stack name
325-
within your Blueprint_. CFNgin provides access to both the fully qualified
326+
Sometimes your :ref:`Blueprint <term-blueprint>` might want to utilize the already existing stack name
327+
within your :ref:`Blueprint <term-blueprint>`. Runway's CFNgin provides access to both the fully qualified
326328
stack name matching what’s shown in the CloudFormation console, in addition to
327329
the stacks short name you have set in your YAML config.
328330

@@ -336,7 +338,7 @@ namespace is ``CFNginIsCool`` and the stacks short name is
336338

337339
CFNginIsCool-myAwesomeEC2Instance
338340

339-
To use this in your Blueprint_, you can get the name from context using ``self.context.get_fqn(self.name)``.
341+
To use this in your :ref:`Blueprint <term-blueprint>`, you can get the name from context using ``self.context.get_fqn(self.name)``.
340342

341343
Referencing the Stack short name
342344
--------------------------------
@@ -348,7 +350,7 @@ short name would be::
348350

349351
myAwesomeEC2Instance
350352

351-
To use this in your Blueprint_, you can get the name from self.name: ``self.name``
353+
To use this in your :ref:`Blueprint <term-blueprint>`, you can get the name from self.name: ``self.name``
352354

353355
Example
354356
^^^^^^^
@@ -398,7 +400,7 @@ Below is an annotated example creating a security group:
398400
Testing Blueprints
399401
==================
400402

401-
When writing your own Blueprints_ its useful to write tests for them in order
403+
When writing your own :ref:`Blueprints <term-blueprint>` its useful to write tests for them in order
402404
to make sure they behave the way you expect they would, especially if there is
403405
any complex logic inside.
404406

0 commit comments

Comments
 (0)