kumogata-template 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +4 -2
  3. data/Gemfile +1 -1
  4. data/Rakefile +1 -1
  5. data/kumogata-template.gemspec +4 -4
  6. data/lib/kumogata/template/alb.rb +48 -34
  7. data/lib/kumogata/template/api-gateway.rb +262 -0
  8. data/lib/kumogata/template/autoscaling.rb +17 -44
  9. data/lib/kumogata/template/certificate.rb +11 -8
  10. data/lib/kumogata/template/cloudfront.rb +67 -60
  11. data/lib/kumogata/template/cloudwatch.rb +7 -12
  12. data/lib/kumogata/template/codebuild.rb +4 -8
  13. data/lib/kumogata/template/codecommit.rb +2 -6
  14. data/lib/kumogata/template/codedeploy.rb +15 -0
  15. data/lib/kumogata/template/cognito.rb +203 -0
  16. data/lib/kumogata/template/const.rb +109 -47
  17. data/lib/kumogata/template/datapipeline.rb +16 -47
  18. data/lib/kumogata/template/dynamodb.rb +17 -8
  19. data/lib/kumogata/template/ec2.rb +61 -10
  20. data/lib/kumogata/template/ecr.rb +11 -9
  21. data/lib/kumogata/template/ecs.rb +256 -91
  22. data/lib/kumogata/template/elasticbeanstalk.rb +6 -9
  23. data/lib/kumogata/template/elb.rb +9 -24
  24. data/lib/kumogata/template/emr.rb +184 -51
  25. data/lib/kumogata/template/events.rb +22 -10
  26. data/lib/kumogata/template/ext/kumogata.rb +7 -7
  27. data/lib/kumogata/template/helper.rb +189 -130
  28. data/lib/kumogata/template/iam.rb +556 -146
  29. data/lib/kumogata/template/kinesis.rb +282 -0
  30. data/lib/kumogata/template/lambda.rb +43 -2
  31. data/lib/kumogata/template/logs.rb +2 -6
  32. data/lib/kumogata/template/nlb.rb +10 -0
  33. data/lib/kumogata/template/pinpoint.rb +83 -0
  34. data/lib/kumogata/template/rds.rb +52 -0
  35. data/lib/kumogata/template/redshift.rb +15 -6
  36. data/lib/kumogata/template/role.rb +425 -0
  37. data/lib/kumogata/template/s3.rb +120 -80
  38. data/lib/kumogata/template/sns.rb +2 -6
  39. data/lib/kumogata/template/version.rb +1 -1
  40. data/lib/kumogata/template.rb +9 -1
  41. data/template/_template.rb +2 -2
  42. data/template/alb-load-balancer.rb +5 -4
  43. data/template/alb-target-group.rb +8 -9
  44. data/template/api-gateway-account.rb +15 -0
  45. data/template/api-gateway-api-key.rb +22 -0
  46. data/template/api-gateway-authorizer.rb +38 -0
  47. data/template/api-gateway-base-path-mapping.rb +23 -0
  48. data/template/api-gateway-client-certificate.rb +16 -0
  49. data/template/api-gateway-deployment.rb +24 -0
  50. data/template/api-gateway-domain-name.rb +17 -0
  51. data/template/api-gateway-method.rb +71 -0
  52. data/template/api-gateway-model.rb +23 -0
  53. data/template/api-gateway-resource.rb +32 -0
  54. data/template/api-gateway-rest-api.rb +29 -0
  55. data/template/api-gateway-stage.rb +33 -0
  56. data/template/api-gateway-usage-plan-key.rb +19 -0
  57. data/template/api-gateway-usage-plan.rb +24 -0
  58. data/template/autoscaling-group.rb +2 -2
  59. data/template/autoscaling-launch-configuration.rb +7 -4
  60. data/template/autoscaling-scheduled-action.rb +0 -1
  61. data/template/certificate.rb +2 -2
  62. data/template/cloudfront-distribution.rb +4 -0
  63. data/template/cloudfront-origin-access-identity.rb +19 -0
  64. data/template/cloudtrail.rb +6 -4
  65. data/template/cloudwatch-alarm.rb +9 -3
  66. data/template/codebuild-project.rb +3 -3
  67. data/template/codecommit-repository.rb +2 -2
  68. data/template/codedeploy-application.rb +1 -1
  69. data/template/codedeploy-deployment-config.rb +1 -1
  70. data/template/codedeploy-deployment-group.rb +2 -0
  71. data/template/cognito-identity-pool.rb +34 -0
  72. data/template/cognito-identity-role-attachment.rb +22 -0
  73. data/template/cognito-user-pool-client.rb +28 -0
  74. data/template/cognito-user-pool-group.rb +24 -0
  75. data/template/cognito-user-pool-user-to-group-attachment.rb +20 -0
  76. data/template/cognito-user-pool-user.rb +28 -0
  77. data/template/cognito-user-pool.rb +45 -0
  78. data/template/datapipeline-pipeline.rb +4 -4
  79. data/template/dynamodb-table.rb +5 -1
  80. data/template/ec2-eip-association.rb +1 -1
  81. data/template/ec2-instance.rb +4 -1
  82. data/template/ec2-nat-gateway.rb +4 -0
  83. data/template/ec2-route.rb +4 -0
  84. data/template/ec2-security-group-ingress.rb +1 -1
  85. data/template/ec2-security-group.rb +2 -2
  86. data/template/ec2-subnet.rb +8 -4
  87. data/template/ec2-volume.rb +1 -2
  88. data/template/ec2-vpc-cidr-block.rb +4 -2
  89. data/template/ec2-vpc-endpoint.rb +5 -2
  90. data/template/ecr-repository.rb +2 -2
  91. data/template/ecs-cluster.rb +1 -1
  92. data/template/ecs-service.rb +19 -7
  93. data/template/ecs-task-definition.rb +4 -4
  94. data/template/elasticache-cache-cluster.rb +1 -1
  95. data/template/elasticache-parameter-group.rb +1 -1
  96. data/template/elasticache-replication-group.rb +1 -1
  97. data/template/elasticache-subnet-group.rb +1 -1
  98. data/template/elasticbeanstalk-application-version.rb +1 -1
  99. data/template/elasticbeanstalk-application.rb +1 -1
  100. data/template/elasticbeanstalk-configuration-template.rb +1 -1
  101. data/template/elasticbeanstalk-environment.rb +1 -1
  102. data/template/elb-load-balancer.rb +2 -2
  103. data/template/emr-cluster.rb +3 -3
  104. data/template/emr-instance-group-config.rb +4 -2
  105. data/template/emr-security-configuration.rb +17 -0
  106. data/template/emr-step.rb +2 -2
  107. data/template/events-rule.rb +8 -8
  108. data/template/iam-group.rb +2 -2
  109. data/template/iam-instance-profile.rb +2 -2
  110. data/template/iam-managed-policy.rb +1 -1
  111. data/template/iam-policy.rb +1 -1
  112. data/template/iam-role.rb +17 -2
  113. data/template/iam-user.rb +4 -4
  114. data/template/kinesis-firehose-delivery-stream.rb +36 -0
  115. data/template/kinesis-stream.rb +21 -0
  116. data/template/kms-alias.rb +2 -2
  117. data/template/kms-key.rb +1 -1
  118. data/template/lambda-alias.rb +2 -2
  119. data/template/lambda-event-source-mapping.rb +4 -4
  120. data/template/lambda-function.rb +17 -17
  121. data/template/lambda-permission.rb +31 -10
  122. data/template/lambda-version.rb +4 -2
  123. data/template/logs-destination.rb +1 -1
  124. data/template/logs-log-group.rb +1 -1
  125. data/template/logs-log-stream.rb +4 -2
  126. data/template/logs-metric-filter.rb +1 -1
  127. data/template/logs-subscription_filter.rb +1 -1
  128. data/template/mappings-ec2.rb +114 -52
  129. data/template/output-arn.rb +12 -4
  130. data/template/output-certificate.rb +11 -0
  131. data/template/output-distribution.rb +11 -0
  132. data/template/output-domain-name.rb +11 -0
  133. data/template/output-ecr-repository.rb +16 -0
  134. data/template/output-eip.rb +11 -0
  135. data/template/output-lambda-function.rb +6 -0
  136. data/template/output-name.rb +7 -2
  137. data/template/output-origin-access-identity.rb +13 -0
  138. data/template/output-rds-cluster.rb +17 -0
  139. data/template/{output-rds.rb → output-rds-instance.rb} +1 -1
  140. data/template/output-redshift.rb +11 -0
  141. data/template/output-rest-api.rb +11 -0
  142. data/template/output-s3.rb +3 -0
  143. data/template/output-stage.rb +19 -0
  144. data/template/output-subnet.rb +6 -3
  145. data/template/output-trail.rb +14 -0
  146. data/template/output-user-pool-client.rb +14 -0
  147. data/template/output-user-pool.rb +17 -0
  148. data/template/output-vpc.rb +13 -3
  149. data/template/output.rb +3 -2
  150. data/template/parameter-ec2.rb +10 -4
  151. data/template/parameter-elasticache.rb +1 -1
  152. data/template/parameter-rds.rb +51 -4
  153. data/template/parameter-redshift.rb +31 -1
  154. data/template/parameter.rb +87 -7
  155. data/template/rds-db-cluster-parameter-group.rb +18 -4
  156. data/template/rds-db-cluster.rb +19 -7
  157. data/template/rds-db-instance.rb +55 -131
  158. data/template/rds-db-parameter-group.rb +29 -3
  159. data/template/rds-db-subnet-group.rb +1 -1
  160. data/template/rds-event-subscription.rb +2 -4
  161. data/template/rds-option-group.rb +28 -5
  162. data/template/redshift-cluster-parameter-group.rb +3 -1
  163. data/template/redshift-cluster-security-group.rb +17 -0
  164. data/template/redshift-cluster-subnet-group.rb +3 -1
  165. data/template/redshift-cluster.rb +15 -12
  166. data/template/s3-bucket.rb +10 -5
  167. data/template/sns-topic.rb +2 -2
  168. data/template/sqs-queue.rb +1 -1
  169. data/test/abstract_unit.rb +2 -9
  170. data/test/cloudfront_test.rb +57 -28
  171. data/test/codedeploy_test.rb +21 -0
  172. data/test/datapipeline_test.rb +0 -22
  173. data/test/ec2_test.rb +12 -52
  174. data/test/ecs_test.rb +30 -26
  175. data/test/emr_test.rb +101 -20
  176. data/test/events_test.rb +47 -0
  177. data/test/helper_test.rb +251 -281
  178. data/test/iam_test.rb +572 -57
  179. data/test/lambda_test.rb +1 -1
  180. data/test/s3_test.rb +49 -14
  181. data/test/template/alb-load-balancer_test.rb +4 -5
  182. data/test/template/alb-target-group_test.rb +1 -3
  183. data/test/template/api-gateway-account_test.rb +26 -0
  184. data/test/template/api-gateway-api-key_test.rb +33 -0
  185. data/test/template/api-gateway-authorizer_test.rb +62 -0
  186. data/test/template/api-gateway-base-path-mapping_test.rb +27 -0
  187. data/test/template/api-gateway-client-certificate_test.rb +21 -0
  188. data/test/template/api-gateway-deployment_test.rb +27 -0
  189. data/test/template/api-gateway-domain-name_test.rb +26 -0
  190. data/test/template/api-gateway-method_test.rb +29 -0
  191. data/test/template/api-gateway-model_test.rb +37 -0
  192. data/test/template/api-gateway-resource_test.rb +82 -0
  193. data/test/template/api-gateway-rest-api_test.rb +33 -0
  194. data/test/template/api-gateway-stage_test.rb +39 -0
  195. data/test/template/api-gateway-usage-plan-key_test.rb +25 -0
  196. data/test/template/api-gateway-usage-plan_test.rb +42 -0
  197. data/test/template/cloudfront-distribution_test.rb +41 -3
  198. data/test/template/cloudtrail_test.rb +13 -5
  199. data/test/template/cloudwatch-alarm_test.rb +14 -2
  200. data/test/template/codebuild-project_test.rb +2 -11
  201. data/test/template/codecommit-repository_test.rb +12 -1
  202. data/test/template/cognito-identity-pool_test.rb +32 -0
  203. data/test/template/cognito-identity-role-attachment_test.rb +38 -0
  204. data/test/template/cognito-user-pool-client_test.rb +36 -0
  205. data/test/template/cognito-user-pool-group_test.rb +36 -0
  206. data/test/template/cognito-user-pool-user-to-group-attachment_test.rb +29 -0
  207. data/test/template/cognito-user-pool-user_test.rb +38 -0
  208. data/test/template/cognito-user-pool_test.rb +99 -0
  209. data/test/template/datapipeline-pipeline_test.rb +45 -6
  210. data/test/template/dynamodb-table_test.rb +19 -1
  211. data/test/template/ec2-instance_test.rb +9 -1
  212. data/test/template/ec2-nat-gateway_test.rb +29 -1
  213. data/test/template/ec2-security-group-egress_test.rb +1 -0
  214. data/test/template/ec2-security-group-ingress_test.rb +1 -0
  215. data/test/template/ec2-security-group_test.rb +11 -1
  216. data/test/template/ec2-spot-fleet_test.rb +1 -1
  217. data/test/template/ec2-subnet_test.rb +62 -1
  218. data/test/template/ec2-vpc-cidr-block_test.rb +1 -1
  219. data/test/template/ec2-vpc-endpoint_test.rb +56 -0
  220. data/test/template/ecr-repository_test.rb +63 -11
  221. data/test/template/ecs-service_test.rb +13 -2
  222. data/test/template/ecs-task-definition_test.rb +86 -13
  223. data/test/template/elasticache-cache-cluster_test.rb +4 -6
  224. data/test/template/elasticache-replication-group_test.rb +1 -1
  225. data/test/template/elasticbeanstalk-application-version_test.rb +1 -0
  226. data/test/template/elasticbeanstalk-application_test.rb +2 -1
  227. data/test/template/elasticbeanstalk-configuration-template_test.rb +2 -1
  228. data/test/template/elasticbeanstalk-template_test.rb +1 -0
  229. data/test/template/elb-load-balancer_test.rb +1 -3
  230. data/test/template/emr-cluster_test.rb +2 -14
  231. data/test/template/emr-instance-group-config_test.rb +2 -4
  232. data/test/template/emr-security-configuration_test.rb +34 -0
  233. data/test/template/emr-step_test.rb +2 -6
  234. data/test/template/events-rule_test.rb +3 -3
  235. data/test/template/iam-group_test.rb +11 -1
  236. data/test/template/iam-instance-profile_test.rb +11 -1
  237. data/test/template/iam-managed-policy_test.rb +1 -0
  238. data/test/template/iam-policy_test.rb +1 -3
  239. data/test/template/iam-role_test.rb +12 -2
  240. data/test/template/iam-user_test.rb +11 -17
  241. data/test/template/kinesis-firehorse-delivery-stream_test.rb +68 -0
  242. data/test/template/kinesis-stream_test.rb +61 -0
  243. data/test/template/kms-key_test.rb +1 -0
  244. data/test/template/lambda-alias_test.rb +2 -3
  245. data/test/template/lambda-event-source-mapping_test.rb +1 -1
  246. data/test/template/lambda-function_test.rb +20 -32
  247. data/test/template/lambda-permission_test.rb +7 -4
  248. data/test/template/lambda-version_test.rb +5 -2
  249. data/test/template/logs-log-group_test.rb +1 -3
  250. data/test/template/logs-log-stream_test.rb +2 -6
  251. data/test/template/logs-metric-filter_test.rb +1 -3
  252. data/test/template/logs-subscription-filter_test.rb +1 -3
  253. data/test/template/mappings-ec2_test.rb +10 -3
  254. data/test/template/output-domain-name_test.rb +30 -0
  255. data/test/template/output-name_test.rb +9 -0
  256. data/test/template/{output-rds_test.rb → output-rds-instance_test.rb} +2 -2
  257. data/test/template/output-rest-api_test.rb +30 -0
  258. data/test/template/output-s3_test.rb +9 -0
  259. data/test/template/output-stage_test.rb +43 -0
  260. data/test/template/output-user-pool-client_test.rb +39 -0
  261. data/test/template/output-user-pool_test.rb +48 -0
  262. data/test/template/output_test.rb +3 -1
  263. data/test/template/parameter-ec2_test.rb +22 -24
  264. data/test/template/parameter-elasticache_test.rb +2 -1
  265. data/test/template/parameter-rds_test.rb +32 -3
  266. data/test/template/parameter-redshift_test.rb +31 -2
  267. data/test/template/parameter_test.rb +37 -4
  268. data/test/template/rds-db-cluster-parameter-group_test.rb +1 -1
  269. data/test/template/rds-db-cluster_test.rb +4 -20
  270. data/test/template/rds-db-instance_test.rb +3 -373
  271. data/test/template/rds-db-parameter-group_test.rb +1 -1
  272. data/test/template/rds-option-group_test.rb +2 -2
  273. data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
  274. data/test/template/redshift-cluster-security-group_test.rb +49 -0
  275. data/test/template/redshift-cluster-subnet-group_test.rb +28 -0
  276. data/test/template/redshift-cluster_test.rb +33 -5
  277. data/test/template/s3-bucket_test.rb +6 -20
  278. metadata +130 -22
