kumogata-template 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +54 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/README.md +204 -0
- data/Rakefile +23 -0
- data/bin/kumogata-template +9 -0
- data/kumogata-template.gemspec +26 -0
- data/lib/kumogata/template.rb +17 -0
- data/lib/kumogata/template/autoscaling.rb +77 -0
- data/lib/kumogata/template/cloudwatch.rb +28 -0
- data/lib/kumogata/template/codedeploy.rb +85 -0
- data/lib/kumogata/template/const.rb +175 -0
- data/lib/kumogata/template/datapipeline.rb +90 -0
- data/lib/kumogata/template/dynamodb.rb +111 -0
- data/lib/kumogata/template/ec2.rb +165 -0
- data/lib/kumogata/template/ecs.rb +119 -0
- data/lib/kumogata/template/elasticbeanstalk.rb +33 -0
- data/lib/kumogata/template/elb.rb +132 -0
- data/lib/kumogata/template/emr.rb +166 -0
- data/lib/kumogata/template/events.rb +25 -0
- data/lib/kumogata/template/ext/argument_parser.rb +8 -0
- data/lib/kumogata/template/ext/kumogata.rb +103 -0
- data/lib/kumogata/template/helper.rb +211 -0
- data/lib/kumogata/template/iam.rb +96 -0
- data/lib/kumogata/template/lambda.rb +34 -0
- data/lib/kumogata/template/s3.rb +223 -0
- data/lib/kumogata/template/sns.rb +25 -0
- data/lib/kumogata/template/version.rb +1 -0
- data/template/_template.rb +25 -0
- data/template/autoscaling-group.rb +47 -0
- data/template/autoscaling-launch-configuration.rb +54 -0
- data/template/autoscaling-lifecycle-hook.rb +27 -0
- data/template/autoscaling-scaling-policy.rb +33 -0
- data/template/autoscaling-scheduled-action.rb +37 -0
- data/template/cloudtrail.rb +39 -0
- data/template/cloudwatch-alarm.rb +45 -0
- data/template/codedeploy-application.rb +15 -0
- data/template/codedeploy-deployment-config.rb +23 -0
- data/template/codedeploy-deployment-group.rb +35 -0
- data/template/datapipeline-pipeline.rb +28 -0
- data/template/dynamodb-table.rb +33 -0
- data/template/ec2-eip-association.rb +23 -0
- data/template/ec2-eip.rb +17 -0
- data/template/ec2-instance.rb +65 -0
- data/template/ec2-internet-gateway.rb +15 -0
- data/template/ec2-nat-gateway.rb +17 -0
- data/template/ec2-network-acl-entry.rb +30 -0
- data/template/ec2-network-acl.rb +17 -0
- data/template/ec2-route-table.rb +17 -0
- data/template/ec2-route.rb +27 -0
- data/template/ec2-security-group.rb +24 -0
- data/template/ec2-subnet-network-acl-association.rb +17 -0
- data/template/ec2-subnet-route-table-association.rb +17 -0
- data/template/ec2-subnet.rb +23 -0
- data/template/ec2-volume-attachment.rb +19 -0
- data/template/ec2-volume.rb +31 -0
- data/template/ec2-vpc-endpoint.rb +23 -0
- data/template/ec2-vpc-gateway-attachment.rb +19 -0
- data/template/ec2-vpc.rb +24 -0
- data/template/ecs-cluster.rb +11 -0
- data/template/ecs-service.rb +24 -0
- data/template/ecs-task-definition.rb +18 -0
- data/template/elasticache-cache-cluster.rb +63 -0
- data/template/elasticache-parameter-group.rb +20 -0
- data/template/elasticache-replication-group.rb +58 -0
- data/template/elasticache-subnet-group.rb +17 -0
- data/template/elasticbeanstalk-application-version.rb +24 -0
- data/template/elasticbeanstalk-application.rb +17 -0
- data/template/elasticbeanstalk-configuration-template.rb +31 -0
- data/template/elasticbeanstalk-environment.rb +44 -0
- data/template/elb-loadbalancer.rb +46 -0
- data/template/emr-cluster.rb +39 -0
- data/template/emr-instance-group-config.rb +33 -0
- data/template/emr-step.rb +22 -0
- data/template/events-rule.rb +28 -0
- data/template/iam-access-key.rb +19 -0
- data/template/iam-group.rb +20 -0
- data/template/iam-instance-profile.rb +17 -0
- data/template/iam-managed-policy.rb +28 -0
- data/template/iam-policy.rb +26 -0
- data/template/iam-role.rb +21 -0
- data/template/iam-user-to-group-addition.rb +17 -0
- data/template/iam-user.rb +24 -0
- data/template/lambda-alias.rb +21 -0
- data/template/lambda-event-source-mapping.rb +24 -0
- data/template/lambda-function.rb +34 -0
- data/template/lambda-permission.rb +26 -0
- data/template/lambda-version.rb +19 -0
- data/template/mappings-ec2.rb +85 -0
- data/template/output-access-key.rb +6 -0
- data/template/output-arn.rb +6 -0
- data/template/output-autoscaling.rb +6 -0
- data/template/output-az.rb +6 -0
- data/template/output-dynamodb.rb +6 -0
- data/template/output-ec2.rb +8 -0
- data/template/output-elasticache.rb +30 -0
- data/template/output-elb.rb +12 -0
- data/template/output-emr.rb +6 -0
- data/template/output-rds.rb +10 -0
- data/template/output-redshift.rb +10 -0
- data/template/output-s3.rb +8 -0
- data/template/output-security-group.rb +5 -0
- data/template/output-sqs.rb +5 -0
- data/template/output-topic.rb +6 -0
- data/template/output-vpc.rb +10 -0
- data/template/output.rb +29 -0
- data/template/parameter-ec2.rb +22 -0
- data/template/parameter-elasticache.rb +9 -0
- data/template/parameter-rds.rb +9 -0
- data/template/parameter-redshift.rb +9 -0
- data/template/parameter.rb +20 -0
- data/template/rds-db-cluster-parameter-group.rb +22 -0
- data/template/rds-db-cluster.rb +47 -0
- data/template/rds-db-instance.rb +82 -0
- data/template/rds-db-parameter-group.rb +21 -0
- data/template/rds-db-subnet-group.rb +19 -0
- data/template/rds-event-subscription.rb +42 -0
- data/template/rds-option-group.rb +23 -0
- data/template/redshift-cluster-parameter-group.rb +19 -0
- data/template/redshift-cluster-subnet-group.rb +17 -0
- data/template/redshift-cluster.rb +60 -0
- data/template/s3-bucket-policy.rb +20 -0
- data/template/s3-bucket.rb +42 -0
- data/template/sns-topic.rb +20 -0
- data/template/sqs-queue.rb +27 -0
- data/test/_template.rb +26 -0
- data/test/abstract_unit.rb +101 -0
- data/test/autoscaling_test.rb +109 -0
- data/test/codedeploy_test.rb +117 -0
- data/test/datapipeline_test.rb +142 -0
- data/test/dynamodb_test.rb +184 -0
- data/test/ec2_test.rb +286 -0
- data/test/ecs_test.rb +135 -0
- data/test/elasticbeanstalk_test.rb +56 -0
- data/test/elb_test.rb +147 -0
- data/test/emr_test.rb +193 -0
- data/test/events_test.rb +22 -0
- data/test/helper_test.rb +547 -0
- data/test/iam_test.rb +93 -0
- data/test/lambda_test.rb +41 -0
- data/test/s3_test.rb +195 -0
- data/test/sns_test.rb +27 -0
- data/test/template/autoscaling-group_test.rb +177 -0
- data/test/template/autoscaling-launch-configuration_test.rb +117 -0
- data/test/template/autoscaling-lifecycle-hook_test.rb +33 -0
- data/test/template/autoscaling-scaling-policy_test.rb +26 -0
- data/test/template/autoscaling-scheduled-action_test.rb +26 -0
- data/test/template/cloudtrail_test.rb +55 -0
- data/test/template/cloudwatch-alarm_test.rb +38 -0
- data/test/template/codedeploy-application_test.rb +21 -0
- data/test/template/codedeploy-deployment-config_test.rb +26 -0
- data/test/template/codedeploy-deployment-group_test.rb +48 -0
- data/test/template/datapipeline-pipeline_test.rb +358 -0
- data/test/template/dynamodb-table_test.rb +94 -0
- data/test/template/ec2-eip-association_test.rb +22 -0
- data/test/template/ec2-eip_test.rb +21 -0
- data/test/template/ec2-instance_test.rb +95 -0
- data/test/template/ec2-internet-gateway_test.rb +48 -0
- data/test/template/ec2-nat-gateway_test.rb +22 -0
- data/test/template/ec2-network-acl-entry_test.rb +61 -0
- data/test/template/ec2-network-acl_test.rb +51 -0
- data/test/template/ec2-route-table_test.rb +49 -0
- data/test/template/ec2-route_test.rb +21 -0
- data/test/template/ec2-security-group_test.rb +50 -0
- data/test/template/ec2-subnet-netwokr-acl-association_test.rb +26 -0
- data/test/template/ec2-subnet-route-table-association_test.rb +22 -0
- data/test/template/ec2-subnet_test.rb +51 -0
- data/test/template/ec2-volume-attachment_test.rb +24 -0
- data/test/template/ec2-volume_test.rb +52 -0
- data/test/template/ec2-vpc-gateway-attachment_test.rb +23 -0
- data/test/template/ec2-vpc_test.rb +102 -0
- data/test/template/ecs-cluster_test.rb +18 -0
- data/test/template/ecs-service_test.rb +29 -0
- data/test/template/ecs-task-definition_test.rb +143 -0
- data/test/template/elasticache-cache-cluster_test.rb +77 -0
- data/test/template/elasticache-parameter-group_test.rb +25 -0
- data/test/template/elasticache-replication-group_test.rb +45 -0
- data/test/template/elasticache-subnet-group_test.rb +26 -0
- data/test/template/elasticbeanstalk-application-version_test.rb +27 -0
- data/test/template/elasticbeanstalk-application_test.rb +21 -0
- data/test/template/elasticbeanstalk-configuration-template_test.rb +23 -0
- data/test/template/elasticbeanstalk-environment_test.rb +56 -0
- data/test/template/elasticbeanstalk-template_test.rb +33 -0
- data/test/template/elb-loadbalancer_test.rb +94 -0
- data/test/template/emr-cluster_test.rb +147 -0
- data/test/template/emr-instance-group-config_test.rb +65 -0
- data/test/template/emr-step_test.rb +82 -0
- data/test/template/events-rule_test.rb +34 -0
- data/test/template/iam-access-key_test.rb +22 -0
- data/test/template/iam-group_test.rb +21 -0
- data/test/template/iam-instance-profile_test.rb +24 -0
- data/test/template/iam-managed-policy_test.rb +35 -0
- data/test/template/iam-policy_test.rb +52 -0
- data/test/template/iam-role_test.rb +37 -0
- data/test/template/iam-user-to-group-addition_test.rb +24 -0
- data/test/template/iam-user_test.rb +21 -0
- data/test/template/lambda-alias_test.rb +46 -0
- data/test/template/lambda-event-source-mapping_test.rb +36 -0
- data/test/template/lambda-function_test.rb +34 -0
- data/test/template/lambda-permission_test.rb +32 -0
- data/test/template/lambda-version_test.rb +27 -0
- data/test/template/mappings-ec2_test.rb +92 -0
- data/test/template/output-access-key_test.rb +30 -0
- data/test/template/output-arn_test.rb +30 -0
- data/test/template/output-autoscaling_test.rb +27 -0
- data/test/template/output-az_test.rb +31 -0
- data/test/template/output-dynamodb_test.rb +21 -0
- data/test/template/output-ec2_test.rb +82 -0
- data/test/template/output-elasticache_test.rb +107 -0
- data/test/template/output-elb_test.rb +48 -0
- data/test/template/output-emr_test.rb +30 -0
- data/test/template/output-rds_test.rb +39 -0
- data/test/template/output-redshift_test.rb +39 -0
- data/test/template/output-s3_test.rb +52 -0
- data/test/template/output-security-group_test.rb +21 -0
- data/test/template/output-sqs_test.rb +21 -0
- data/test/template/output-topic_test.rb +30 -0
- data/test/template/output-vpc_test.rb +48 -0
- data/test/template/output_test.rb +87 -0
- data/test/template/parameter-ec2_test.rb +44 -0
- data/test/template/parameter-elasticache_test.rb +30 -0
- data/test/template/parameter-rds_test.rb +30 -0
- data/test/template/parameter-redshift_test.rb +30 -0
- data/test/template/parameter_test.rb +40 -0
- data/test/template/rds-db-cluster-parameter-group_test.rb +53 -0
- data/test/template/rds-db-cluster_test.rb +84 -0
- data/test/template/rds-db-instance_test.rb +93 -0
- data/test/template/rds-db-parameter-group_test.rb +53 -0
- data/test/template/rds-db-subnet-group.rb +54 -0
- data/test/template/rds-event-subscription_test.rb +48 -0
- data/test/template/rds-option-group_test.rb +56 -0
- data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
- data/test/template/redshift-cluster-subnet-group_test.rb +26 -0
- data/test/template/redshift-cluster_test.rb +47 -0
- data/test/template/s3-bucket-policy_test.rb +40 -0
- data/test/template/s3-bucket_test.rb +127 -0
- data/test/template/sns-topic_test.rb +42 -0
- data/test/template/sqs-queue_test.rb +25 -0
- metadata +468 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# IAM ManagedPolicty
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/iam'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "managed policy")
|
9
|
+
description = args[:description] || ""
|
10
|
+
groups = _ref_array("groups", args)
|
11
|
+
path = args[:path] || "/"
|
12
|
+
roles = _ref_array("roles", args)
|
13
|
+
users = _ref_array("users", args)
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::IAM::ManagedPolicy"
|
17
|
+
Properties do
|
18
|
+
Description description unless description.empty?
|
19
|
+
Groups groups unless groups.empty?
|
20
|
+
Path path
|
21
|
+
PolicyDocument do
|
22
|
+
Version "2012-10-17"
|
23
|
+
Statement _iam_policy_document("policy_document", args)
|
24
|
+
end
|
25
|
+
Roles roles unless roles.empty?
|
26
|
+
Users users unless users.empty?
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# IAM Policy resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/iam'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "policy")
|
9
|
+
groups = _ref_array("groups", args, "group")
|
10
|
+
policy = _ref_name("policy", args)
|
11
|
+
roles = _ref_array("roles", args, "role")
|
12
|
+
users = _ref_array("users", args, "user")
|
13
|
+
|
14
|
+
_(name) do
|
15
|
+
Type "AWS::IAM::Policy"
|
16
|
+
Properties do
|
17
|
+
Groups groups unless groups.empty?
|
18
|
+
PolicyDocument do
|
19
|
+
Version "2012-10-17"
|
20
|
+
Statement _iam_policy_document("policy_document", args)
|
21
|
+
end
|
22
|
+
PolicyName policy
|
23
|
+
Roles roles unless roles.empty?
|
24
|
+
Users users unless users.empty?
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# IAM role resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/iam'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "role")
|
9
|
+
service = args[:service] || "ec2"
|
10
|
+
path = args[:path] || "/"
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::IAM::Role"
|
14
|
+
Properties do
|
15
|
+
AssumeRolePolicyDocument do
|
16
|
+
Version "2012-10-17"
|
17
|
+
Statement _iam_assume_role_policy_document(service)
|
18
|
+
end
|
19
|
+
Path path
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# IAM UserToGroupAddition
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "user to group addition")
|
8
|
+
group = _ref_string("group", args)
|
9
|
+
users = _ref_array("users", args)
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::IAM::UserToGroupAddition"
|
13
|
+
Properties do
|
14
|
+
GroupName group
|
15
|
+
Users users
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# IAM User resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/iam'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "user")
|
9
|
+
group = _ref_array("group", args)
|
10
|
+
login_profile = args[:login_profile] || ""
|
11
|
+
manaegd_policy_arns = args[:managed_policy_arns] || []
|
12
|
+
path = args[:path] || "/"
|
13
|
+
policies = _iam_policies("policies", args)
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::IAM::User"
|
17
|
+
Properties do
|
18
|
+
Group group unless group.empty?
|
19
|
+
LoginProfile login_profile unless login_profile.empty?
|
20
|
+
ManagedPolicyArns manaegd_policy_arns unless manaegd_policy_arns.empty?
|
21
|
+
Path path
|
22
|
+
Policies policies unless policies.empty?
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Lambda alias resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "lambda alias")
|
8
|
+
description = args[:description] || ""
|
9
|
+
function_name = _ref_attr_string("function_name", "Arn", args, "lambda function")
|
10
|
+
function_version = _ref_attr_string("function_version", "Version", args, "lambda version")
|
11
|
+
alias_name = _ref_name("alias_name", args)
|
12
|
+
|
13
|
+
_(name) do
|
14
|
+
Type "AWS::Lambda::Alias"
|
15
|
+
Properties do
|
16
|
+
Description description unless description.empty?
|
17
|
+
FunctionName function_name
|
18
|
+
FunctionVersion function_version
|
19
|
+
Name alias_name
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Lambda event-source-mapping resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "lambda event source mapping")
|
8
|
+
batch_size = args[:batch_size] || 100
|
9
|
+
enabled = _bool("enabled", args, true)
|
10
|
+
event_source = _ref_attr_string("event_source", "Arn", args, args[:event_source_prefix])
|
11
|
+
function_name = _ref_attr_string("function_name", "Arn", args, "lambda function")
|
12
|
+
starting_position = _valid_values(args[:starting_position],
|
13
|
+
%w( trim_horizon latest ), "latest")
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::Lambda::EventSourceMapping"
|
17
|
+
Properties do
|
18
|
+
BatchSize batch_size
|
19
|
+
Enabled enabled
|
20
|
+
EventSourceArn event_source
|
21
|
+
FunctionName function_name
|
22
|
+
StartingPosition starting_position.upcase
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Lambda function resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/lambda'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "lambda function")
|
9
|
+
code = _lambda_function_code(args)
|
10
|
+
description = args[:description] || ""
|
11
|
+
function_name = args[:function_name] || ""
|
12
|
+
handler = args[:handler]
|
13
|
+
memory_size = args[:memory_size] || 128
|
14
|
+
role = _ref_attr_string("role", "Arn", args, "role")
|
15
|
+
role = _ref_string("role_arn", args, "role") if role.empty?
|
16
|
+
runtime = _valid_values(args[:runtime],
|
17
|
+
%w( nodejs nodejs4.3 java8 python2.7 ), "python2.7")
|
18
|
+
timeout = args[:timeout] || 3
|
19
|
+
vpc_config = _lambda_vpc_config(args)
|
20
|
+
|
21
|
+
_(name) do
|
22
|
+
Type "AWS::Lambda::Function"
|
23
|
+
Properties do
|
24
|
+
Code code
|
25
|
+
Description description unless description.empty?
|
26
|
+
FunctionName function_name unless function_name.empty?
|
27
|
+
Handler handler
|
28
|
+
MemorySize memory_size
|
29
|
+
Role role
|
30
|
+
Runtime runtime
|
31
|
+
Timeout timeout
|
32
|
+
VpcConfig vpc_config unless vpc_config.empty?
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Lambda permission resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "lambda permission")
|
8
|
+
action = args[:action] || "lambda:*"
|
9
|
+
function_name = _ref_attr_string("function_name", "Arn", args, "lambda function")
|
10
|
+
principal = _valid_values(args[:principal],
|
11
|
+
%w( s3.amazonaws.com sns.amazonaws.com ),
|
12
|
+
"sns.amazonaws.com")
|
13
|
+
source_account = _ref_string("source_account", args, "account id")
|
14
|
+
source_prefix = (principal == "s3.amazonaws") ? "bucket" : "topic"
|
15
|
+
source_arn = _ref_string("source_arn", args, source_prefix)
|
16
|
+
|
17
|
+
_(name) do
|
18
|
+
Type "AWS::Lambda::Permission"
|
19
|
+
Properties do
|
20
|
+
Action action
|
21
|
+
FunctionName function_name
|
22
|
+
Principal principal
|
23
|
+
SourceAccount source_account unless source_account.empty?
|
24
|
+
SourceArn source_arn unless source_arn.empty?
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Lambda version resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "lambda version")
|
8
|
+
code_sha256 = args[:code_sha256] || ""
|
9
|
+
description = args[:description] || ""
|
10
|
+
function_name = _ref_attr_string("function_name", "Arn", args, "lambda function")
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::Lambda::Version"
|
14
|
+
Properties do
|
15
|
+
CodeSha256 code_sha256 unless code_sha256.empty?
|
16
|
+
Description description unless description.empty?
|
17
|
+
FunctionName function_name
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#
|
2
|
+
# Mappings EC2
|
3
|
+
#
|
4
|
+
require 'kumogata/template/helper'
|
5
|
+
|
6
|
+
AWSInstanceType2Arch do
|
7
|
+
EC2_INSTANCE_TYPES.each do |type|
|
8
|
+
_(type) do
|
9
|
+
Arch "HVM64"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Amazon Linux AMI (HVM / 64-bit)
|
15
|
+
# https://aws.amazon.com/marketplace/pp/B00CIYTQTC/ref=srh_res_product_title?ie=UTF8&sr=0-3&qid=1460447105907
|
16
|
+
AWSRegionArch2AMIAmazonLinuxOfficial do
|
17
|
+
# 2016.03
|
18
|
+
image_id = {
|
19
|
+
virginia: "08111162",
|
20
|
+
oregon: "c229c0a2",
|
21
|
+
california: "1b0f7d7b",
|
22
|
+
frankfurt: "e2df388d",
|
23
|
+
ireland: "31328842",
|
24
|
+
singapore: "e90dc68a",
|
25
|
+
sydney: "f2210191",
|
26
|
+
tokyo: "f80e0596",
|
27
|
+
seoul: "6598510b",
|
28
|
+
saopaulo: "1e159872",
|
29
|
+
}
|
30
|
+
|
31
|
+
AWS_REGION.each do |key, region|
|
32
|
+
_(region) do
|
33
|
+
HVM64 "ami-#{image_id[key]}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# CentOS 7 (x86_64) with Updates HVM
|
39
|
+
# https://aws.amazon.com/marketplace/ordering/ref=dtl_psb_continue?ie=UTF8&productId=b7ee8a69-ee97-4a49-9e68-afaee216db2e
|
40
|
+
AWSRegionArch2AMICentos7Official do
|
41
|
+
# 1602, released 02/26/2016
|
42
|
+
image_id = {
|
43
|
+
virginia: "6d1c2007",
|
44
|
+
oregon: "d2c924b2",
|
45
|
+
california: "af4333cf",
|
46
|
+
ireland: "7abd0209",
|
47
|
+
frankfurt: "9bf712f4",
|
48
|
+
singapore: "f068a193",
|
49
|
+
tokyo: "eec1c380",
|
50
|
+
sydney: "fedafc9d",
|
51
|
+
seoul: "c74789a9",
|
52
|
+
saopaulo: "26b93b4a",
|
53
|
+
}
|
54
|
+
|
55
|
+
AWS_REGION.each do |key, region|
|
56
|
+
_(region) do
|
57
|
+
HVM64 "ami-#{image_id[key]}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Ubuntu Server 16.04 LTS
|
63
|
+
# https://cloud-images.ubuntu.com/locator/ec2/
|
64
|
+
AWSRegionArch2AMIUbuntu16Official do
|
65
|
+
# 16.04 LTS 20160420.3
|
66
|
+
image_id = {
|
67
|
+
virginia: "840910ee",
|
68
|
+
oregon: "fa82739a",
|
69
|
+
california: "fa82739a",
|
70
|
+
frankfurt: "f0eb089f",
|
71
|
+
ireland: "3079f543",
|
72
|
+
singapore: "a5416cc6",
|
73
|
+
sydney: "a5416cc6",
|
74
|
+
tokyo: "3c5f4152",
|
75
|
+
seoul: "a5416cc6",
|
76
|
+
saopaulo: "567cf23a",
|
77
|
+
}
|
78
|
+
|
79
|
+
AWS_REGION.each do |key, region|
|
80
|
+
_(region) do
|
81
|
+
HVM64 "ami-#{image_id[key]}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Output ec2
|
3
|
+
#
|
4
|
+
|
5
|
+
_output "#{args[:name]} instance", ref_value: "#{args[:name]} instance"
|
6
|
+
_output "#{args[:name]} instance az", ref_value: [ "#{args[:name]} instance", "AvailabilityZone" ]
|
7
|
+
_output "#{args[:name]} instance public ip", ref_value: [ "#{args[:name]} instance", "PublicIp" ] if args.key? :public_ip
|
8
|
+
_output "#{args[:name]} instance private ip", ref_value: [ "#{args[:name]} instance", "PrivateIp" ]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Output elastiacche
|
3
|
+
#
|
4
|
+
require 'kumogata/template/helper'
|
5
|
+
|
6
|
+
replication = args[:replication] || false
|
7
|
+
engine = _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
|
8
|
+
|
9
|
+
if replication
|
10
|
+
if engine == "redis"
|
11
|
+
_output "#{args[:name]} cache replication group",
|
12
|
+
ref_value: "#{args[:name]} cache replication group"
|
13
|
+
_output "#{args[:name]} cache replication group primary address",
|
14
|
+
ref_value: [ "#{args[:name]} cache replication group", "PrimaryEndPoint.Address" ]
|
15
|
+
_output "#{args[:name]} cache replication group primary port",
|
16
|
+
ref_value: [ "#{args[:name]} cache replication group", "PrimaryEndPoint.Port" ]
|
17
|
+
_output "#{args[:name]} cache replication group read addresses",
|
18
|
+
ref_value: [ "#{args[:name]} cache replication group", "ReadEndPoint.Addresses" ]
|
19
|
+
_output "#{args[:name]} cache replication group read ports",
|
20
|
+
ref_value: [ "#{args[:name]} cache replication group", "ReadEndPoint.Ports" ]
|
21
|
+
end
|
22
|
+
else
|
23
|
+
_output "#{args[:name]} cache cluster", ref_value: "#{args[:name]} cache cluster"
|
24
|
+
if engine == "memcached"
|
25
|
+
_output "#{args[:name]} cache cluster address",
|
26
|
+
ref_value: [ "#{args[:name]} cache cluster", "ConfigurationEndpoint.Address" ]
|
27
|
+
_output "#{args[:name]} cache cluster port",
|
28
|
+
ref_value: [ "#{args[:name]} cache cluster", "ConfigurationEndpoint.Port" ]
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#
|
2
|
+
# Output elb
|
3
|
+
#
|
4
|
+
|
5
|
+
_output "#{args[:name]} load balancer",
|
6
|
+
ref_value: "#{args[:name]} load balancer"
|
7
|
+
_output "#{args[:name]} load balancer dns name",
|
8
|
+
ref_value: [ "#{args[:name]} load balancer", "DNSName" ]
|
9
|
+
_output "#{args[:name]} load balancer security group name",
|
10
|
+
ref_value: [ "#{args[:name]} load balancer", "SourceSecurityGroup.GroupName" ]
|
11
|
+
_output "#{args[:name]} load balancer securiry group owner",
|
12
|
+
ref_value: [ "#{args[:name]} load balancer", "SourceSecurityGroup.OwnerAlias" ]
|