kumogata-template 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +19 -19
  3. data/lib/kumogata/template/alb.rb +99 -0
  4. data/lib/kumogata/template/certificate.rb +18 -0
  5. data/lib/kumogata/template/const.rb +7 -0
  6. data/lib/kumogata/template/ec2.rb +6 -0
  7. data/lib/kumogata/template/ecs.rb +9 -0
  8. data/lib/kumogata/template/ext/kumogata.rb +5 -6
  9. data/lib/kumogata/template/helper.rb +4 -0
  10. data/lib/kumogata/template/version.rb +1 -1
  11. data/lib/kumogata/template.rb +2 -0
  12. data/template/alb-listener-rule.rb +22 -0
  13. data/template/alb-listener.rb +26 -0
  14. data/template/alb-load-balancer.rb +27 -0
  15. data/template/alb-target-group.rb +39 -0
  16. data/template/autoscaling-group.rb +2 -0
  17. data/template/certificate.rb +20 -0
  18. data/template/ec2-flow-log.rb +41 -0
  19. data/template/ec2-host.rb +21 -0
  20. data/template/ec2-instance.rb +5 -1
  21. data/template/ec2-spot-fleet.rb +16 -0
  22. data/template/ecs-service.rb +2 -0
  23. data/template/{elb-loadbalancer.rb → elb-load-balancer.rb} +1 -1
  24. data/template/iam-group.rb +2 -0
  25. data/template/iam-role.rb +11 -0
  26. data/template/iam-user.rb +2 -0
  27. data/template/output-alb.rb +21 -0
  28. data/template/output-elb.rb +4 -0
  29. data/template/parameter-ec2.rb +4 -4
  30. data/test/alb_test.rb +25 -0
  31. data/test/ec2_test.rb +45 -0
  32. data/test/helper_test.rb +21 -0
  33. data/test/template/alb-listener-rule_test.rb +40 -0
  34. data/test/template/alb-listener_test.rb +33 -0
  35. data/test/template/alb-load-balancer_test.rb +72 -0
  36. data/test/template/alb-target-group_test.rb +89 -0
  37. data/test/template/certificate_test.rb +27 -0
  38. data/test/template/ec2-flow-log_test.rb +26 -0
  39. data/test/template/ec2-host_test.rb +23 -0
  40. data/test/template/ec2-spot-fleet_test.rb +173 -0
  41. data/test/template/{elb-loadbalancer_test.rb → elb-load-balancer_test.rb} +1 -1
  42. data/test/template/output-alb_test.rb +105 -0
  43. data/test/template/output-elb_test.rb +61 -0
  44. data/test/template/parameter-ec2_test.rb +38 -9
  45. metadata +36 -5