@@ -0,0 +1,45 @@
1
+ #
2
+ # Cognito User Pool resource
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+ require 'kumogata/template/cognito'
7
+
8
+ name = _resource_name(args[:name], "user pool")
9
+ admin_config = _cognito_admin_config(args)
10
+ aliases = args[:aliases] || [] # phone_number, email, and/or preferred_username
11
+ auto_verifies = args[:auto_verifies] || [ "email" ] # email and/or phone_number
12
+ device_config = _cognito_device_config(args)
13
+ email_config = _cognito_email_config(args)
14
+ email_verify = _cognito_email_verify(args)
15
+ lambda_config = _cognito_lambda_config(args)
16
+ mfa = _valid_values(args[:mfa], %w( off on optional ), "")
17
+ policies = _cognito_policies(args)
18
+ pool_name = _name("pool", args)
19
+ schemas = _cognito_schemas(args)
20
+ sms_auth = args[:sms_auth] || ""
21
+ sms_config = _cognito_sms_config(args)
22
+ sms_verify = _ref_string_default("sms_verify", args)
23
+ tags = _tags_string(args, "pool")
24
+
25
+ _(name) do
26
+ Type "AWS::Cognito::UserPool"
27
+ Properties do
28
+ AdminCreateUserConfig admin_config unless admin_config.empty?
29
+ AliasAttributes aliases unless aliases.empty?
30
+ AutoVerifiedAttributes auto_verifies
31
+ DeviceConfiguration device_config unless device_config.empty?
32
+ EmailConfiguration email_config unless email_config.empty?
33
+ EmailVerificationMessage email_verify[:message] unless email_verify.empty?
34
+ EmailVerificationSubject email_verify[:subject] unless email_verify.empty?
35
+ LambdaConfig lambda_config unless lambda_config.empty?
36
+ MfaConfiguration mfa.upcase unless mfa.empty?
37
+ Policies policies
38
+ UserPoolName pool_name
39
+ Schema schemas unless schemas.empty?
40
+ SmsAuthenticationMessage sms_auth unless sms_auth.empty?
41
+ SmsConfiguration sms_config unless sms_config.empty?
42
+ SmsVerificationMessage sms_verify unless sms_verify.empty?
43
+ UserPoolTags tags
44
+ end
45
+ end
@@ -7,19 +7,19 @@ require 'kumogata/template/datapipeline'
7
7
 
