kumogata-template 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +54 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +75 -0
  6. data/README.md +204 -0
  7. data/Rakefile +23 -0
  8. data/bin/kumogata-template +9 -0
  9. data/kumogata-template.gemspec +26 -0
  10. data/lib/kumogata/template.rb +17 -0
  11. data/lib/kumogata/template/autoscaling.rb +77 -0
  12. data/lib/kumogata/template/cloudwatch.rb +28 -0
  13. data/lib/kumogata/template/codedeploy.rb +85 -0
  14. data/lib/kumogata/template/const.rb +175 -0
  15. data/lib/kumogata/template/datapipeline.rb +90 -0
  16. data/lib/kumogata/template/dynamodb.rb +111 -0
  17. data/lib/kumogata/template/ec2.rb +165 -0
  18. data/lib/kumogata/template/ecs.rb +119 -0
  19. data/lib/kumogata/template/elasticbeanstalk.rb +33 -0
  20. data/lib/kumogata/template/elb.rb +132 -0
  21. data/lib/kumogata/template/emr.rb +166 -0
  22. data/lib/kumogata/template/events.rb +25 -0
  23. data/lib/kumogata/template/ext/argument_parser.rb +8 -0
  24. data/lib/kumogata/template/ext/kumogata.rb +103 -0
  25. data/lib/kumogata/template/helper.rb +211 -0
  26. data/lib/kumogata/template/iam.rb +96 -0
  27. data/lib/kumogata/template/lambda.rb +34 -0
  28. data/lib/kumogata/template/s3.rb +223 -0
  29. data/lib/kumogata/template/sns.rb +25 -0
  30. data/lib/kumogata/template/version.rb +1 -0
  31. data/template/_template.rb +25 -0
  32. data/template/autoscaling-group.rb +47 -0
  33. data/template/autoscaling-launch-configuration.rb +54 -0
  34. data/template/autoscaling-lifecycle-hook.rb +27 -0
  35. data/template/autoscaling-scaling-policy.rb +33 -0
  36. data/template/autoscaling-scheduled-action.rb +37 -0
  37. data/template/cloudtrail.rb +39 -0
  38. data/template/cloudwatch-alarm.rb +45 -0
  39. data/template/codedeploy-application.rb +15 -0
  40. data/template/codedeploy-deployment-config.rb +23 -0
  41. data/template/codedeploy-deployment-group.rb +35 -0
  42. data/template/datapipeline-pipeline.rb +28 -0
  43. data/template/dynamodb-table.rb +33 -0
  44. data/template/ec2-eip-association.rb +23 -0
  45. data/template/ec2-eip.rb +17 -0
  46. data/template/ec2-instance.rb +65 -0
  47. data/template/ec2-internet-gateway.rb +15 -0
  48. data/template/ec2-nat-gateway.rb +17 -0
  49. data/template/ec2-network-acl-entry.rb +30 -0
  50. data/template/ec2-network-acl.rb +17 -0
  51. data/template/ec2-route-table.rb +17 -0
  52. data/template/ec2-route.rb +27 -0
  53. data/template/ec2-security-group.rb +24 -0
  54. data/template/ec2-subnet-network-acl-association.rb +17 -0
  55. data/template/ec2-subnet-route-table-association.rb +17 -0
  56. data/template/ec2-subnet.rb +23 -0
  57. data/template/ec2-volume-attachment.rb +19 -0
  58. data/template/ec2-volume.rb +31 -0
  59. data/template/ec2-vpc-endpoint.rb +23 -0
  60. data/template/ec2-vpc-gateway-attachment.rb +19 -0
  61. data/template/ec2-vpc.rb +24 -0
  62. data/template/ecs-cluster.rb +11 -0
  63. data/template/ecs-service.rb +24 -0
  64. data/template/ecs-task-definition.rb +18 -0
  65. data/template/elasticache-cache-cluster.rb +63 -0
  66. data/template/elasticache-parameter-group.rb +20 -0
  67. data/template/elasticache-replication-group.rb +58 -0
  68. data/template/elasticache-subnet-group.rb +17 -0
  69. data/template/elasticbeanstalk-application-version.rb +24 -0
  70. data/template/elasticbeanstalk-application.rb +17 -0
  71. data/template/elasticbeanstalk-configuration-template.rb +31 -0
  72. data/template/elasticbeanstalk-environment.rb +44 -0
  73. data/template/elb-loadbalancer.rb +46 -0
  74. data/template/emr-cluster.rb +39 -0
  75. data/template/emr-instance-group-config.rb +33 -0
  76. data/template/emr-step.rb +22 -0
  77. data/template/events-rule.rb +28 -0
  78. data/template/iam-access-key.rb +19 -0
  79. data/template/iam-group.rb +20 -0
  80. data/template/iam-instance-profile.rb +17 -0
  81. data/template/iam-managed-policy.rb +28 -0
  82. data/template/iam-policy.rb +26 -0
  83. data/template/iam-role.rb +21 -0
  84. data/template/iam-user-to-group-addition.rb +17 -0
  85. data/template/iam-user.rb +24 -0
  86. data/template/lambda-alias.rb +21 -0
  87. data/template/lambda-event-source-mapping.rb +24 -0
  88. data/template/lambda-function.rb +34 -0
  89. data/template/lambda-permission.rb +26 -0
  90. data/template/lambda-version.rb +19 -0
  91. data/template/mappings-ec2.rb +85 -0
  92. data/template/output-access-key.rb +6 -0
  93. data/template/output-arn.rb +6 -0
  94. data/template/output-autoscaling.rb +6 -0
  95. data/template/output-az.rb +6 -0
  96. data/template/output-dynamodb.rb +6 -0
  97. data/template/output-ec2.rb +8 -0
  98. data/template/output-elasticache.rb +30 -0
  99. data/template/output-elb.rb +12 -0
  100. data/template/output-emr.rb +6 -0
  101. data/template/output-rds.rb +10 -0
  102. data/template/output-redshift.rb +10 -0
  103. data/template/output-s3.rb +8 -0
  104. data/template/output-security-group.rb +5 -0
  105. data/template/output-sqs.rb +5 -0
  106. data/template/output-topic.rb +6 -0
  107. data/template/output-vpc.rb +10 -0
  108. data/template/output.rb +29 -0
  109. data/template/parameter-ec2.rb +22 -0
  110. data/template/parameter-elasticache.rb +9 -0
  111. data/template/parameter-rds.rb +9 -0
  112. data/template/parameter-redshift.rb +9 -0
  113. data/template/parameter.rb +20 -0
  114. data/template/rds-db-cluster-parameter-group.rb +22 -0
  115. data/template/rds-db-cluster.rb +47 -0
  116. data/template/rds-db-instance.rb +82 -0
  117. data/template/rds-db-parameter-group.rb +21 -0
  118. data/template/rds-db-subnet-group.rb +19 -0
  119. data/template/rds-event-subscription.rb +42 -0
  120. data/template/rds-option-group.rb +23 -0
  121. data/template/redshift-cluster-parameter-group.rb +19 -0
  122. data/template/redshift-cluster-subnet-group.rb +17 -0
  123. data/template/redshift-cluster.rb +60 -0
  124. data/template/s3-bucket-policy.rb +20 -0
  125. data/template/s3-bucket.rb +42 -0
  126. data/template/sns-topic.rb +20 -0
  127. data/template/sqs-queue.rb +27 -0
  128. data/test/_template.rb +26 -0
  129. data/test/abstract_unit.rb +101 -0
  130. data/test/autoscaling_test.rb +109 -0
  131. data/test/codedeploy_test.rb +117 -0
  132. data/test/datapipeline_test.rb +142 -0
  133. data/test/dynamodb_test.rb +184 -0
  134. data/test/ec2_test.rb +286 -0
  135. data/test/ecs_test.rb +135 -0
  136. data/test/elasticbeanstalk_test.rb +56 -0
  137. data/test/elb_test.rb +147 -0
  138. data/test/emr_test.rb +193 -0
  139. data/test/events_test.rb +22 -0
  140. data/test/helper_test.rb +547 -0
  141. data/test/iam_test.rb +93 -0
  142. data/test/lambda_test.rb +41 -0
  143. data/test/s3_test.rb +195 -0
  144. data/test/sns_test.rb +27 -0
  145. data/test/template/autoscaling-group_test.rb +177 -0
  146. data/test/template/autoscaling-launch-configuration_test.rb +117 -0
  147. data/test/template/autoscaling-lifecycle-hook_test.rb +33 -0
  148. data/test/template/autoscaling-scaling-policy_test.rb +26 -0
  149. data/test/template/autoscaling-scheduled-action_test.rb +26 -0
  150. data/test/template/cloudtrail_test.rb +55 -0
  151. data/test/template/cloudwatch-alarm_test.rb +38 -0
  152. data/test/template/codedeploy-application_test.rb +21 -0
  153. data/test/template/codedeploy-deployment-config_test.rb +26 -0
  154. data/test/template/codedeploy-deployment-group_test.rb +48 -0
  155. data/test/template/datapipeline-pipeline_test.rb +358 -0
  156. data/test/template/dynamodb-table_test.rb +94 -0
  157. data/test/template/ec2-eip-association_test.rb +22 -0
  158. data/test/template/ec2-eip_test.rb +21 -0
  159. data/test/template/ec2-instance_test.rb +95 -0
  160. data/test/template/ec2-internet-gateway_test.rb +48 -0
  161. data/test/template/ec2-nat-gateway_test.rb +22 -0
  162. data/test/template/ec2-network-acl-entry_test.rb +61 -0
  163. data/test/template/ec2-network-acl_test.rb +51 -0
  164. data/test/template/ec2-route-table_test.rb +49 -0
  165. data/test/template/ec2-route_test.rb +21 -0
  166. data/test/template/ec2-security-group_test.rb +50 -0
  167. data/test/template/ec2-subnet-netwokr-acl-association_test.rb +26 -0
  168. data/test/template/ec2-subnet-route-table-association_test.rb +22 -0
  169. data/test/template/ec2-subnet_test.rb +51 -0
  170. data/test/template/ec2-volume-attachment_test.rb +24 -0
  171. data/test/template/ec2-volume_test.rb +52 -0
  172. data/test/template/ec2-vpc-gateway-attachment_test.rb +23 -0
  173. data/test/template/ec2-vpc_test.rb +102 -0
  174. data/test/template/ecs-cluster_test.rb +18 -0
  175. data/test/template/ecs-service_test.rb +29 -0
  176. data/test/template/ecs-task-definition_test.rb +143 -0
  177. data/test/template/elasticache-cache-cluster_test.rb +77 -0
  178. data/test/template/elasticache-parameter-group_test.rb +25 -0
  179. data/test/template/elasticache-replication-group_test.rb +45 -0
  180. data/test/template/elasticache-subnet-group_test.rb +26 -0
  181. data/test/template/elasticbeanstalk-application-version_test.rb +27 -0
  182. data/test/template/elasticbeanstalk-application_test.rb +21 -0
  183. data/test/template/elasticbeanstalk-configuration-template_test.rb +23 -0
  184. data/test/template/elasticbeanstalk-environment_test.rb +56 -0
  185. data/test/template/elasticbeanstalk-template_test.rb +33 -0
  186. data/test/template/elb-loadbalancer_test.rb +94 -0
  187. data/test/template/emr-cluster_test.rb +147 -0
  188. data/test/template/emr-instance-group-config_test.rb +65 -0
  189. data/test/template/emr-step_test.rb +82 -0
  190. data/test/template/events-rule_test.rb +34 -0
  191. data/test/template/iam-access-key_test.rb +22 -0
  192. data/test/template/iam-group_test.rb +21 -0
  193. data/test/template/iam-instance-profile_test.rb +24 -0
  194. data/test/template/iam-managed-policy_test.rb +35 -0
  195. data/test/template/iam-policy_test.rb +52 -0
  196. data/test/template/iam-role_test.rb +37 -0
  197. data/test/template/iam-user-to-group-addition_test.rb +24 -0
  198. data/test/template/iam-user_test.rb +21 -0
  199. data/test/template/lambda-alias_test.rb +46 -0
  200. data/test/template/lambda-event-source-mapping_test.rb +36 -0
  201. data/test/template/lambda-function_test.rb +34 -0
  202. data/test/template/lambda-permission_test.rb +32 -0
  203. data/test/template/lambda-version_test.rb +27 -0
  204. data/test/template/mappings-ec2_test.rb +92 -0
  205. data/test/template/output-access-key_test.rb +30 -0
  206. data/test/template/output-arn_test.rb +30 -0
  207. data/test/template/output-autoscaling_test.rb +27 -0
  208. data/test/template/output-az_test.rb +31 -0
  209. data/test/template/output-dynamodb_test.rb +21 -0
  210. data/test/template/output-ec2_test.rb +82 -0
  211. data/test/template/output-elasticache_test.rb +107 -0
  212. data/test/template/output-elb_test.rb +48 -0
  213. data/test/template/output-emr_test.rb +30 -0
  214. data/test/template/output-rds_test.rb +39 -0
  215. data/test/template/output-redshift_test.rb +39 -0
  216. data/test/template/output-s3_test.rb +52 -0
  217. data/test/template/output-security-group_test.rb +21 -0
  218. data/test/template/output-sqs_test.rb +21 -0
  219. data/test/template/output-topic_test.rb +30 -0
  220. data/test/template/output-vpc_test.rb +48 -0
  221. data/test/template/output_test.rb +87 -0
  222. data/test/template/parameter-ec2_test.rb +44 -0
  223. data/test/template/parameter-elasticache_test.rb +30 -0
  224. data/test/template/parameter-rds_test.rb +30 -0
  225. data/test/template/parameter-redshift_test.rb +30 -0
  226. data/test/template/parameter_test.rb +40 -0
  227. data/test/template/rds-db-cluster-parameter-group_test.rb +53 -0
  228. data/test/template/rds-db-cluster_test.rb +84 -0
  229. data/test/template/rds-db-instance_test.rb +93 -0
  230. data/test/template/rds-db-parameter-group_test.rb +53 -0
  231. data/test/template/rds-db-subnet-group.rb +54 -0
  232. data/test/template/rds-event-subscription_test.rb +48 -0
  233. data/test/template/rds-option-group_test.rb +56 -0
  234. data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
  235. data/test/template/redshift-cluster-subnet-group_test.rb +26 -0
  236. data/test/template/redshift-cluster_test.rb +47 -0
  237. data/test/template/s3-bucket-policy_test.rb +40 -0
  238. data/test/template/s3-bucket_test.rb +127 -0
  239. data/test/template/sns-topic_test.rb +42 -0
  240. data/test/template/sqs-queue_test.rb +25 -0
  241. metadata +468 -0
