Skip to content

Commit

Permalink
Merge pull request #112 from ericzbeard/readme-update
Browse files Browse the repository at this point in the history
Updated readme template and fixed issues with SAM spec
  • Loading branch information
ericzbeard authored Mar 14, 2023
2 parents d71a886 + c65856f commit 4bf517e
Show file tree
Hide file tree
Showing 26 changed files with 3,158 additions and 339 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Rain is also a command line tool for working with [AWS CloudFormation](https://a

## Discord

Join us on Discord to discuss rain and all things CloudFormation! Connect & interact with CloudFormation developers &
Join us on Discord to discuss rain and all things CloudFormation! Connect and interact with CloudFormation developers and
experts, find channels to discuss rain, the CloudFormation registry, StackSets,
cfn-lint, Guard and more:

Expand All @@ -37,7 +37,7 @@ If you have [homebrew](https://brew.sh/) installed, `brew install rain`

Or you can download the appropriate binary for your system from [the releases page](https://github.com/aws-cloudformation/rain/releases).

Or if you're a [Gopher](https://blog.golang.org/gopher), you can `GO111MODULE=on go install github.com/aws-cloudformation/rain/cmd/rain`
Or if you're a [Gopher](https://blog.golang.org/gopher), you can `GO111MODULE=on go get github.com/aws-cloudformation/rain/cmd/rain`

```
Usage:
Expand All @@ -49,7 +49,7 @@ Stack commands:
logs Show the event log for the named stack
ls List running CloudFormation stacks
rm Delete a running CloudFormation stack
stackset This command allows to manipulate stack sets.
stackset This command manipulates stack sets.
watch Display an updating view of a CloudFormation stack
Template commands:
Expand Down Expand Up @@ -96,10 +96,6 @@ In alphabetical order:

The cfn-nag tool looks for patterns in CloudFormation templates that may indicate insecure infrastructure.

* [sceptre](https://sceptre.cloudreach.com/)

Sceptre is a tool to drive CloudFormation. Sceptre manages the creation, update and deletion of stacks while providing meta commands which allow users to retrieve information about their stacks.

* [taskcat](https://github.com/aws-quickstart/taskcat)

taskcat is a tool that tests AWS CloudFormation templates. It deploys your AWS CloudFormation template in multiple AWS Regions and generates a report with a pass/fail grade for each region. You can specify the regions and number of Availability Zones you want to include in the test, and pass in parameter values from your AWS CloudFormation template. taskcat is implemented as a Python class that you import, instantiate, and run.
Expand Down
2,957 changes: 2,684 additions & 273 deletions cft/spec/cfn.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions cft/spec/internal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func patchSamSpec(s spec.Spec) {
s.PropertyTypes["AWS::Serverless::Api.DomainConfiguration"].Properties["MutualTlsAuthentication"].Type = "AWS::ApiGateway::DomainName.MutualTlsAuthentication"
s.PropertyTypes["AWS::Serverless::Function.CloudWatchEvent"].Properties["Pattern"].PrimitiveType = "Json"
s.PropertyTypes["AWS::Serverless::Function.CloudWatchEvent"].Properties["Pattern"].Type = spec.TypeEmpty
s.PropertyTypes["AWS::Serverless::Function.DocumentDB"].Properties["Cluster"].ItemType = ""
s.PropertyTypes["AWS::Serverless::Function.DocumentDB"].Properties["Cluster"].PrimitiveItemType = ""
s.PropertyTypes["AWS::Serverless::Function.DocumentDB"].Properties["Cluster"].Type = ""
s.PropertyTypes["AWS::Serverless::Function.DocumentDB"].Properties["Cluster"].PrimitiveType = "String"
s.PropertyTypes["AWS::Serverless::Function.DocumentDB"].Properties["FilterCriteria"].Type = "AWS::Lambda::EventSourceMapping.FilterCriteria"
s.PropertyTypes["AWS::Serverless::Function.DynamoDB"].Properties["DestinationConfig"].Type = "AWS::Lambda::EventSourceMapping.DestinationConfig"
s.PropertyTypes["AWS::Serverless::Function.DynamoDB"].Properties["FilterCriteria"].Type = "AWS::Lambda::EventSourceMapping.FilterCriteria"
s.PropertyTypes["AWS::Serverless::Function.EventBridgeRule"].Properties["Pattern"].PrimitiveType = "Json"
Expand All @@ -149,6 +154,8 @@ func patchSamSpec(s spec.Spec) {
s.PropertyTypes["AWS::Serverless::Function.Kinesis"].Properties["FilterCriteria"].Type = "AWS::Lambda::EventSourceMapping.FilterCriteria"
s.PropertyTypes["AWS::Serverless::Function.MQ"].Properties["FilterCriteria"].Type = "AWS::Lambda::EventSourceMapping.FilterCriteria"
s.PropertyTypes["AWS::Serverless::Function.MSK"].Properties["FilterCriteria"].Type = "AWS::Lambda::EventSourceMapping.FilterCriteria"
s.PropertyTypes["AWS::Serverless::Function.MSK"].Properties["SourceAccessConfigurations"].ItemType = "AWS::Lambda::EventSourceMapping.SourceAccessConfiguration"
s.PropertyTypes["AWS::Serverless::Function.MSK"].Properties["SourceAccessConfigurations"].Type = spec.TypeList
s.PropertyTypes["AWS::Serverless::Function.S3"].Properties["Filter"].Type = "AWS::S3::Bucket.NotificationFilter"
s.PropertyTypes["AWS::Serverless::Function.SNS"].Properties["FilterPolicy"].PrimitiveType = "Json"
s.PropertyTypes["AWS::Serverless::Function.SNS"].Properties["FilterPolicy"].Type = spec.TypeEmpty
Expand Down Expand Up @@ -183,6 +190,7 @@ func patchSamSpec(s spec.Spec) {
s.ResourceTypes["AWS::Serverless::Function"].Properties["ImageConfig"].Type = "AWS::Lambda::Function.ImageConfig"
s.ResourceTypes["AWS::Serverless::Function"].Properties["ProvisionedConcurrencyConfig"].Type = "AWS::Lambda::Alias.ProvisionedConcurrencyConfiguration"
s.ResourceTypes["AWS::Serverless::Function"].Properties["RuntimeManagementConfig"].Type = "AWS::Lambda::Function.RuntimeManagementConfig"
s.ResourceTypes["AWS::Serverless::Function"].Properties["SnapStart"].Type = "AWS::Lambda::Function.SnapStart"
s.ResourceTypes["AWS::Serverless::Function"].Properties["VpcConfig"].Type = "AWS::Lambda::Function.VpcConfig"
s.ResourceTypes["AWS::Serverless::HttpApi"].Properties["AccessLogSettings"].Type = "AWS::ApiGatewayV2::Stage.AccessLogSettings"
s.ResourceTypes["AWS::Serverless::HttpApi"].Properties["DefaultRouteSettings"].Type = "AWS::ApiGatewayV2::Stage.RouteSettings"
Expand Down
70 changes: 43 additions & 27 deletions cft/spec/internal/sam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ git clone https://github.com/awsdocs/aws-sam-developer-guide.git $d
cd "$d"

# The Name property was declared twice.
echo "diff --git a/doc_source/sam-property-function-eventbridgerule.md b/doc_source/sam-property-function-eventbridgerule.md
index 7a88e81..1d4a8ac 100644
--- a/doc_source/sam-property-function-eventbridgerule.md
+++ b/doc_source/sam-property-function-eventbridgerule.md
@@ -14,7 +14,6 @@ To declare this entity in your AWS Serverless Application Model \(AWS SAM\) temp
[DeadLetterConfig](#sam-function-eventbridgerule-deadletterconfig): DeadLetterConfig
[EventBusName](#sam-function-eventbridgerule-eventbusname): String
[Input](#sam-function-eventbridgerule-input): String
- [Name](#sam-function-eventbridgerule-name): String
[InputPath](#sam-function-eventbridgerule-inputpath): String
[Name](#sam-function-eventbridgerule-name): String
[Pattern](#sam-function-eventbridgerule-pattern): [EventPattern](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern)
" | git apply
# echo "diff --git a/doc_source/sam-property-function-eventbridgerule.md b/doc_source/sam-property-function-eventbridgerule.md
# index 7a88e81..1d4a8ac 100644
# --- a/doc_source/sam-property-function-eventbridgerule.md
# +++ b/doc_source/sam-property-function-eventbridgerule.md
# @@ -14,7 +14,6 @@ To declare this entity in your AWS Serverless Application Model \(AWS SAM\) temp
# [DeadLetterConfig](#sam-function-eventbridgerule-deadletterconfig): DeadLetterConfig
# [EventBusName](#sam-function-eventbridgerule-eventbusname): String
# [Input](#sam-function-eventbridgerule-input): String
# - [Name](#sam-function-eventbridgerule-name): String
# [InputPath](#sam-function-eventbridgerule-inputpath): String
# [Name](#sam-function-eventbridgerule-name): String
# [Pattern](#sam-function-eventbridgerule-pattern): [EventPattern](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern)
# " | git apply

echo "ResourceSpecificationVersion: $(git rev-parse HEAD)"

Expand All @@ -54,6 +54,9 @@ for file in sam-resource-*.md; do
second="$(grep -n '```' $file | head -n2 | tail -n1 | cut -d: -f1)"

resource_name="$(head -n$((first+1)) $file | tail -n1 | cut -d" " -f2)"
if [ "$resource_name" == "<source-resource-logical-id>:" ]; then
continue
fi

echo " $resource_name:"

Expand All @@ -65,25 +68,34 @@ for file in sam-resource-*.md; do
IFS=$'\n'
for line in $(head -n$((second-1)) $file | tail -n$((second-first-3))); do
prop_name="$(echo "$line" | grep -o '[A-Z]\w\+' | head -n1)"
if [ "$prop_name" == "" ]; then
>&2 echo "Line in $resource_name has no property: $line"
continue
fi
echo " $prop_name:"

echo " Documentation: ${DOC_BASE}/${file_base}.html#${file_base/resource-/}-${prop_name,,}"

prop_type=$(echo "$line" | cut -d: -f2 | awk -F"|" '{print $NF}' | sed -e 's/^ *\[//' -e 's/\].*$//' | xargs)

if [ "${types[$prop_type]}" == "Primitive" ]; then
echo " PrimitiveType: $prop_type"
elif [ "${types[$prop_type]}" == "Composite" ]; then
echo " Type: $prop_type"
echo " PrimitiveItemType: String"
else
echo " Type: $prop_type"
if [ "$prop_type" != "" ]; then
if [ "${types[$prop_type]}" == "Primitive" ]; then
echo " PrimitiveType: $prop_type"
elif [ "${types[$prop_type]}" == "Composite" ]; then
echo " Type: $prop_type"
echo " PrimitiveItemType: String"
else
echo " Type: $prop_type"
fi
else
>&2 echo "prop_type in $resource_name not set for line: $line"
continue
fi

# Find out if it's required
mention=$(grep -n "\`$prop_name\`" $file | head -n1 | cut -d: -f1 | xargs)
required=$(tail -n+${mention} "$file" | grep "*Required*" | head -n1 | cut -d: -f2 | xargs)
if [ $required == "Yes" ]; then
if [ "$required" == "Yes" ]; then
echo " Required: True"
else
echo " Required: False"
Expand Down Expand Up @@ -129,13 +141,17 @@ for file in sam-property-*.md; do

prop_type=$(echo "$line" | cut -d: -f2 | awk -F"|" '{print $NF}' | sed -e 's/^ *\[//' -e 's/\].*$//' | xargs)

if [ "${types[$prop_type]}" == "Primitive" ]; then
echo " PrimitiveType: $prop_type"
elif [ "${types[$prop_type]}" == "Composite" ]; then
echo " Type: $prop_type"
echo " PrimitiveItemType: String"
if [ "$prop_type" != "" ]; then
if [ "${types[$prop_type]}" == "Primitive" ]; then
echo " PrimitiveType: $prop_type"
elif [ "${types[$prop_type]}" == "Composite" ]; then
echo " Type: $prop_type"
echo " PrimitiveItemType: String"
else
echo " Type: $prop_type"
fi
else
echo " Type: $prop_type"
>&2 echo "prop_type not set for line: $line"
fi

# Find out if it's required
Expand Down
28 changes: 11 additions & 17 deletions docs/README.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ Rain is also a command line tool for working with [AWS CloudFormation](https://a

[![Make it Rain](./docs/rain.svg)](https://asciinema.org/a/vtbAXkriC0zg0T2UzP0t63G4S?autoplay=1)

Key features:
## Discord

Join us on Discord to discuss rain and all things CloudFormation! Connect and interact with CloudFormation developers and
experts, find channels to discuss rain, the CloudFormation registry, StackSets,
cfn-lint, Guard and more:

[![Join our Discord](https://discordapp.com/api/guilds/981586120448020580/widget.png?style=banner3)](https://discord.gg/9zpd7TTRwq)

## Key features

* **Interactive deployments**: With `rain deploy`, rain packages your CloudFormation templates using [`aws cloudformation package`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/package.html), prompts you for any parameters that have not yet been defined, shows you a summary of the changes that will be made, and then displays real-time updates as your stack is being deployed. Once finished, you get a summary of the outcome along with any error messages collected along the way - including errors messages for stacks that have been rolled back and no longer exist.

Expand All @@ -21,6 +29,8 @@ Key features:

* **Build new CloudFormation templates**: `rain build` generates new CloudFormation templates containing skeleton resources that you specify. This saves you having to look up which properties are available and which are required vs. optional.

* **Manipulate CloudFormation stack sets**: `rain stackset deploy` creates a new stackset, updates an existing one or adds a stack instance(s) to an existing stack set. You can list stack sets using `rain stackset ls`, review stack set details with `rain stackset ls <stack set name>` and delete stack set and\or its instances with `rain stackset rm <stack set name>`

## Getting started

If you have [homebrew](https://brew.sh/) installed, `brew install rain`
Expand Down Expand Up @@ -54,14 +64,6 @@ Rain is licensed under the Apache 2.0 License.

In alphabetical order:

* [cfn-flip](https://github.com/awslabs/aws-cfn-template-flip)

cfn-flip converts AWS CloudFormation templates between JSON and YAML formats, making use of the YAML format's short function syntax where possible.

* [cfn-format](https://github.com/awslabs/aws-cloudformation-template-formatter)

cfn-format reads in an existing AWS CloudFormation template and outputs a cleanly-formatted, easy-to-read copy of the same template adhering to standards as used in AWS documentation. cfn-format can output either YAML or JSON as desired.

* [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint)

Validate CloudFormation yaml/json templates against the CloudFormation spec and additional checks. Includes checking valid values for resource properties and best practices.
Expand All @@ -70,14 +72,6 @@ In alphabetical order:

The cfn-nag tool looks for patterns in CloudFormation templates that may indicate insecure infrastructure.

* [cfn-skeleton](https://github.com/awslabs/aws-cloudformation-template-builder)

cfn-skeleton that consumes the published CloudFormation specification and generates skeleton CloudFormation templates with mandatory and optional parameters of chosen resource types pre-filled with placeholder values.

* [sceptre](https://sceptre.cloudreach.com/)

Sceptre is a tool to drive CloudFormation. Sceptre manages the creation, update and deletion of stacks while providing meta commands which allow users to retrieve information about their stacks.

* [taskcat](https://github.com/aws-quickstart/taskcat)

taskcat is a tool that tests AWS CloudFormation templates. It deploys your AWS CloudFormation template in multiple AWS Regions and generates a report with a pass/fail grade for each region. You can specify the regions and number of Availability Zones you want to include in the test, and pass in parameter values from your AWS CloudFormation template. taskcat is implemented as a Python class that you import, instantiate, and run.
Expand Down
Loading

0 comments on commit 4bf517e

Please sign in to comment.