8
8
  name = _resource_name(args[:name], "pipeline")
9
9
  active = _bool("active", args, true)
10
- description = args[:description] || ""
11
- pipeline_name = _ref_name("pl_name", args)
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} pipeline description")
11
+ pipeline = _name("pipeline", args)
12
12
  parameter_objects = _datapipeline_parameter_objects(args)
13
13
  parameter_values = _datapipeline_parameter_values(args)
14
14
  pipeline_objects = _datapipeline_pipeline_objects(args)
15
- pipeline_tags = _datapipeline_pipeline_tags(args)
15
+ pipeline_tags = _tags(args, "pipeline")
16
16
 
17
17
  _(name) do
18
18
  Type "AWS::DataPipeline::Pipeline"
19
19
  Properties do
20
20
  Activate active
21
21
  Description description unless description.empty?
22
- Name pipeline_name
22
+ Name pipeline
23
23
  ParameterObjects parameter_objects unless parameter_objects.empty?
24
24
  ParameterValues parameter_values unless parameter_values.empty?
25
25
  PipelineObjects pipeline_objects
@@ -17,7 +17,9 @@ stream =
17
17
  else
18
18
  []
19
19
  end
20
- table = _ref_name("table", args)
20
+ table = _name("table", args)
21
+ tags = _tags(args, "table")
22
+ ttl = _dynamodb_ttl(args)
21
23
 
