Skip to content

Commit

Permalink
Release/0.0.31 (#29)
Browse files Browse the repository at this point in the history
Added depends_on capabilities for the launches within the manifest.  You can now say launch a depends_on launch but you cannot say a depends_on b which then depends_on c
  • Loading branch information
eamonnfaherty committed May 3, 2019
1 parent 6ceb670 commit 5fa7ff8
Show file tree
Hide file tree
Showing 17 changed files with 1,124 additions and 917 deletions.
92 changes: 89 additions & 3 deletions docs/source/puppet/designing_your_manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,59 @@ It is possible to specify global parameters that should be used when provisionin
You can set the value to an explicit value or you can set the value to the result of a function call - using funcation
calls to set parameter values is known as using a macro.

Here is an example of a simple parameter:
Here is an example of a simple global parameter:
```yaml
schema: puppet-2019-04-01

parameters:
CloudTrailLoggingBucketName:
default: cloudtrail-logs-for-aws
```

It is possible to also specify a parameter at the account level:
```yaml
accounts:
- account_id: '<YOUR_ACCOUNT_ID>'
name: '<YOUR_ACCOUNT_NAME>'
default_region: eu-west-1
regions_enabled:
- eu-west-1
- eu-west-1
tags:
- type:prod
- partition:eu
- scope:pci
parameters:
RoleName:
default: DevAdmin
Path:
default: /human-roles/
```

And finally you specify parameters at the launch level:
```yaml
launches:
account-iam-for-prod:
portfolio: demo-central-it-team-portfolio
product: account-iam
version: v1
parameters:
RoleName:
default: DevAdmin
Path:
default: /human-roles/
deploy_to:
tags:
- tag: type:prod
regions: default_region
```

Whenever Puppet provisions a product it checks the parameters for the product. If it sees the name match one of the
parameter values it will use it. In order to avoid clashes with parameter names we recommend using descriptive names
like in the example - using the parameter names like ```BucketName``` will lead you into trouble pretty quickly.
like in the example - using the parameter names like ```BucketName``` will lead you into trouble pretty quickly.

The order of precedence for parameters is account level parameters override all others and launch level parameters
override global.

#### Macros
You can also use a macro to set the value of a parameter. It works in the same way as a normal parameter except it
Expand Down Expand Up @@ -231,4 +273,48 @@ launches:
accounts:
- account_id: '0123456789010'
regions: default_region
```
```

#### Dependencies between launches
Where possible we recommend building launches to be independent. However, there are cases where you may need to setup a
hub account before setting up a spoke or there may be times you are using AWS Lambda to back AWS CloudFormation custom
resources. In these examples it would be beneficial to be able to say deploy launch x and then launch y. To achieve this
You can use ```depends_on``` within your launch like so:
```yaml
launches:
account-vending-account-creation:
portfolio: demo-central-it-team-portfolio
product: account-vending-account-creation
version: v1
depends_on:
- account-vending-account-bootstrap-shared
- account-vending-account-creation-shared
deploy_to:
tags:
- tag: scope:puppet-hub
regions: default_region

account-vending-account-bootstrap-shared:
portfolio: demo-central-it-team-portfolio
product: account-vending-account-bootstrap-shared
version: v1
deploy_to:
tags:
- tag: scope:puppet-hub
regions: default_region

account-vending-account-creation-shared:
portfolio: demo-central-it-team-portfolio
product: account-vending-account-creation-shared
version: v1
deploy_to:
tags:
- tag: scope:puppet-hub
regions: default_region
```

In this example the framework will deploy ```account-vending-account-creation``` only when
```account-vending-account-bootstrap-shared``` and ```account-vending-account-creation-shared``` have been attempted.

At the moment there is only support for one level of dependencies, so only the previous example will work. It is not
possible to say a depends_on b which depends_on c.
15 changes: 15 additions & 0 deletions servicecatalog_puppet/asset_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os


def resolve_from_site_packages(what):
return os.path.sep.join([
os.path.dirname(os.path.abspath(__file__)),
what
])


def read_from_site_packages(what):
return open(
resolve_from_site_packages(what),
'r'
).read()

0 comments on commit 5fa7ff8

Please sign in to comment.