@@ -0,0 +1,105 @@
1
+ require 'abstract_unit'
2
+
3
+ class OutputAlbTest < Minitest::Test
4
+ def test_normal
5
+ template = <<-EOS
6
+ _output_alb "test"
7
+ EOS
8
+ act_template = run_client_as_json(template)
9
+ exp_template = <<-EOS
10
+ {
11
+ "TestLoadBalancer": {
12
+ "Description": "description of TestLoadBalancer",
13
+ "Value": {
14
+ "Ref": "TestLoadBalancer"
15
+ }
16
+ },
17
+ "TestLoadBalancerDnsName": {
18
+ "Description": "description of TestLoadBalancerDnsName",
19
+ "Value": {
20
+ "Fn::GetAtt": [
21
+ "TestLoadBalancer",
22
+ "DNSName"
23
+ ]
24
+ }
25
+ },
26
+ "TestLoadBalancerFullName": {
27
+ "Description": "description of TestLoadBalancerFullName",
28
+ "Value": {
29
+ "Fn::GetAtt": [
30
+ "TestLoadBalancer",
31
+ "LoadBalancerFullName"
32
+ ]
33
+ }
34
+ },
35
+ "TestLoadBalancerName": {
36
+ "Description": "description of TestLoadBalancerName",
37
+ "Value": {
38
+ "Fn::GetAtt": [
39
+ "TestLoadBalancer",
40
+ "LoadBalancerName"
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ EOS
46
+ assert_equal exp_template.chomp, act_template
47
+
48
+ template = <<-EOS
49
+ _output_alb "test", security_groups: 1
50
+ EOS
51
+ act_template = run_client_as_json(template)
52
+ exp_template = <<-EOS
53
+ {
54
+ "TestLoadBalancer": {
55
+ "Description": "description of TestLoadBalancer",
56
+ "Value": {
57
+ "Ref": "TestLoadBalancer"
58
+ }
59
+ },
60
+ "TestLoadBalancerDnsName": {
61
+ "Description": "description of TestLoadBalancerDnsName",
62
+ "Value": {
63
+ "Fn::GetAtt": [
64
+ "TestLoadBalancer",
65
+ "DNSName"
66
+ ]
67
+ }
68
+ },
69
+ "TestLoadBalancerFullName": {
70
+ "Description": "description of TestLoadBalancerFullName",
71
+ "Value": {
72
+ "Fn::GetAtt": [
73
+ "TestLoadBalancer",
74
+ "LoadBalancerFullName"
75
+ ]
76
+ }
77
+ },
78
+ "TestLoadBalancerName": {
79
+ "Description": "description of TestLoadBalancerName",
80
+ "Value": {
81
+ "Fn::GetAtt": [
82
+ "TestLoadBalancer",
83
+ "LoadBalancerName"
84
+ ]
85
+ }
86
+ },
87
+ "TestLoadBalancerSecurityGroup0": {
88
+ "Description": "description of TestLoadBalancerSecurityGroup0",
89
+ "Value": {
90
+ "Fn::Select": [
91
+ "0",
92
+ {
93
+ "Fn::GetAtt": [
94
+ "TestLoadBalancer",
95
+ "SecurityGroups"
96
+ ]
97
+ }
98
+ ]
99
+ }
100
+ }
101
+ }
102
+ EOS
103
+ assert_equal exp_template.chomp, act_template
104
+ end
105
+ end
@@ -41,6 +41,67 @@ _output_elb "test"
41
41
  ]
42
42
  }
43
43
  }
44
+ }
45
+ EOS
46
+ assert_equal exp_template.chomp, act_template
47
+
48
+ template = <<-EOS
49
+ _output_elb "test", route53: true
50
+ EOS
51
+ act_template = run_client_as_json(template)
52
+ exp_template = <<-EOS
53
+ {
54
+ "TestLoadBalancer": {
55
+ "Description": "description of TestLoadBalancer",
56
+ "Value": {
57
+ "Ref": "TestLoadBalancer"
58
+ }
59
+ },
60
+ "TestLoadBalancerCanonicalHostedZoneName": {
61
+ "Description": "description of TestLoadBalancerCanonicalHostedZoneName",
62
+ "Value": {
63
+ "Fn::GetAtt": [
64
+ "TestLoadBalancer",
65
+ "CanonicalHostedZoneName"
66
+ ]
67
+ }
68
+ },
69
+ "TestLoadBalancerCanonicalHostedZoneId": {
70
+ "Description": "description of TestLoadBalancerCanonicalHostedZoneId",
71
+ "Value": {
72
+ "Fn::GetAtt": [
73
+ "TestLoadBalancer",
74
+ "CanonicalHostedZoneID"
75
+ ]
76
+ }
77
+ },
78
+ "TestLoadBalancerDnsName": {
79
+ "Description": "description of TestLoadBalancerDnsName",
80
+ "Value": {
81
+ "Fn::GetAtt": [
82
+ "TestLoadBalancer",
83
+ "DNSName"
84
+ ]
85
+ }
86
+ },
87
+ "TestLoadBalancerSecurityGroupName": {
88
+ "Description": "description of TestLoadBalancerSecurityGroupName",
89
+ "Value": {
90
+ "Fn::GetAtt": [
91
+ "TestLoadBalancer",
92
+ "SourceSecurityGroup.GroupName"
93
+ ]
94
+ }
95
+ },
96
+ "TestLoadBalancerSecuriryGroupOwner": {
97
+ "Description": "description of TestLoadBalancerSecuriryGroupOwner",
98
+ "Value": {
99
+ "Fn::GetAtt": [
100
+ "TestLoadBalancer",
101
+ "SourceSecurityGroup.OwnerAlias"
102
+ ]
103
+ }
104
+ }
44
105
  }