22
24
  _(name) do
23
25
  Type "AWS::DynamoDB::Table"
@@ -29,5 +31,7 @@ _(name) do
29
31
  ProvisionedThroughput provisioned
30
32
  StreamSpecification stream unless stream.empty?
31
33
  TableName table
34
+ Tags tags
35
+ TimeToLiveSpecification ttl unless ttl.empty?
32
36
  end
33
37
  end
@@ -15,7 +15,7 @@ _(name) do
15
15
  Type "AWS::EC2::EIPAssociation"
16
16
  Properties do
17
17
  AllocationId allocation
18
- EIP eip
18
+ EIP eip unless eip.empty?
19
19
  InstanceId instance unless instance.empty?
20
20
  NetworkInterfaceId network unless network.empty?
21
21
  PrivateIpAddress private_ip unless private_ip.empty?
@@ -5,6 +5,9 @@
5
5
  require 'kumogata/template/helper'
6
6
  require 'kumogata/template/ec2'
7
7
 
8
+ args[:block_device] = [] unless args.key? :block_device
9
+ args[:block_device] += _ec2_to_block_device_ecs(args) if args.key? :ecs
10
+
8
11
  name = _resource_name(args[:name], "instance")
9
12
  instance_type = _ref_string("instance_type", args, "instance type")
10
13
  affinity = _valid_values(args[:affinity], %w( host default ), "")
@@ -13,7 +16,7 @@ block_device = (args[:block_device] || []).collect{|v| _ec2_block_device(v) }
13
16
  disable_termination = _bool("disable_termination", args, false)
14
17
  host_id = args[:host_id] || ""
15
18
  iam_instance = _ref_string("iam_instance", args, "iam instance profile")
16
- image =_ec2_image(instance_type, args)
19
+ image =_ec2_image(args)
17
20
  instance_initiated = args[:instance_initiated] || "stop"
