-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'workflow-more-good-stuff'
- Loading branch information
Showing
9 changed files
with
270 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
guide/blueprints/workflow/examples/aws-cfn-stacks/aws-cfn-type.bom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
brooklyn.catalog: | ||
bundle: aws-cfn-discovery-sample | ||
version: 1.0.0-SNAPSHOT | ||
items: | ||
- id: aws-cfn-discovered-stack-sample | ||
item: | ||
type: org.apache.brooklyn.entity.stock.BasicEntity | ||
brooklyn.initializers: | ||
- type: workflow-effector | ||
name: on_update | ||
steps: | ||
- set-entity-name ${item.StackName} | ||
- set-sensor data = ${item} | ||
- set-sensor stack_status = ${item.StackStatus} | ||
# above is just a start, you can check drift, explore resources, etc |
16 changes: 16 additions & 0 deletions
16
guide/blueprints/workflow/examples/aws-cfn-stacks/aws-discoverer.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: AWS CloudFormation Discoverer | ||
|
||
services: | ||
- type: workflow-software-process | ||
location: localhost | ||
name: Stacks | ||
|
||
brooklyn.policies: | ||
- type: workflow-policy | ||
brooklyn.config: | ||
name: periodically update children | ||
period: 1m | ||
steps: | ||
- ssh aws cloudformation describe-stacks | ||
- transform stdout | json | set describe_stacks_output_json | ||
- update-children type aws-cfn-discovered-stack-sample id ${item.StackId} from ${describe_stacks_output_json.Stacks} |
35 changes: 35 additions & 0 deletions
35
guide/blueprints/workflow/examples/aws-cfn-stacks/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: AWS CloudFormation Stack Discovery | ||
title_in_menu: AWS CFN Stacks | ||
layout: website-normal | ||
--- | ||
|
||
The `update-children` step makes it straightforward to keep an Apache Brooklyn model | ||
in synch with external resources, from a cloud, GitHub or Jira tickets, or any data source you choose. | ||
The Brooklyn blueprint can then be used to attach management logic, including for example | ||
automatically deploying branched resources into ephemeral test environments. | ||
|
||
This example shows how CloudFormation stacks in AWS can be synchronized. | ||
|
||
Firstly, we define our type to represent discovered stack and be able to refresh `on_update`: | ||
|
||
{% highlight yaml %} | ||
{% readj aws-cfn-type.yaml %} | ||
{% endhighlight %} | ||
|
||
This should be added to the catalog. | ||
|
||
We can then deploy our Brooklyn application to discover and monitor stacks: | ||
|
||
{% highlight yaml %} | ||
{% readj aws-discoverer.yaml %} | ||
{% endhighlight %} | ||
|
||
Create and delete stacks, and see them update in Brooklyn. | ||
Then consider: | ||
|
||
* Modify the `ssh aws` step in the "discoverer" to filter based on your preferred tags. | ||
* Use the `transform ... | merge` operator to combine lists from different regions. | ||
* Add other policies to check for drift on stacks and show failures in AMP if there is drift. | ||
* Create a similar workflow to monitor pull requests using the `gh` CLI; | ||
then create, update, delete, and track ephemeral test deployments based on those |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.