@@ -0,0 +1,20 @@
1
+ #
2
+ # ElastiCache ParameterGroup resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "cache parameter group")
8
+ family = _ref_string("family", args)
9
+ family = "redis2.8" if family.empty?
10
+ description = args[:description] || "#{args[:name]} cache parameter group description"
11
+ properties = args[:properties] || []
12
+
13
+ _(name) do
14
+ Type "AWS::ElastiCache::ParameterGroup"
15
+ Properties do
16
+ CacheParameterGroupFamily family
17
+ Description description
18
+ Properties properties
19
+ end
20
+ end
@@ -0,0 +1,58 @@
1
+ #
2
+ # Elasticache ReplicationGroupresource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "cache replication group")
8
+ engine = _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
9
+ automatic = _bool("automatic", args, true)
10
+ auto = _bool("auto", args, true)
11
+ node = _ref_string("node", args, "cache node types")
12
+ node = _valid_values(node, ELASTICACHE_NODE_TYPES, ELASTICACHE_DEFAULT_NODE_TYPE) unless node.is_a? Hash
13
+ parameter = _ref_string("parameter", args, "cache parameter group")
14
+ if parameter.empty?
15
+ if engine == "memcached"
16
+ parameter = "default.memcached1.4"
17
+ else
18
+ parameter = "default.redis2.8"
19
+ end
20
+ end
21
+ subnet = _ref_string("subnet", args, "cache subnet group")
22
+ engine_version = _ref_string("engine_version", args, "cache engine version")
23
+ engine_version = ELASTICACHE_DEFAULT_ENGINE_VERSION[engine.to_sym] if engine_version.empty?
24
+ notification = _ref_attr_string("notification", "Arn", args)
25
+ notification = _ref_string("notification_arn", args) if notification.empty?
26
+ num = args[:num] || 2
27
+ port = _ref_string("port", args)
28
+ port = PORT[engine.to_sym] if port.empty?
29
+ azs = _availability_zones(args, false)
30
+ maintenance = _maintenance_window("elasticache", args[:maintenance] || DEFAULT_MAINTENANCE_TIME[:elasticache])
31
+ description = args[:description] || "#{args[:name]} cache replication group description"
32
+ security_groups = _ref_array("security_groups", args, "security group")
33
+ snapshot_retention = args[:snapshot_retention] || DEFAULT_SNAPSHOT_NUM
34
+ snapshot_window = _window_time("elasticache", args[:snapshot_window_start] || DEFAULT_SNAPSHOT_TIME[:elasticache])
35
+
36
+ _(name) do
37
+ Type "AWS::ElastiCache::ReplicationGroup"
38
+ Properties do
39
+ AutomaticFailoverEnabled automatic
40
+ AutoMinorVersionUpgrade auto
41
+ CacheNodeType node
42
+ CacheParameterGroupName parameter
43
+ #CacheSecurityGroupNames
44
+ CacheSubnetGroupName subnet
45
+ Engine engine
46
+ EngineVersion engine_version
47
+ NotificationTopicArn notification unless notification.empty?
48
+ NumCacheClusters num
49
+ Port port
50
+ PreferredCacheClusterAZs azs unless azs.empty?
51
+ PreferredMaintenanceWindow maintenance
52
+ ReplicationGroupDescription description
53
+ SecurityGroupIds security_groups unless security_groups.empty?
54
+ #SnapshotArns
55
+ SnapshotRetentionLimit snapshot_retention if 0 < snapshot_retention
56
+ SnapshotWindow snapshot_window unless snapshot_retention < 0 and snapshot_window.empty?
57
+ end
58
+ end
@@ -0,0 +1,17 @@
1
+ #
2
+ # ElastiCache SubnetGroup resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "cache subnet group")
8
+ description = args[:description] || "#{args[:name]} cache subnet group description"
9
+ subnets = _ref_array("subnets", args, "subnet")
10
+
11
+ _(name) do
12
+ Type "AWS::ElastiCache::SubnetGroup"
13
+ Properties do
14
+ Description description
15
+ SubnetIds subnets
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ #
2
+ # Elasticbeanstalk ApplicationVersion resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-version.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "elasticbeanstalk application version")
8
+ application = _ref_name("application", args)
9
+ description = args[:description] || ""
10
+ s3_bucket = _ref_string("s3_bucket", args, "bucket")
11
+ s3_key = args[:s3_key]
12
+
13
+ _(name) do
14
+ Type "AWS::ElasticBeanstalk::ApplicationVersion"
15
+ Properties do
16
+ ApplicationName application
17
+ Description description unless description.empty?
18
+ SourceBundle do
19
+ S3Bucket s3_bucket
20
+ S3Key s3_key
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,17 @@
1
+ #
2
+ # ElasticBeanstalk Application resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "elasticbeanstalk application")
8
+ application = _ref_name("application", args)
9
+ description = args[:description] || ""
10
+
11
+ _(name) do
12
+ Type "AWS::ElasticBeanstalk::Application"
13
+ Properties do
14
+ ApplicationName application
15
+ Destination description unless description.empty?
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Elasticbeanstalk ConfigurationTemplate resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/elasticbeanstalk'
7
+
8
+ name = _resource_name(args[:name], "elasticbeanstalk configuration template")
9
+ application = _ref_string("application", args, "elasticbeanstalk application")
10
+ description = args[:description] || ""
11
+ option = _elasticbeanstalk_option(args[:option] || [])
12
+ environment = args[:environment] || ""
13
+ solution = args[:solution] || ""
14
+ configuration =
15
+ if args.key? :configuration
16
+ _elasticbeanstalk_configuration(args[:configuration])
17
+ else
18
+ ""
19
+ end
20
+
21
+ _(name) do
22
+ Type "AWS::ElasticBeanstalk::ConfigurationTemplate"
23
+ Properties do
24
+ ApplicationName application
25
+ Description description unless description.empty?
26
+ EnvironmentId environment unless environment.empty?
27
+ OptionSettings option unless option.empty?
28
+ SolutionStackName solution unless solution.empty?
29
+ SourceConfiguration configuration unless configuration.empty?
30
+ end
31
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # Elasticbeanstalk Environment resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/elasticbeanstalk'
7
+
8
+ name = _resource_name(args[:name], "elasticbeanstalk environment")
9
+ application = _ref_string("application", args, "elasticbeanstalk application")
10
+ cname = args[:cname] || ""
11
+ description = args[:description] || ""
12
+ environment = _ref_name("environment", args)
13
+ option =
14
+ if args.key? :option
15
+ _elasticbeanstalk_option(args[:option])
16
+ else
17
+ ""
18
+ end
19
+ solution = args[:solution] || ""
20
+ template = args[:template] || ""
21
+ tier =
22
+ if args.key? :tier
23
+ _elasticbeanstalk_tier(args[:tier])
24
+ else
25
+ ""
26
+ end
27
+ version = args[:version] || ""
28
+ tags = _tags(args)
29
+
30
+ _(name) do
31
+ Type "AWS::ElasticBeanstalk::Environment"
32
+ Properties do
33
+ ApplicationName application
34
+ CNAMEPrefix cname unless cname.empty?
35
+ Description description unless description.empty?
36
+ EnvironmentName environment
37
+ OptionSettings option unless option.empty?
38
+ SolutionStackName solution
39
+ Tags tags
40
+ TemplateName template unless template.empty?
41
+ Tier tier unless tier.empty?
42
+ VersionLabel version unless version.empty?
43
+ end
44
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # ElasticLoadBalancing LoadBalancer resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/elb'
7
+
8
+ name = _resource_name(args[:name], "load balancer")
9
+ access_log = _elb_access_logging_policy(args)
10
+ app_cookie = _elb_app_cookie_stickiness_policy(args)
11
+ azs = _availability_zones(args, false)
12
+ connection_draining = _elb_connection_draining_policy(args)
13
+ connection_setting = _elb_connection_settings(args)
14
+ cross = _bool("cross", args, false)
15
+ health = _elb_health_check(args)
16
+ instances = _ref_array("instances", args, "instance")
17
+ cookie = _elb_cookie_stickiness_policy(args)
18
+ lb_name = _ref_name("lb_name", args)
19
+ listeners = _elb_listeners(args)
20
+ policies = _elb_policy_types(args)
21
+ scheme = _valid_values("scheme", %w( internal internal-facing ), "")
22
+ security_groups = _ref_array("security_groups", args, "security group")
23
+ subnets = _ref_array("subnets", args, "subnet")
24
+ tags = _tags(args)
25
+
26
+ _(name) do
27
+ Type "AWS::ElasticLoadBalancing::LoadBalancer"
28
+ Properties do
29
+ AccessLoggingPolicy access_log unless access_log.empty?
30
+ AppCookieStickinessPolicy app_cookie unless app_cookie.empty?
31
+ AvailabilityZones azs if subnets.empty?
32
+ ConnectionDrainingPolicy connection_draining
33
+ ConnectionSettings connection_setting
34
+ CrossZone cross
35
+ HealthCheck health
36
+ Instances instances unless instances.empty?
37
+ LBCookieStickinessPolicy cookie unless cookie.empty?
38
+ LoadBalancerName lb_name
39
+ Listeners listeners
40
+ Policies policies unless policies.empty?
41
+ Scheme scheme unless scheme.empty?
42
+ SecurityGroups security_groups
43
+ Subnets subnets unless subnets.empty?
44
+ Tags tags
45
+ end
46
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # EMR Cluster resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/emr'
7
+
8
+ name = _resource_name(args[:name], "emr cluster")
9
+ applications = _emr_applications(args)
10
+ bootstraps = _emr_bootstraps(args)
11
+ configurations = _emr_configurations(args)
12
+ ebs = _emr_ebs(args)
13
+ instance = _emr_job_flow(args)
14
+ job_flow_role = args[:job_flow_role] || "EMR_EC2_DefaultRole"
15
+ log = args[:log] || ""
16
+ cluster_name = _ref_name("cluster", args)
17
+ release = args[:release] || EMR_DEFAULT_RELEASE
18
+ service_role = args[:service_role] || "EMR_DefaultRole"
19
+ tags = _tags(args)
20
+ visible = _bool("visible", args, false)
21
+
22
+ _(name) do
23
+ Type "AWS::EMR::Cluster"
24
+ Properties do
25
+ #AdditionalInfo
26
+ Applications applications unless applications.empty?
27
+ BootstrapActions bootstraps unless bootstraps.empty?
28
+ Configurations configurations unless configurations.empty?
29
+ EbsConfiguration ebs unless ebs.empty?
30
+ Instances instance
31
+ JobFlowRole String job_flow_role
32
+ LogUri log unless log.empty?
33
+ Name cluster_name
34
+ ReleaseLabel release
35
+ ServiceRole service_role
36
+ Tags tags
37
+ VisibleToAllUsers visible
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # EMR Instance Group Config
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-instancegroupconfig.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/emr'
7
+
8
+ name = _resource_name(args[:name], "emr instance group config")
9
+ bid = args[:bid] || ""
10
+ configurations = args[:configurations] || []
11
+ ebs = _emr_ebs(args)
12
+ instance_count = args[:instance_count] || 1
13
+ instance_role = args[:instance_role] || "TASK"
14
+ instance_type = _ref_string("instance_type", args, "instance type")
15
+ instance_type = EMR_DEFAULT_INSTANCE_TYPE if instance_type.empty?
16
+ cluster = _ref_string("cluster", args, "emr cluster")
17
+ market = _valid_values("market", %w( on_demand, spot), "on_demand")
18
+ config_name = _ref_name("config_name", args)
19
+
20
+ _(name) do
21
+ Type "AWS::EMR::InstanceGroupConfig"
22
+ Properties do
23
+ BidPrice bid unless bid.empty?
24
+ Configurations configurations unless configurations.empty?
25
+ EbsConfiguration ebs unless ebs.empty?
26
+ InstanceCount instance_count
27
+ InstanceRole instance_role
28
+ InstanceType instance_type
29
+ JobFlowId cluster
30
+ Market market.upcase
31
+ Name config_name
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # EMR Step
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-step.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/emr'
7
+
8
+ name = _resource_name(args[:name], "emr step")
9
+ action = _valid_values(args[:action], %w( continue continue_and_wait ), "continue")
10
+ hadoop = _emr_hadoop_jar_step_config(args)
11
+ cluster = _ref_string("cluster", args, "emr cluster")
12
+ step_name = _ref_name("step_name", args)
13
+
14
+ _(name) do
15
+ Type "AWS::EMR::Step"
16
+ Properties do
17
+ ActionOnFailure action.upcase
18
+ HadoopJarStep hadoop
19
+ JobFlowId cluster
20
+ Name step_name
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ #
2
+ # Events Rule
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/events'
7
+
8
+ name = _resource_name(args[:name], "events rule")
9
+ description = args[:description] || ""
10
+ pattern = _events_pattern(args)
11
+ role = _ref_attr_string("role", "Arn", args, "role")
12
+ event_name = _ref_name("event", args)
13
+ schedule = args[:schedule] || ""
14
+ state = _valid_values(args[:state], %w( enabled disabled ), "enabled")
15
+ targets = _events_targets(args)
16
+
17
+ _(name) do
18
+ Type "AWS::Events::Rule"
19
+ Properties do
20
+ Description description unless description.empty?
21
+ EventPattern pattern unless schedule.empty?
22
+ Name event_name
23
+ RoleArn role unless role.empty?
24
+ ScheduleExpression schedule unless schedule.empty?
25
+ State state.upcase
26
+ Targets targets unless targets.empty?
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+ #
2
+ # IAM access-key resource
3
+ # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "access key")
8
+ serial = args[:serial] || nil
9
+ status = _valid_values(args[:status], %w( Active Inactive ), "Active")
10
+ user = _ref_string("user", args, "user")
11
+
12
+ _(name) do
13
+ Type "AWS::IAM::AccessKey"
14
+ Properties do
15
+ Serial serial unless serial.nil?
16
+ Status status
17
+ UserName user
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # IAM Group resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/iam'
7
+
8
+ name = _resource_name(args[:name], "group")
9
+ manaegd_policy_arns = args[:managed_policy_arns] || []
10
+ path = args[:path] || "/"
11
+ policies = _iam_policies("policies", args)
12
+
13
+ _(name) do
14
+ Type "AWS::IAM::Group"
15
+ Properties do
16
+ ManagedPolicyArns manaegd_policy_arns unless manaegd_policy_arns.empty?
17
+ Path path
18
+ Policies policies unless policies.empty?
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ #
2
+ # IAM instance profile resource
3
+ # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "instance profile")
8
+ path = args[:path] || "/"
9
+ roles = _ref_array("roles", args, "role")
10
+
11
+ _(name) do
12
+ Type "AWS::IAM::InstanceProfile"
13
+ Properties do
14
+ Path path
15
+ Roles roles
16
+ end
17
+ end