18
21
  ipv6_addresses = args[:ipv6_addresses] || []
19
22
  kernel = args[:kernel] || ""
@@ -7,11 +7,15 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "nat gateway")
8
8
  allocation = _ref_attr_string("allocation", "AllocationId", args, "eip")
9
9
  subnet = _ref_string("subnet", args, "subnet")
10
+ tags = _tags(args)
11
+ depends = _depends([ { ref_allocation: 'eip' } ], args)
10
12
 
11
13
  _(name) do
12
14
  Type "AWS::EC2::NatGateway"
13
15
  Properties do
14
16
  AllocationId allocation
15
17
  SubnetId subnet
18
+ Tags tags
16
19
  end
20
+ DependsOn depends unless depends.empty?
17
21
  end
@@ -7,18 +7,21 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "route")
8
8
  destination_cidr = args[:destination_cidr] || "0.0.0.0/0"
9
9
  destination_cidr_ipv6 = args[:destination_cidr_ipv6] || ""
10
+ egress_only = _ref_string("engress_only", args)
10
11
  gateway = _ref_string("gateway", args, "internet gateway")
11
12
  instance = _ref_string("instance", args, "intance")
12
13
  nat_gateway = _ref_string("nat_gateway", args, "nat gateway")
13
14
  network_interface = _ref_string("network_interface", args)
14
15
  route_table = _ref_string("route_table", args, "route table")
15
16
  vpc_peering_connection = _ref_string("vpc_peering_connection", args)
17
+ depends = _depends([ { ref_nat_gateway: 'nat gateway' } ], args)
16
18
 
17
19
  _(name) do
18
20
  Type "AWS::EC2::Route"
19
21
  Properties do
20
22
  DestinationCidrBlock destination_cidr if destination_cidr_ipv6.empty?
21
23
  DestinationIpv6CidrBlock destination_cidr_ipv6 if destination_cidr.empty?
24
+ EgressOnlyInternetGatewayId egress_only unless destination_cidr_ipv6.empty?
22
25
  GatewayId gateway unless gateway.empty?
23
26
  InstanceId instance unless instance.empty?
24
27
  NatGatewayId nat_gateway unless nat_gateway.empty?
@@ -26,4 +29,5 @@ _(name) do
26
29
  RouteTableId route_table unless route_table.empty?
27
30
  VpcPeeringConnectionId vpc_peering_connection unless vpc_peering_connection.empty?
28
31
  end
32
+ DependsOn depends unless depends.empty?
29
33
  end
@@ -11,7 +11,7 @@ group_id = _ref_string("group_id", args, "security group")
11
11
  ingress["GroupId"] = group_id unless group_id.empty?
12
12
  group_name = _ref_string("group_name", args, "security group")
13
13
  ingress["GroupName"] = group_name unless group_name.empty?
14
- ingress["GroupName"] = _ref_name("name", args, "security group") if group_name.empty? and group_id.empty?
14
+ ingress["GroupName"] = _ref_string("name", args, "security group") if group_name.empty? and group_id.empty?
15
15
 
16
16
  _(name) do
17
17
  Type "AWS::EC2::SecurityGroupIngress"
@@ -6,8 +6,8 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/ec2'
7
7
 
8
8
  name = _resource_name(args[:name], "security group")
9
- group_name = _real_name("group", args)
10
- description = args[:description] || "#{args[:name]} security group description"
9
+ group_name = _name("group", args)
10
+ description = _ref_string_default('description', args, '', "#{args[:name]} security group description")
11
11
  egress = _ec2_security_group_egress_rules("egress", args)
12
12
  ingress = _ec2_security_group_ingress_rules("ingress", args)
13
13
  tags = _tags(args)
@@ -6,18 +6,22 @@ require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "subnet")
8
8
  az = _availability_zone(args, false)
9
- cidr = _ref_string("cidr", args)
10
- cidr = "10.1.0.0/24" if cidr.empty?
11
- map_public_ip_on_launch = _bool("map_public_ip_on_launch", args, true)
9
+ cidr = _ref_string_default("cidr", args, "", "10.1.0.0/24")
10
+ ipv6_cidr = _ref_string_default("ipv6_cidr", args)
11
+ public_ip = _bool("public_ip", args, true)
12
12
  tags = _tags(args)
13
13
  vpc = _ref_string("vpc", args, "vpc")
14
14
 
15
+ public_ip = "" unless ipv6_cidr.empty?
16
+
15
17
  _(name) do
16
18
  Type "AWS::EC2::Subnet"
17
19
  Properties do
20
+ AssignIPv6AddressOnCreation true unless ipv6_cidr.empty?
18
21
  AvailabilityZone az unless az.empty?
19
22
  CidrBlock cidr
20
- MapPublicIpOnLaunch map_public_ip_on_launch
23
+ Ipv6CidrBlock ipv6_cidr unless ipv6_cidr.empty?
24
+ MapPublicIpOnLaunch public_ip
21
25
  Tags tags
22
26
  VpcId vpc
23
27
  end
@@ -9,8 +9,7 @@ auto_enable = _bool("auto_enable", args, false)
9
9
  az = _availability_zone(args)
10
10
  encrypted = _bool("encrypted", args, false)
11
11
  iops = args[:iops] || 300
12
- size = _ref_string("size", args)
13
- size = 10 if size.empty?
12
+ size = _ref_string_default("size", args, "", 10)
14
13
  snapshot = args[:snapshot] || ""
15
14
  tags = _tags(args)
16
15
  type = _valid_values(args[:type], %w( io1 gp2 sc1 st1 ), "gp2")
@@ -5,13 +5,15 @@
5
5
  require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "vpc cidr block")
8
- cidr = true
8
+ cidr = _ref_string("cidr", args, false)
9
+ ipv6_cidr = _bool("ipv6_cidr", args, false)
9
10
  vpc = _ref_string("vpc", args, "vpc")
