Skip to content

Commit

Permalink
add ssm param types (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
troyready authored and phobologic committed Jan 9, 2019
1 parent b2bb9d7 commit 1dc6de8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/blueprints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ CFNType

The ``CFNType`` can be used to signal that a variable should be submitted
to CloudFormation as a Parameter instead of only available to the
Blueprint when rendering. This is useful if you want to leverage AWS
specific Parameter types like ``List<AWS::EC2::Image::Id>``. See
``stacker.blueprints.variables.types`` for available subclasses of the
Blueprint when rendering. This is useful if you want to leverage AWS-
Specific Parameter types (e.g. ``List<AWS::EC2::Image::Id>``) or Systems
Manager Parameter Store values (e.g. ``AWS::SSM::Parameter::Value<String>``).
See ``stacker.blueprints.variables.types`` for available subclasses of the
``CFNType``.

Example
Expand Down
52 changes: 52 additions & 0 deletions stacker/blueprints/variables/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,14 @@ def __init__(self, parameter_type):
self.parameter_type = parameter_type


# General CFN types
CFNString = CFNType("String")
CFNNumber = CFNType("Number")
CFNNumberList = CFNType("List<Number>")
CFNCommaDelimitedList = CFNType("CommaDelimitedList")

# AWS-Specific Parameter Types
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-specific-parameter-types
EC2AvailabilityZoneName = CFNType("AWS::EC2::AvailabilityZone::Name")
EC2ImageId = CFNType("AWS::EC2::Image::Id")
EC2InstanceId = CFNType("AWS::EC2::Instance::Id")
Expand All @@ -151,3 +155,51 @@ def __init__(self, parameter_type):
EC2VolumeIdList = CFNType("List<AWS::EC2::Volume::Id>")
EC2VPCIdList = CFNType("List<AWS::EC2::VPC::Id>")
Route53HostedZoneIdList = CFNType("List<AWS::Route53::HostedZone::Id>")

# SSM Parameter Types
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-ssm-parameter-types
SSMParameterName = CFNType("AWS::SSM::Parameter::Name")
SSMParameterValueString = CFNType("AWS::SSM::Parameter::Value<String>")
SSMParameterValueStringList = CFNType(
"AWS::SSM::Parameter::Value<List<String>>")
SSMParameterValueCommaDelimitedList = CFNType(
"AWS::SSM::Parameter::Value<CommaDelimitedList>")
# Each AWS-specific type here is repeated from the the list above
SSMParameterValueEC2AvailabilityZoneName = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::AvailabilityZone::Name>")
SSMParameterValueEC2ImageId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>")
SSMParameterValueEC2InstanceId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::Instance::Id>")
SSMParameterValueEC2KeyPairKeyName = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::KeyPair::KeyName>")
SSMParameterValueEC2SecurityGroupGroupName = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::SecurityGroup::GroupName>")
SSMParameterValueEC2SecurityGroupId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::SecurityGroup::Id>")
SSMParameterValueEC2SubnetId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::Subnet::Id>")
SSMParameterValueEC2VolumeId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::Volume::Id>")
SSMParameterValueEC2VPCId = CFNType(
"AWS::SSM::Parameter::Value<AWS::EC2::VPC::Id>")
SSMParameterValueRoute53HostedZoneId = CFNType(
"AWS::SSM::Parameter::Value<AWS::Route53::HostedZone::Id>")
SSMParameterValueEC2AvailabilityZoneNameList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::AvailabilityZone::Name>>")
SSMParameterValueEC2ImageIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::Image::Id>>")
SSMParameterValueEC2InstanceIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::Instance::Id>>")
SSMParameterValueEC2SecurityGroupGroupNameList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::SecurityGroup::GroupName>>")
SSMParameterValueEC2SecurityGroupIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::SecurityGroup::Id>>")
SSMParameterValueEC2SubnetIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::Subnet::Id>>")
SSMParameterValueEC2VolumeIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::Volume::Id>>")
SSMParameterValueEC2VPCIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::EC2::VPC::Id>>")
SSMParameterValueRoute53HostedZoneIdList = CFNType(
"AWS::SSM::Parameter::Value<List<AWS::Route53::HostedZone::Id>>")

0 comments on commit 1dc6de8

Please sign in to comment.