45
106
  EOS
46
107
  assert_equal exp_template.chomp, act_template
@@ -22,19 +22,48 @@ _parameter_ec2 "test"
22
22
  "AllowedValues": #{allowed_values},
23
23
  "Description": "test instance type"
24
24
  },
25
- "TestIamInstanceProfile\": {
26
- "Type\": \"String\",
27
- "Default\": \"\",
28
- "Description\": \"test iam instance profile\"
25
+ "TestDataVolumeSize": {
26
+ "Type": "String",
27
+ "Default": "100",
28
+ "Description": "test data volume size"
29
+ }
30
+ }
31
+ EOS
32
+ assert_equal exp_template.chomp, act_template
33
+
34
+ template = <<-EOS
35
+ _parameter_ec2 "test", iam_instance: "test", key_name: "test"
36
+ EOS
37
+ act_template = run_client_as_json(template)
38
+ allowed_values = []
39
+ EC2_INSTANCE_TYPES.each do |type|
40
+ allowed_values << "#{type}"
41
+ end
42
+ allowed_values = JSON.generate(allowed_values)
43
+ .gsub("[", "[\n ")
44
+ .gsub("\",", "\",\n ")
45
+ .gsub("\"]", "\"\n ]")
46
+ exp_template = <<-EOS
47
+ {
48
+ "TestInstanceType": {
49
+ "Type": "String",
50
+ "Default": "#{EC2_DEFAULT_INSTANCE_TYPE}",
51
+ "AllowedValues": #{allowed_values},
52
+ "Description": "test instance type"
29
53
  },
30
- "TestDataVolumeSize\": {
31
- "Type\": \"String\",
32
- "Default\": \"100\",
33
- "Description\": \"test data volume size\"
54
+ "TestIamInstanceProfile": {
55
+ "Type": "String",
56
+ "Default": "test",
57
+ "Description": "test iam instance profile"
58
+ },
59
+ "TestDataVolumeSize": {
60
+ "Type": "String",
61
+ "Default": "100",
62
+ "Description": "test data volume size"
34
63
  },
35
64
  "TestKeyName": {
36
65
  "Type": "AWS::EC2::KeyPair::KeyName",
37
- "Default": "",
66
+ "Default": "test",
38
67
  "Description": "test key name"
39
68
  }
40
69
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoya Nakazawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -98,7 +98,9 @@ files:
98
98
  - bin/kumogata-template
99
99
  - kumogata-template.gemspec
100
100
  - lib/kumogata/template.rb
101
+ - lib/kumogata/template/alb.rb
101
102
  - lib/kumogata/template/autoscaling.rb
103
+ - lib/kumogata/template/certificate.rb
102
104
  - lib/kumogata/template/cloudwatch.rb
103
105
  - lib/kumogata/template/codedeploy.rb
104
106
  - lib/kumogata/template/const.rb
@@ -119,11 +121,16 @@ files:
119
121
  - lib/kumogata/template/sns.rb
120
122
  - lib/kumogata/template/version.rb
121
123
  - template/_template.rb
124
+ - template/alb-listener-rule.rb
125
+ - template/alb-listener.rb
126
+ - template/alb-load-balancer.rb
127
+ - template/alb-target-group.rb
122
128
  - template/autoscaling-group.rb
123
129
  - template/autoscaling-launch-configuration.rb
124
130
  - template/autoscaling-lifecycle-hook.rb
125
131
  - template/autoscaling-scaling-policy.rb
126
132
  - template/autoscaling-scheduled-action.rb
133
+ - template/certificate.rb
127
134
  - template/cloudtrail.rb
128
135
  - template/cloudwatch-alarm.rb
129
136
  - template/codedeploy-application.rb
@@ -133,6 +140,8 @@ files:
133
140
  - template/dynamodb-table.rb
134
141
  - template/ec2-eip-association.rb
135
142
  - template/ec2-eip.rb
143
+ - template/ec2-flow-log.rb
144
+ - template/ec2-host.rb
136
145
  - template/ec2-instance.rb
137
146
  - template/ec2-internet-gateway.rb
138
147
  - template/ec2-nat-gateway.rb
@@ -141,6 +150,7 @@ files:
141
150
  - template/ec2-route-table.rb
142
151
  - template/ec2-route.rb
143
152
  - template/ec2-security-group.rb
153
+ - template/ec2-spot-fleet.rb
144
154
  - template/ec2-subnet-network-acl-association.rb
145
155
  - template/ec2-subnet-route-table-association.rb
146
156
  - template/ec2-subnet.rb
@@ -160,7 +170,7 @@ files:
160
170
  - template/elasticbeanstalk-application.rb
161
171
  - template/elasticbeanstalk-configuration-template.rb
162
172
  - template/elasticbeanstalk-environment.rb
163
- - template/elb-loadbalancer.rb
173
+ - template/elb-load-balancer.rb
164
174
  - template/emr-cluster.rb
165
175
  - template/emr-instance-group-config.rb
166
176
  - template/emr-step.rb
@@ -180,6 +190,7 @@ files:
180
190
  - template/lambda-version.rb
181
191
  - template/mappings-ec2.rb
182
192
  - template/output-access-key.rb
193
+ - template/output-alb.rb
183
194
  - template/output-arn.rb
184
195
  - template/output-autoscaling.rb
185
196
  - template/output-az.rb
@@ -217,6 +228,7 @@ files:
217
228
  - template/sqs-queue.rb
218
229
  - test/_template.rb
219
230
  - test/abstract_unit.rb
231
+ - test/alb_test.rb
220
232
  - test/autoscaling_test.rb
221
233
  - test/codedeploy_test.rb
222
234
  - test/datapipeline_test.rb
@@ -232,11 +244,16 @@ files:
232
244
  - test/lambda_test.rb
233
245
  - test/s3_test.rb
234
246
  - test/sns_test.rb
247
+ - test/template/alb-listener-rule_test.rb
248
+ - test/template/alb-listener_test.rb
249
+ - test/template/alb-load-balancer_test.rb
250
+ - test/template/alb-target-group_test.rb
235
251
  - test/template/autoscaling-group_test.rb
236
252
  - test/template/autoscaling-launch-configuration_test.rb
237
253
  - test/template/autoscaling-lifecycle-hook_test.rb
238
254
  - test/template/autoscaling-scaling-policy_test.rb
239
255
  - test/template/autoscaling-scheduled-action_test.rb
256
+ - test/template/certificate_test.rb
240
257
  - test/template/cloudtrail_test.rb
241
258
  - test/template/cloudwatch-alarm_test.rb
242
259
  - test/template/codedeploy-application_test.rb
@@ -246,6 +263,8 @@ files:
246
263
  - test/template/dynamodb-table_test.rb
247
264
  - test/template/ec2-eip-association_test.rb
248
265
  - test/template/ec2-eip_test.rb
266
+ - test/template/ec2-flow-log_test.rb
267
+ - test/template/ec2-host_test.rb
249
268
  - test/template/ec2-instance_test.rb
250
269
  - test/template/ec2-internet-gateway_test.rb
251
270
  - test/template/ec2-nat-gateway_test.rb
@@ -254,6 +273,7 @@ files:
254
273
  - test/template/ec2-route-table_test.rb
255
274
  - test/template/ec2-route_test.rb
256
275
  - test/template/ec2-security-group_test.rb
276
+ - test/template/ec2-spot-fleet_test.rb
257
277
  - test/template/ec2-subnet-netwokr-acl-association_test.rb
258
278
  - test/template/ec2-subnet-route-table-association_test.rb
259
279
  - test/template/ec2-subnet_test.rb
@@ -273,7 +293,7 @@ files:
273
293
  - test/template/elasticbeanstalk-configuration-template_test.rb
274
294
  - test/template/elasticbeanstalk-environment_test.rb
275
295
  - test/template/elasticbeanstalk-template_test.rb
276
- - test/template/elb-loadbalancer_test.rb
296
+ - test/template/elb-load-balancer_test.rb
277
297
  - test/template/emr-cluster_test.rb
278
298
  - test/template/emr-instance-group-config_test.rb
279
299
  - test/template/emr-step_test.rb
@@ -293,6 +313,7 @@ files:
293
313
  - test/template/lambda-version_test.rb
294
314
  - test/template/mappings-ec2_test.rb
295
315
  - test/template/output-access-key_test.rb
316
+ - test/template/output-alb_test.rb
296
317
  - test/template/output-arn_test.rb
297
318
  - test/template/output-autoscaling_test.rb
298
319
  - test/template/output-az_test.rb
@@ -355,6 +376,7 @@ summary: Template for Kumogata.
355
376
  test_files:
356
377
  - test/_template.rb
357
378
  - test/abstract_unit.rb
379
+ - test/alb_test.rb
358
380
  - test/autoscaling_test.rb
359
381
  - test/codedeploy_test.rb
360
382
  - test/datapipeline_test.rb
@@ -370,11 +392,16 @@ test_files:
370
392
  - test/lambda_test.rb
371
393
  - test/s3_test.rb
372
394
  - test/sns_test.rb
395
+ - test/template/alb-listener-rule_test.rb
396
+ - test/template/alb-listener_test.rb
397
+ - test/template/alb-load-balancer_test.rb
398
+ - test/template/alb-target-group_test.rb
373
399
  - test/template/autoscaling-group_test.rb
374
400
  - test/template/autoscaling-launch-configuration_test.rb
375
401
  - test/template/autoscaling-lifecycle-hook_test.rb
376
402
  - test/template/autoscaling-scaling-policy_test.rb
377
403
  - test/template/autoscaling-scheduled-action_test.rb
404
+ - test/template/certificate_test.rb
378
405
  - test/template/cloudtrail_test.rb
379
406
  - test/template/cloudwatch-alarm_test.rb
380
407
  - test/template/codedeploy-application_test.rb
@@ -384,6 +411,8 @@ test_files:
384
411
  - test/template/dynamodb-table_test.rb
385
412
  - test/template/ec2-eip-association_test.rb
386
413
  - test/template/ec2-eip_test.rb
414
+ - test/template/ec2-flow-log_test.rb
415
+ - test/template/ec2-host_test.rb
387
416
  - test/template/ec2-instance_test.rb
388
417
  - test/template/ec2-internet-gateway_test.rb
389
418
  - test/template/ec2-nat-gateway_test.rb
@@ -392,6 +421,7 @@ test_files:
392
421
  - test/template/ec2-route-table_test.rb
393
422
  - test/template/ec2-route_test.rb
394
423
  - test/template/ec2-security-group_test.rb
424
+ - test/template/ec2-spot-fleet_test.rb
395
425
  - test/template/ec2-subnet-netwokr-acl-association_test.rb
396
426
  - test/template/ec2-subnet-route-table-association_test.rb
397
427
  - test/template/ec2-subnet_test.rb
@@ -411,7 +441,7 @@ test_files:
411
441
  - test/template/elasticbeanstalk-configuration-template_test.rb
412
442
  - test/template/elasticbeanstalk-environment_test.rb
413
443
  - test/template/elasticbeanstalk-template_test.rb
414
- - test/template/elb-loadbalancer_test.rb
444
+ - test/template/elb-load-balancer_test.rb
415
445
  - test/template/emr-cluster_test.rb
416
446
  - test/template/emr-instance-group-config_test.rb
417
447
  - test/template/emr-step_test.rb
@@ -431,6 +461,7 @@ test_files:
431
461
  - test/template/lambda-version_test.rb
432
462
  - test/template/mappings-ec2_test.rb
433
463
  - test/template/output-access-key_test.rb
464
+ - test/template/output-alb_test.rb
434
465
  - test/template/output-arn_test.rb
435
466
  - test/template/output-autoscaling_test.rb
436
467
  - test/template/output-az_test.rb