10
11
 
11
12
  _(name) do
12
13
  Type "AWS::EC2::VPCCidrBlock"
13
14
  Properties do
14
- AmazonProvidedIpv6CidrBlock cidr
15
+ AmazonProvidedIpv6CidrBlock ipv6_cidr
16
+ CidrBlock cidr unless cidr.empty?
15
17
  VpcId vpc
16
18
  end
17
19
  end
@@ -3,10 +3,13 @@
3
3
  # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html
4
4
  #
5
5
  require 'kumogata/template/helper'
6
+ require 'kumogata/template/iam'
6
7
 
7
8
  name = _resource_name(args[:name], "vpc endpoint")
8
9
  route_tables = _ref_array("route_tables", args, "route table")
9
- service_name = "com.amazonaws.#{args[:region]}.s3" # now s3 support only
10
+ region = _ref_string("region", args)
11
+ region = _region if region.empty?
12
+ service = args[:service] || "s3"
10
13
  vpc = _ref_string("vpc", args, "vpc")
11
14
 
12
15
  _(name) do
@@ -17,7 +20,7 @@ _(name) do
17
20
  Statement _iam_policy_document("policy_document", args)
18
21
  end
19
22
  RouteTableIds route_tables
20
- ServiceName service_name
23
+ ServiceName _join([ "com.amazonaws", region, service ], ".")
21
24
  VpcId vpc
22
25
  end
23
26
  end
@@ -6,7 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/ecr'
7
7
 
8
8
  name = _resource_name(args[:name], "ecr repository")
9
- repo_name = _ref_name("name", args)
9
+ repo_name = _name("repository", args)
10
10
  policy = _ecr_policy("policy", args)
11
11
 
12
12
  _(name) do
@@ -16,6 +16,6 @@ _(name) do
16
16
  RepositoryPolicyText do
17
17
  Version "2012-10-17"
18
18
  Statement policy
19
- end
19
+ end unless policy.empty?
20
20
  end
21
21
  end
@@ -5,7 +5,7 @@
5
5
  require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "ecs cluster")
8
- cluster = _ref_name("cluster", args)
8
+ cluster = _name("cluster", args)
9
9
 
10
10
  _(name) do
11
11
  Type "AWS::ECS::Cluster"
@@ -6,14 +6,20 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/ecs'
7
7
 
8
8
  name = _resource_name(args[:name], "ecs service")
9
- cluster = _ref_string("cluster", args, "ecs cluster")
9
+ cluster = _ref_string("cluster", args, "ecs cluster", "arn")
10
10
  deployment = _ecs_deployment(args)
11
- desired = _ref_string("desired_count", args, "ecs desired count")
11
+ desired = _ref_string("desired", args, "ecs desired count")
12
+ health_check = args[:health_check] || ''
13
+ launch_type = _valid_values(args[:launch_type], %w( ec2 fargate ), 'ec2')
12
14
  load_balancers = _ecs_load_balancers(args)
13
- placement = _ecs_placement_service(args)
14
- role = args[:role] || ""
15
- service_name = _real_name("service", args)
15
+ network = _ecs_network(args)
16
+ placement_c = _ecs_placement_definition(args, 'placement_c')
17
+ placement_s = _ecs_placement_strategies(args, 'placement_s')
18
+ platform = args[:platform] || ''
19
+ role = _ref_string_default("role", args, "role")
20
+ service = _name("service", args)
16
21
  task = _ref_string("task", args, "ecs task definition")
22
+ depends = _depends([ { ref_lb: 'load balancer' } ], args)
17
23
 
18
24
  _(name) do
19
25
  Type "AWS::ECS::Service"
@@ -21,10 +27,16 @@ _(name) do
21
27
  Cluster cluster
22
28
  DeploymentConfiguration deployment unless deployment.empty?
23
29
  DesiredCount desired
30
+ HealthCheckGracePeriodSeconds health_check unless health_check.empty?
31
+ LaunchType launch_type.upcase
24
32
  LoadBalancers load_balancers unless load_balancers.empty?
25
- PlacementConstraints placement unless placement.empty?
33
+ NetworkConfiguration network unless network.empty?
34
+ PlacementConstraints placement_c unless placement_c.empty?
35
+ PlacementStrategies placement_s unless placement_s.empty?
36
+ PlatformVersion platform unless platform.empty?
26
37
  Role role unless role.empty?
27
- ServiceName service_name if service_name
38
+ ServiceName service
28
39
  TaskDefinition task
29
40
  end
41
+ DependsOn depends unless depends.empty?
30
42
  end
@@ -7,11 +7,11 @@ require 'kumogata/template/ecs'
7
7
 
8
8
  name = _resource_name(args[:name], "ecs task definition")
9
9
  volumes = _ecs_volumes(args)
10
- family = args[:family] || ""
11
- network = _valid_values(args[:network], %w( bridge host none ), "")
10
+ family = _name("family", args)
11
+ network = _valid_values(args[:network], %w( bridge host none ), "bridge")
12
12
  placement = _ecs_placement_definition(args)
13
13
  role = _ref_attr_string("role", "Arn", args, "role")
14
- definitions = _ecs_container_definitions(args)
14
+ containers = _ecs_containers(args)
15
15
 
16
16
  _(name) do
17
17
  Type "AWS::ECS::TaskDefinition"
@@ -21,6 +21,6 @@ _(name) do
21
21
  NetworkMode network unless network.empty?
22
22
  PlacementConstraints placement unless placement.empty?
23
23
  TaskRoleArn role unless role.empty?
24
- ContainerDefinitions definitions
24
+ ContainerDefinitions containers
25
25
  end
26
26
  end
@@ -12,7 +12,7 @@ azmode = args[:azmode] || ""
12
12
  node = _elasticache_to_node(args)
13
13
  parameter = _elasticache_to_parameter(args)
14
14
  subnet = _ref_string("subnet", args, "cache subnet group")
15
- cluster = _ref_name("cluster", args, "cache cluster")
15
+ cluster = _name("cluster", args)
16
16
  engine_version = _ref_string("engine_version", args, "cache engine version")
17
17
  engine_version = ELASTICACHE_DEFAULT_ENGINE_VERSION[engine.to_sym] if engine_version.empty?
18
18
  notification = _ref_attr_string("notification", "Arn", args)
@@ -7,7 +7,7 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "cache parameter group")
8
8
  family = _ref_string("family", args)
9
9
  family = "redis2.8" if family.empty?
10
- description = args[:description] || "#{args[:name]} cache parameter group description"
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} cache parameter group description")
11
11
  properties = args[:properties] || []
12
12
 
13
13
  _(name) do
@@ -21,7 +21,7 @@ port = _ref_string("port", args)
21
21
  port = PORT[engine.to_sym] if port.empty?
22
22
  azs = _availability_zones(args, false)
23
23
  maintenance = _maintenance_window("elasticache", args[:maintenance] || DEFAULT_MAINTENANCE_TIME[:elasticache])
24
- description = args[:description] || "#{args[:name]} cache replication group description"
24
+ description = _ref_string_default("description", args, '', "#{args[:name]} cache replication group description")
25
25
  security_groups = _ref_array("security_groups", args, "security group")
26
26
  snapshot_arn = args[:snapshot_arn] || ""
27
27
  snapshot_name = args[:snapshot_name] || ""
@@ -6,7 +6,7 @@ require 'kumogata/template/helper'
6
6
 
7
7
  name = _resource_name(args[:name], "cache subnet group")
8
8
  subnet = args[:subnet] || ""
9
- description = args[:description] || "#{args[:name]} cache subnet group description"
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} cache subnet group description")
10
10
  subnets = _ref_array("subnets", args, "subnet")
11
11
 
12
12
  _(name) do
@@ -7,7 +7,7 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "elasticbeanstalk application version")
8
8
  application = _ref_string_default("application", args,
9
9
  "elasticbeanstalk application", args[:name])
10
- description = _ref_string("description", args)
10
+ description = _ref_string_default("description", args, "", "#{args[:name]} elasticbeanstalk application version description")
11
11
  s3_bucket = _join([
12
12
  _ref_string("s3_bucket", args, "bucket"),
13
13
  _region,
@@ -7,7 +7,7 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "elasticbeanstalk application")
8
8
  application = _ref_string("application", args)
9
9
  application = args[:name] if application.empty?
10
- description = _ref_string("description", args)
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} elasticbeanstalk application description")
11
11
 
12
12
  _(name) do
13
13
  Type "AWS::ElasticBeanstalk::Application"
@@ -7,7 +7,7 @@ require 'kumogata/template/elasticbeanstalk'
7
7
 
8
8
  name = _resource_name(args[:name], "elasticbeanstalk configuration template")
9
9
  application = _ref_string("application", args, "elasticbeanstalk application")
10
- description = args[:description] || ""
10
+ description = _ref_string_default("description", args, '', "#{args[:name]} elasticbeanstalk configuration template description")
11
11
  options =
12
12
  if args.key? :options
13
13
  _elasticbeanstalk_options(args[:options])
@@ -8,7 +8,7 @@ require 'kumogata/template/elasticbeanstalk'
8
8
  name = _resource_name(args[:name], "elasticbeanstalk environment")
9
9
  application = _ref_string("application", args, "elasticbeanstalk application")
10
10
  cname = _ref_string("cname", args)
11
- description = _ref_string("description", args)
11
+ description = _ref_string_default("description", args, '', "#{args[:name]} elasticbeanstalk environment description")
12
12
  environment = _ref_string("environment", args)
13
13
  options =
14
14
  if args.key? :options
@@ -15,13 +15,13 @@ cross = _bool("cross", args, true)
15
15
  health = _elb_health_check(args)
16
16
  instances = _ref_array("instances", args, "instance")
17
17
  cookie = _elb_cookie_stickiness_policy(args)
18
- lb_name = _ref_name("lb_name", args)
18
+ lb_name = _name("lb_name", args)
19
19
  listeners = _elb_listeners(args)
20
20
  policies = _elb_policy_types(args)
21
21
  scheme = _valid_values("scheme", %w( internal internal-facing ), "")
22
22
  security_groups = _ref_array("security_groups", args, "security group")
23
23
  subnets = _ref_array("subnets", args, "subnet")
24
- tags = _tags(args)
24
+ tags = _tags(args, "lb_name")
25
25
 
26
26
  _(name) do
27
27
  Type "AWS::ElasticLoadBalancing::LoadBalancer"
@@ -18,10 +18,10 @@ configurations = _emr_configurations(args)
18
18
  instance = _emr_job_flow(args)
19
19
  job_flow_role = args[:job_flow_role] || "EMR_EC2_DefaultRole"
20
20
  log = args[:log] || ""
21
- cluster_name = _ref_name("cluster", args)
21
+ cluster = _name("cluster", args)
22
22
  release = args[:release] || EMR_DEFAULT_RELEASE
23
23
  service_role = args[:service_role] || "EMR_DefaultRole"
24
- tags = _tags(args)
24
+ tags = _tags(args, "cluster")
25
25
  visible = _bool("visible", args, false)
26
26
 
27
27
  _(name) do
@@ -35,7 +35,7 @@ _(name) do
35
35
  Instances instance
36
36
  JobFlowRole String job_flow_role
37
37
  LogUri log unless log.empty?
38
- Name cluster_name
38
+ Name cluster
39
39
  ReleaseLabel release
40
40
  ServiceRole service_role
41
41
  Tags tags
@@ -6,6 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/emr'
7
7
 
8
8
  name = _resource_name(args[:name], "emr instance group config")
9
+ autoscaling = _emr_instance_autoscaling(args)
9
10
  bid = args[:bid] || ""
10
11
  configurations = args[:configurations] || []
11
12
  ebs = _emr_ebs(args)
@@ -15,11 +16,12 @@ instance_type = _ref_string("instance_type", args, "instance type")
15
16
  instance_type = EMR_DEFAULT_INSTANCE_TYPE if instance_type.empty?
16
17
  cluster = _ref_string("cluster", args, "emr cluster")
17
18
  market = _valid_values("market", %w( on_demand, spot), "on_demand")
18
- config_name = _ref_name("config_name", args)
19
+ config = _name("config", args)
19
20
 
20
21
  _(name) do
21
22
  Type "AWS::EMR::InstanceGroupConfig"
22
23
  Properties do
24
+ AutoScalingPolicy autoscaling unless autoscaling.empty?
23
25
  BidPrice bid unless bid.empty?
24
26
  Configurations configurations unless configurations.empty?
25
27
  EbsConfiguration ebs unless ebs.empty?
@@ -28,6 +30,6 @@ _(name) do
28
30
  InstanceType instance_type
29
31
  JobFlowId cluster
30
32
  Market market.upcase
31
- Name config_name
33
+ Name config
32
34
  end
33
35
  end
@@ -0,0 +1,17 @@
1
+ #
2
+ # EMR security configuration
3
+ # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-securityconfiguration.html
4
+ #
5
+ require 'kumogata/template/helper'
6
+
7
+ name = _resource_name(args[:name], "emr security configuration")
8
+ security = _name("security", args)
9
+ configuration = args[:configuration] || {}
10
+
11
+ _(name) do
12
+ Type "AWS::EMR::SecurityConfiguration"
13
+ Properties do
14
+ Name security
15
+ SecurityConfiguration configuration
16
+ end
17
+ end
data/template/emr-step.rb CHANGED
@@ -9,7 +9,7 @@ name = _resource_name(args[:name], "emr step")
9
9
  action = _valid_values(args[:action], %w( continue continue_and_wait ), "continue")
10
10
  hadoop = _emr_hadoop_jar_step_config(args)
11
11
  cluster = _ref_string("cluster", args, "emr cluster")
12
- step_name = _ref_name("step_name", args)
12
+ step = _name("step", args)
13
13
 
14
14
  _(name) do
15
15
  Type "AWS::EMR::Step"
@@ -17,6 +17,6 @@ _(name) do
17
17
  ActionOnFailure action.upcase
18
18
  HadoopJarStep hadoop
19
19
  JobFlowId cluster
20
- Name step_name
20
+ Name step
21
21
  end
22
22
  end
@@ -6,23 +6,23 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/events'
7
7
 
8
8
  name = _resource_name(args[:name], "events rule")
9
- description = args[:description] || ""
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} events rule description")
10
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] || ""
11
+ event = _name("event", args)
12
+ schedule = _events_to_schedule_expression(args[:schedule])
14
13
  state = _valid_values(args[:state], %w( enabled disabled ), "enabled")
15
14
  targets = _events_targets(args)
15
+ depends = _depends([ { ref_lambda_function: 'lambda function' } ], args)
16
16
 
17
17
  _(name) do
18
18
  Type "AWS::Events::Rule"
19
19
  Properties do
20
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?
21
+ EventPattern pattern if schedule.empty?
22
+ Name event
23
+ ScheduleExpression schedule if pattern.empty?
25
24
  State state.upcase
26
25
  Targets targets unless targets.empty?
27
26
  end
27
+ DependsOn depends unless depends.empty?
28
28
  end
@@ -6,7 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/iam'
7
7
 
8
8
  name = _resource_name(args[:name], "group")
9
- group_name = _real_name("group", args)
9
+ group = _name("group", args)
10
10
  managed_policies =
11
11
  if args.key? :managed_policies
12
12
  _iam_managed_policies(args)
@@ -19,7 +19,7 @@ policies = _iam_policies("policies", args)
19
19
  _(name) do
20
20
  Type "AWS::IAM::Group"
21
21
  Properties do
22
- GroupName group_name if group_name
22
+ GroupName group
23
23
  ManagedPolicyArns managed_policies unless managed_policies.empty?
24
24
  Path path
25
25
  Policies policies unless policies.empty?
@@ -7,13 +7,13 @@ require 'kumogata/template/helper'
7
7
  name = _resource_name(args[:name], "instance profile")
8
8
  path = args[:path] || "/"
9
9
  roles = _ref_array("roles", args, "role")
10
- profile_name = _real_name("profile", args)
10
+ profile = _name("profile", args)
11
11
 
12
12
  _(name) do
13
13
  Type "AWS::IAM::InstanceProfile"
14
14
  Properties do
15
15
  Path path
16
16
  Roles roles
17
- InstanceProfileName profile_name if profile_name
17
+ InstanceProfileName profile
18
18
  end
19
19
  end
@@ -6,7 +6,7 @@ require 'kumogata/template/helper'
6
6
  require 'kumogata/template/iam'
7
7
 
8
8
  name = _resource_name(args[:name], "managed policy")
9
- description = args[:description] || ""
9
+ description = _ref_string_default("description", args, '', "#{args[:name]} managed policy description")
10
10
  groups = _ref_array("groups", args)
11
11
  path = args[:path] || "/"
12
12
  roles = _ref_array("roles", args)
@@ -7,7 +7,7 @@ require 'kumogata/template/iam'
7
7
 
8
8
  name = _resource_name(args[:name], "policy")
9
9
  groups = _ref_array("groups", args, "group")
10
- policy = _ref_name("policy", args)
10
+ policy = _name("policy", args)
11
11
  roles = _ref_array("roles", args, "role")
12
12
  users = _ref_array("users", args, "user")
13
13