kumogata-template 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +13 -40
- data/README.md +34 -83
- data/bin/kumogata-template +2 -2
- data/kumogata-template.gemspec +4 -4
- data/lib/kumogata/template/autoscaling.rb +19 -0
- data/lib/kumogata/template/cloudwatch.rb +1 -9
- data/lib/kumogata/template/const.rb +22 -4
- data/lib/kumogata/template/ec2.rb +18 -8
- data/lib/kumogata/template/ecs.rb +34 -0
- data/lib/kumogata/template/elasticbeanstalk.rb +937 -3
- data/lib/kumogata/template/ext/kumogata.rb +64 -16
- data/lib/kumogata/template/helper.rb +146 -19
- data/lib/kumogata/template/iam.rb +2 -3
- data/lib/kumogata/template/lambda.rb +10 -1
- data/lib/kumogata/template/version.rb +1 -1
- data/template/_template.rb +20 -3
- data/template/alb-load-balancer.rb +8 -1
- data/template/autoscaling-launch-configuration.rb +2 -11
- data/template/autoscaling-scheduled-action.rb +2 -17
- data/template/ec2-instance.rb +5 -7
- data/template/ec2-network-acl-entry.rb +3 -1
- data/template/ec2-route.rb +3 -1
- data/template/ec2-security-group.rb +2 -0
- data/template/ec2-subnet.rb +2 -1
- data/template/ec2-vpc.rb +2 -1
- data/template/ecs-service.rb +4 -0
- data/template/ecs-task-definition.rb +6 -4
- data/template/elasticbeanstalk-application-version.rb +9 -4
- data/template/elasticbeanstalk-application.rb +4 -3
- data/template/elasticbeanstalk-configuration-template.rb +7 -2
- data/template/elasticbeanstalk-environment.rb +10 -10
- data/template/emr-cluster.rb +8 -3
- data/template/iam-instance-profile.rb +2 -0
- data/template/lambda-function.rb +8 -3
- data/template/mappings-ec2.rb +44 -44
- data/template/output-access-key.rb +7 -2
- data/template/output-alb.rb +16 -11
- data/template/output-arn.rb +6 -3
- data/template/output-autoscaling.rb +7 -2
- data/template/output-dynamodb.rb +7 -2
- data/template/output-ec2-subnet.rb +14 -0
- data/template/output-ec2.rb +13 -4
- data/template/output-elasticache.rb +23 -7
- data/template/output-elasticbeanstalk-environment.rb +8 -0
- data/template/output-elb.rb +13 -6
- data/template/output-emr.rb +8 -3
- data/template/output-iam-instance-profile.rb +7 -2
- data/template/output-iam-role.rb +7 -2
- data/template/output-name.rb +3 -1
- data/template/output-rds.rb +7 -3
- data/template/output-redshift.rb +7 -3
- data/template/output-s3.rb +11 -3
- data/template/output-security-group.rb +4 -1
- data/template/output-sqs.rb +4 -1
- data/template/output-topic.rb +8 -3
- data/template/output-vpc.rb +16 -4
- data/template/output.rb +3 -1
- data/template/rds-db-instance.rb +7 -0
- data/template/redshift-cluster.rb +2 -0
- data/template/sqs-queue.rb +14 -0
- data/test/abstract_unit.rb +31 -8
- data/test/elasticbeanstalk_test.rb +3 -3
- data/test/helper_test.rb +431 -0
- data/test/template/autoscaling-launch-configuration_test.rb +1 -4
- data/test/template/ec2-instance_test.rb +2 -2
- data/test/template/ec2-vpc_test.rb +2 -2
- data/test/template/ecs-task-definition_test.rb +13 -13
- data/test/template/elasticbeanstalk-application-version_test.rb +13 -3
- data/test/template/elasticbeanstalk-template_test.rb +1 -1
- data/test/template/iam-instance-profile_test.rb +20 -0
- data/test/template/lambda-function_test.rb +60 -4
- data/test/template/{output-az_test.rb → output-ec2-subet_test.rb} +7 -8
- data/test/template/output-elasticache_test.rb +18 -0
- data/test/template/output_test.rb +23 -0
- data/test/template/rds-db-instance_test.rb +1 -1
- metadata +22 -22
- data/lib/kumogata/template/ext/argument_parser.rb +0 -8
- data/template/output-az.rb +0 -6
data/test/helper_test.rb
CHANGED
@@ -2,6 +2,21 @@ require 'abstract_unit'
|
|
2
2
|
require 'kumogata/template/helper'
|
3
3
|
|
4
4
|
class HelperTest < Minitest::Test
|
5
|
+
def test_region
|
6
|
+
template = <<-EOS
|
7
|
+
Test _region()
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"Test": {
|
13
|
+
"Ref": "AWS::Region"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
EOS
|
17
|
+
assert_equal exp_template.chomp, act_template
|
18
|
+
end
|
19
|
+
|
5
20
|
def test_resource_name
|
6
21
|
assert_equal _resource_name("test"), "Test"
|
7
22
|
assert_equal _resource_name("test", "Resource"), "TestResource"
|
@@ -55,6 +70,17 @@ EOS
|
|
55
70
|
assert_nil _valid_numbers(nil, 0, 1)
|
56
71
|
end
|
57
72
|
|
73
|
+
def test_real_name
|
74
|
+
assert_equal _real_name("test test"), "test-test"
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_ref_key
|
78
|
+
assert_equal _ref_key?("test", { test: "test" }), true
|
79
|
+
assert_equal _ref_key?("test", { import_test: "test" }), true
|
80
|
+
assert_equal _ref_key?("test", { ref_test: "test" }), true
|
81
|
+
assert_equal _ref_key?("test1", { test2: "test" }), false
|
82
|
+
end
|
83
|
+
|
58
84
|
def test_ref_string
|
59
85
|
template = <<-EOS
|
60
86
|
Test _ref_string("test", {})
|
@@ -74,6 +100,58 @@ Test _ref_string("test", test: "test")
|
|
74
100
|
exp_template = <<-EOS
|
75
101
|
{
|
76
102
|
"Test": "test"
|
103
|
+
}
|
104
|
+
EOS
|
105
|
+
assert_equal exp_template.chomp, act_template
|
106
|
+
|
107
|
+
template = <<-EOS
|
108
|
+
Test _ref_string("test", import_test: "test")
|
109
|
+
EOS
|
110
|
+
act_template = run_client_as_json(template)
|
111
|
+
exp_template = <<-EOS
|
112
|
+
{
|
113
|
+
"Test": {
|
114
|
+
"Fn::ImportValue": {
|
115
|
+
"Fn::Sub": "test"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
EOS
|
120
|
+
assert_equal exp_template.chomp, act_template
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_ref_string_default
|
124
|
+
template = <<-EOS
|
125
|
+
Test _ref_string_default("test", { test: "test" }, '', "default")
|
126
|
+
EOS
|
127
|
+
act_template = run_client_as_json(template)
|
128
|
+
exp_template = <<-EOS
|
129
|
+
{
|
130
|
+
"Test": "test"
|
131
|
+
}
|
132
|
+
EOS
|
133
|
+
assert_equal exp_template.chomp, act_template
|
134
|
+
|
135
|
+
template = <<-EOS
|
136
|
+
Test _ref_string_default("test", { ref_test: "test" }, '', "default")
|
137
|
+
EOS
|
138
|
+
act_template = run_client_as_json(template)
|
139
|
+
exp_template = <<-EOS
|
140
|
+
{
|
141
|
+
"Test": {
|
142
|
+
"Ref": "Test"
|
143
|
+
}
|
144
|
+
}
|
145
|
+
EOS
|
146
|
+
assert_equal exp_template.chomp, act_template
|
147
|
+
|
148
|
+
template = <<-EOS
|
149
|
+
Test _ref_string_default("test", {}, '', "default")
|
150
|
+
EOS
|
151
|
+
act_template = run_client_as_json(template)
|
152
|
+
exp_template = <<-EOS
|
153
|
+
{
|
154
|
+
"Test": "default"
|
77
155
|
}
|
78
156
|
EOS
|
79
157
|
assert_equal exp_template.chomp, act_template
|
@@ -129,6 +207,28 @@ Tests _ref_array("tests", name: "tests", ref_tests: "test1")
|
|
129
207
|
"Ref": "Test1"
|
130
208
|
}
|
131
209
|
]
|
210
|
+
}
|
211
|
+
EOS
|
212
|
+
assert_equal exp_template.chomp, act_template
|
213
|
+
|
214
|
+
template = <<-EOS
|
215
|
+
Test _ref_array("tests", import_tests: [ "test1", "test2" ])
|
216
|
+
EOS
|
217
|
+
act_template = run_client_as_json(template)
|
218
|
+
exp_template = <<-EOS
|
219
|
+
{
|
220
|
+
"Test": [
|
221
|
+
{
|
222
|
+
"Fn::ImportValue": {
|
223
|
+
"Fn::Sub": "test1"
|
224
|
+
}
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"Fn::ImportValue": {
|
228
|
+
"Fn::Sub": "test2"
|
229
|
+
}
|
230
|
+
}
|
231
|
+
]
|
132
232
|
}
|
133
233
|
EOS
|
134
234
|
assert_equal exp_template.chomp, act_template
|
@@ -233,6 +333,21 @@ Test _ref_name("test", ref_raw_test: "test")
|
|
233
333
|
EOS
|
234
334
|
assert_equal exp_template.chomp, act_template
|
235
335
|
|
336
|
+
template = <<-EOS
|
337
|
+
Test _ref_name("test", import_test: "test")
|
338
|
+
EOS
|
339
|
+
act_template = run_client_as_json(template)
|
340
|
+
exp_template = <<-EOS
|
341
|
+
{
|
342
|
+
"Test": {
|
343
|
+
"Fn::ImportValue": {
|
344
|
+
"Fn::Sub": "test"
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
EOS
|
349
|
+
assert_equal exp_template.chomp, act_template
|
350
|
+
|
236
351
|
template = <<-EOS
|
237
352
|
Test _ref_name("test", {})
|
238
353
|
EOS
|
@@ -272,6 +387,21 @@ Test _ref_name_default("test", { name: "test1" })
|
|
272
387
|
# _ref_name_default(name, args, ref_name = '')
|
273
388
|
end
|
274
389
|
|
390
|
+
def test_azs
|
391
|
+
template = <<-EOS
|
392
|
+
Test _azs("test")
|
393
|
+
EOS
|
394
|
+
act_template = run_client_as_json(template)
|
395
|
+
exp_template = <<-EOS
|
396
|
+
{
|
397
|
+
"Test": {
|
398
|
+
"Fn::GetAZs": "test"
|
399
|
+
}
|
400
|
+
}
|
401
|
+
EOS
|
402
|
+
assert_equal exp_template.chomp, act_template
|
403
|
+
end
|
404
|
+
|
275
405
|
def test_attr_string
|
276
406
|
template = <<-EOS
|
277
407
|
Test _attr_string("test", "test1")
|
@@ -290,6 +420,183 @@ Test _attr_string("test", "test1")
|
|
290
420
|
assert_equal exp_template.chomp, act_template
|
291
421
|
end
|
292
422
|
|
423
|
+
def test_and
|
424
|
+
template = <<-EOS
|
425
|
+
Test _and([ "test" ])
|
426
|
+
EOS
|
427
|
+
act_template = run_client_as_json(template)
|
428
|
+
exp_template = <<-EOS
|
429
|
+
{
|
430
|
+
"Test": {
|
431
|
+
"Fn::And": [
|
432
|
+
"test"
|
433
|
+
]
|
434
|
+
}
|
435
|
+
}
|
436
|
+
EOS
|
437
|
+
assert_equal exp_template.chomp, act_template
|
438
|
+
|
439
|
+
template = <<-EOS
|
440
|
+
Test _and([ _equals("test1", "test2"), _condition("test3") ])
|
441
|
+
EOS
|
442
|
+
act_template = run_client_as_json(template)
|
443
|
+
exp_template = <<-EOS
|
444
|
+
{
|
445
|
+
"Test": {
|
446
|
+
"Fn::And": [
|
447
|
+
{
|
448
|
+
"Fn::Equals": [
|
449
|
+
"test1",
|
450
|
+
"test2"
|
451
|
+
]
|
452
|
+
},
|
453
|
+
{
|
454
|
+
"Condition": "test3"
|
455
|
+
}
|
456
|
+
]
|
457
|
+
}
|
458
|
+
}
|
459
|
+
EOS
|
460
|
+
assert_equal exp_template.chomp, act_template
|
461
|
+
end
|
462
|
+
|
463
|
+
def test_equals
|
464
|
+
template = <<-EOS
|
465
|
+
Test _equals("test1", "test2")
|
466
|
+
EOS
|
467
|
+
act_template = run_client_as_json(template)
|
468
|
+
exp_template = <<-EOS
|
469
|
+
{
|
470
|
+
"Test": {
|
471
|
+
"Fn::Equals": [
|
472
|
+
"test1",
|
473
|
+
"test2"
|
474
|
+
]
|
475
|
+
}
|
476
|
+
}
|
477
|
+
EOS
|
478
|
+
assert_equal exp_template.chomp, act_template
|
479
|
+
end
|
480
|
+
|
481
|
+
def test_if
|
482
|
+
template = <<-EOS
|
483
|
+
Test _if("test", "test1", "test2")
|
484
|
+
EOS
|
485
|
+
act_template = run_client_as_json(template)
|
486
|
+
exp_template = <<-EOS
|
487
|
+
{
|
488
|
+
"Test": {
|
489
|
+
"Fn::If": [
|
490
|
+
"test",
|
491
|
+
"test1",
|
492
|
+
"test2"
|
493
|
+
]
|
494
|
+
}
|
495
|
+
}
|
496
|
+
EOS
|
497
|
+
assert_equal exp_template.chomp, act_template
|
498
|
+
|
499
|
+
template = <<-EOS
|
500
|
+
Test _if("test", _ref("Test1"), _ref("Test2"))
|
501
|
+
EOS
|
502
|
+
act_template = run_client_as_json(template)
|
503
|
+
exp_template = <<-EOS
|
504
|
+
{
|
505
|
+
"Test": {
|
506
|
+
"Fn::If": [
|
507
|
+
"test",
|
508
|
+
{
|
509
|
+
"Ref": "Test1"
|
510
|
+
},
|
511
|
+
{
|
512
|
+
"Ref": "Test2"
|
513
|
+
}
|
514
|
+
]
|
515
|
+
}
|
516
|
+
}
|
517
|
+
EOS
|
518
|
+
assert_equal exp_template.chomp, act_template
|
519
|
+
end
|
520
|
+
|
521
|
+
def test_not
|
522
|
+
template = <<-EOS
|
523
|
+
Test _not([ "test" ])
|
524
|
+
EOS
|
525
|
+
act_template = run_client_as_json(template)
|
526
|
+
exp_template = <<-EOS
|
527
|
+
{
|
528
|
+
"Test": {
|
529
|
+
"Fn::Not": [
|
530
|
+
"test"
|
531
|
+
]
|
532
|
+
}
|
533
|
+
}
|
534
|
+
EOS
|
535
|
+
assert_equal exp_template.chomp, act_template
|
536
|
+
end
|
537
|
+
|
538
|
+
def test_or
|
539
|
+
template = <<-EOS
|
540
|
+
Test _or([ "test" ])
|
541
|
+
EOS
|
542
|
+
act_template = run_client_as_json(template)
|
543
|
+
exp_template = <<-EOS
|
544
|
+
{
|
545
|
+
"Test": {
|
546
|
+
"Fn::Or": [
|
547
|
+
"test"
|
548
|
+
]
|
549
|
+
}
|
550
|
+
}
|
551
|
+
EOS
|
552
|
+
assert_equal exp_template.chomp, act_template
|
553
|
+
end
|
554
|
+
|
555
|
+
def test_condition
|
556
|
+
template = <<-EOS
|
557
|
+
Test _condition("test")
|
558
|
+
EOS
|
559
|
+
act_template = run_client_as_json(template)
|
560
|
+
exp_template = <<-EOS
|
561
|
+
{
|
562
|
+
"Test": {
|
563
|
+
"Condition": "test"
|
564
|
+
}
|
565
|
+
}
|
566
|
+
EOS
|
567
|
+
assert_equal exp_template.chomp, act_template
|
568
|
+
end
|
569
|
+
|
570
|
+
def test_base64
|
571
|
+
template = <<-EOS
|
572
|
+
Test _base64("test")
|
573
|
+
EOS
|
574
|
+
act_template = run_client_as_json(template)
|
575
|
+
exp_template = <<-EOS
|
576
|
+
{
|
577
|
+
"Test": {
|
578
|
+
"Fn::Base64": "test"
|
579
|
+
}
|
580
|
+
}
|
581
|
+
EOS
|
582
|
+
assert_equal exp_template.chomp, act_template
|
583
|
+
end
|
584
|
+
|
585
|
+
def test_base64_shell
|
586
|
+
template = <<-EOS
|
587
|
+
Test _base64_shell("test shell")
|
588
|
+
EOS
|
589
|
+
act_template = run_client_as_json(template)
|
590
|
+
exp_template = <<-EOS
|
591
|
+
{
|
592
|
+
"Test": {
|
593
|
+
"Fn::Base64": "#!/bin/bash\\ntest shell"
|
594
|
+
}
|
595
|
+
}
|
596
|
+
EOS
|
597
|
+
assert_equal exp_template.chomp, act_template
|
598
|
+
end
|
599
|
+
|
293
600
|
def test_find_in_map
|
294
601
|
template = <<-EOS
|
295
602
|
Test _find_in_map("Test", "test1", "test2")
|
@@ -330,6 +637,124 @@ Test _select(1, %w( test1 test2 ))
|
|
330
637
|
assert_equal exp_template.chomp, act_template
|
331
638
|
end
|
332
639
|
|
640
|
+
def test_split
|
641
|
+
template = <<-EOS
|
642
|
+
Test _split("test")
|
643
|
+
EOS
|
644
|
+
act_template = run_client_as_json(template)
|
645
|
+
exp_template = <<-EOS
|
646
|
+
{
|
647
|
+
"Test": {
|
648
|
+
"Fn::Split": [
|
649
|
+
",",
|
650
|
+
"test"
|
651
|
+
]
|
652
|
+
}
|
653
|
+
}
|
654
|
+
EOS
|
655
|
+
assert_equal exp_template.chomp, act_template
|
656
|
+
end
|
657
|
+
|
658
|
+
def test_sub
|
659
|
+
template = <<-EOS
|
660
|
+
Test _sub("test")
|
661
|
+
EOS
|
662
|
+
act_template = run_client_as_json(template)
|
663
|
+
exp_template = <<-EOS
|
664
|
+
{
|
665
|
+
"Test": {
|
666
|
+
"Fn::Sub": "test"
|
667
|
+
}
|
668
|
+
}
|
669
|
+
EOS
|
670
|
+
assert_equal exp_template.chomp, act_template
|
671
|
+
end
|
672
|
+
|
673
|
+
def test_ref
|
674
|
+
template = <<-EOS
|
675
|
+
Test _ref("test")
|
676
|
+
EOS
|
677
|
+
act_template = run_client_as_json(template)
|
678
|
+
exp_template = <<-EOS
|
679
|
+
{
|
680
|
+
"Test": {
|
681
|
+
"Ref": "test"
|
682
|
+
}
|
683
|
+
}
|
684
|
+
EOS
|
685
|
+
assert_equal exp_template.chomp, act_template
|
686
|
+
end
|
687
|
+
|
688
|
+
def test_export_string
|
689
|
+
assert_equal _export_string({ name: "test" }, "test"), ""
|
690
|
+
assert_equal _export_string({ name: "test", export: true }, "test"), "test-test"
|
691
|
+
end
|
692
|
+
|
693
|
+
def test_export
|
694
|
+
template = <<-EOS
|
695
|
+
Test _export( { name: "test", export: "export" })
|
696
|
+
EOS
|
697
|
+
act_template = run_client_as_json(template)
|
698
|
+
exp_template = <<-EOS
|
699
|
+
{
|
700
|
+
"Test": {
|
701
|
+
"Name": {
|
702
|
+
"Fn::Sub": "${AWS::StackName}-export"
|
703
|
+
}
|
704
|
+
}
|
705
|
+
}
|
706
|
+
EOS
|
707
|
+
assert_equal exp_template.chomp, act_template
|
708
|
+
|
709
|
+
template = <<-EOS
|
710
|
+
Test _export({})
|
711
|
+
EOS
|
712
|
+
act_template = run_client_as_json(template)
|
713
|
+
exp_template = <<-EOS
|
714
|
+
{
|
715
|
+
"Test": ""
|
716
|
+
}
|
717
|
+
EOS
|
718
|
+
assert_equal exp_template.chomp, act_template
|
719
|
+
end
|
720
|
+
|
721
|
+
def test_join
|
722
|
+
template = <<-EOS
|
723
|
+
Test _join({ test: "test" })
|
724
|
+
EOS
|
725
|
+
act_template = run_client_as_json(template)
|
726
|
+
exp_template = <<-EOS
|
727
|
+
{
|
728
|
+
"Test": {
|
729
|
+
"Fn::Join": [
|
730
|
+
",",
|
731
|
+
{
|
732
|
+
"test": "test"
|
733
|
+
}
|
734
|
+
]
|
735
|
+
}
|
736
|
+
}
|
737
|
+
EOS
|
738
|
+
assert_equal exp_template.chomp, act_template
|
739
|
+
end
|
740
|
+
|
741
|
+
def test_import
|
742
|
+
template = <<-EOS
|
743
|
+
Test _import("test")
|
744
|
+
EOS
|
745
|
+
act_template = run_client_as_json(template)
|
746
|
+
exp_template = <<-EOS
|
747
|
+
{
|
748
|
+
"Test": {
|
749
|
+
"Fn::ImportValue": {
|
750
|
+
"Fn::Sub": "test"
|
751
|
+
}
|
752
|
+
}
|
753
|
+
}
|
754
|
+
EOS
|
755
|
+
assert_equal exp_template.chomp, act_template
|
756
|
+
end
|
757
|
+
|
333
758
|
def test_tag
|
334
759
|
template = <<-EOS
|
335
760
|
Test _tag(key: "test", value: "test")
|
@@ -709,6 +1134,12 @@ Test _availability_zones({})
|
|
709
1134
|
assert_equal _timestamp_utc_from_string("2016-04-01 00:00"), "2016-03-31T15:00:00Z"
|
710
1135
|
end
|
711
1136
|
|
1137
|
+
def test_timestamp_utc_duration
|
1138
|
+
assert_equal _timestamp_utc_duration(1), "PT1M"
|
1139
|
+
assert_equal _timestamp_utc_duration(1, 2), "PT2H1M"
|
1140
|
+
assert_equal _timestamp_utc_duration(1, 2, 3), "PT2H1M3S"
|
1141
|
+
end
|
1142
|
+
|
712
1143
|
def test_maintenance_window
|
713
1144
|
start_time = Time.local(2016, 4, 1, 3, 30)
|
714
1145
|
end_time = start_time + (60 * 60)
|
@@ -33,10 +33,7 @@ _autoscaling_launch_configuration "test", image: "test", ref_instance_type: "tes
|
|
33
33
|
"InstanceType": {
|
34
34
|
"Ref": "TestInstanceType"
|
35
35
|
},
|
36
|
-
"KeyName": "test"
|
37
|
-
"UserData": {
|
38
|
-
"Fn::Base64": "#!/bin/bash\\n\\n"
|
39
|
-
}
|
36
|
+
"KeyName": "test"
|
40
37
|
}
|
41
38
|
}
|
42
39
|
}
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class Ec2InstanceTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_ec2_instance "test", key_name: "test", ref_instance_type: "test", ref_iam_instance: "test"
|
6
|
+
_ec2_instance "test", key_name: "test", ref_instance_type: "test", ref_iam_instance: "test", user_data: "test data"
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -84,7 +84,7 @@ _ec2_instance "test", key_name: "test", ref_instance_type: "test", ref_iam_insta
|
|
84
84
|
],
|
85
85
|
"Tenancy": "default",
|
86
86
|
"UserData": {
|
87
|
-
"Fn::Base64": "#!/bin/bash\\
|
87
|
+
"Fn::Base64": "#!/bin/bash\\ntest data"
|
88
88
|
}
|
89
89
|
}
|
90
90
|
}
|
@@ -11,7 +11,7 @@ _ec2_vpc "test"
|
|
11
11
|
"TestVpc": {
|
12
12
|
"Type": "AWS::EC2::VPC",
|
13
13
|
"Properties": {
|
14
|
-
"CidrBlock": "
|
14
|
+
"CidrBlock": "10.1.1.0/28",
|
15
15
|
"EnableDnsSupport": "true",
|
16
16
|
"EnableDnsHostnames": "true",
|
17
17
|
"InstanceTenancy": "default",
|
@@ -60,7 +60,7 @@ _ec2_vpc "test"
|
|
60
60
|
"TestVpc": {
|
61
61
|
"Type": "AWS::EC2::VPC",
|
62
62
|
"Properties": {
|
63
|
-
"CidrBlock": "
|
63
|
+
"CidrBlock": "10.1.1.0/28",
|
64
64
|
"EnableDnsSupport": "true",
|
65
65
|
"EnableDnsHostnames": "true",
|
66
66
|
"InstanceTenancy": "default",
|
@@ -11,6 +11,11 @@ _ecs_task_definition "test", container_definitions: [ { name: "test", image: "te
|
|
11
11
|
"TestEcsTaskDefinition": {
|
12
12
|
"Type": "AWS::ECS::TaskDefinition",
|
13
13
|
"Properties": {
|
14
|
+
"Volumes": [
|
15
|
+
{
|
16
|
+
"Name": "test"
|
17
|
+
}
|
18
|
+
],
|
14
19
|
"ContainerDefinitions": [
|
15
20
|
{
|
16
21
|
"Cpu": "10",
|
@@ -24,11 +29,6 @@ _ecs_task_definition "test", container_definitions: [ { name: "test", image: "te
|
|
24
29
|
}
|
25
30
|
]
|
26
31
|
}
|
27
|
-
],
|
28
|
-
"Volumes": [
|
29
|
-
{
|
30
|
-
"Name": "test"
|
31
|
-
}
|
32
32
|
]
|
33
33
|
}
|
34
34
|
}
|
@@ -71,6 +71,14 @@ _ecs_task_definition "test", container_definitions: [ container1, container2 ],
|
|
71
71
|
"TestEcsTaskDefinition": {
|
72
72
|
"Type": "AWS::ECS::TaskDefinition",
|
73
73
|
"Properties": {
|
74
|
+
"Volumes": [
|
75
|
+
{
|
76
|
+
"Name": "my-vol",
|
77
|
+
"Host": {
|
78
|
+
"SourcePath": "/var/lib/docker/vfs/dir/"
|
79
|
+
}
|
80
|
+
}
|
81
|
+
],
|
74
82
|
"ContainerDefinitions": [
|
75
83
|
{
|
76
84
|
"Cpu": "10",
|
@@ -125,14 +133,6 @@ _ecs_task_definition "test", container_definitions: [ container1, container2 ],
|
|
125
133
|
}
|
126
134
|
]
|
127
135
|
}
|
128
|
-
],
|
129
|
-
"Volumes": [
|
130
|
-
{
|
131
|
-
"Name": "my-vol",
|
132
|
-
"Host": {
|
133
|
-
"SourcePath": "/var/lib/docker/vfs/dir/"
|
134
|
-
}
|
135
|
-
}
|
136
136
|
]
|
137
137
|
}
|
138
138
|
}
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class ElasticbeanstalkApplicationVersionTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_elasticbeanstalk_application_version "test", application: "test", ref_s3_bucket: "test", s3_key: "test"
|
6
|
+
_elasticbeanstalk_application_version "test", application: "test", ref_s3_bucket: "test", s3_key: "test.war"
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -14,9 +14,19 @@ _elasticbeanstalk_application_version "test", application: "test", ref_s3_bucket
|
|
14
14
|
"ApplicationName": "test",
|
15
15
|
"SourceBundle": {
|
16
16
|
"S3Bucket": {
|
17
|
-
"
|
17
|
+
"Fn::Join": [
|
18
|
+
"-",
|
19
|
+
[
|
20
|
+
{
|
21
|
+
"Ref": "TestBucket"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"Ref": "AWS::Region"
|
25
|
+
}
|
26
|
+
]
|
27
|
+
]
|
18
28
|
},
|
19
|
-
"S3Key": "test"
|
29
|
+
"S3Key": "test.war"
|
20
30
|
}
|
21
31
|
}
|
22
32
|
}
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class ElasticbeanstalkTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_elasticbeanstalk_configuration_template "test", application: "test", solution: "test",
|
6
|
+
_elasticbeanstalk_configuration_template "test", application: "test", solution: "test", options: [ { name: "test", option: "test", value: "test" } ], configuration: { application: "test", template: "test" }
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -17,6 +17,26 @@ _iam_instance_profile "test", user: "test", roles: [ "test" ]
|
|
17
17
|
]
|
18
18
|
}
|
19
19
|
}
|
20
|
+
}
|
21
|
+
EOS
|
22
|
+
assert_equal exp_template.chomp, act_template
|
23
|
+
|
24
|
+
template = <<-EOS
|
25
|
+
_iam_instance_profile "test", user: "test", roles: [ "test" ], profile_name: "test"
|
26
|
+
EOS
|
27
|
+
act_template = run_client_as_json(template)
|
28
|
+
exp_template = <<-EOS
|
29
|
+
{
|
30
|
+
"TestInstanceProfile": {
|
31
|
+
"Type": "AWS::IAM::InstanceProfile",
|
32
|
+
"Properties": {
|
33
|
+
"Path": "/",
|
34
|
+
"Roles": [
|
35
|
+
"test"
|
36
|
+
],
|
37
|
+
"InstanceProfileName": "test"
|
38
|
+
}
|
39
|
+
}
|
20
40
|
}
|
21
41
|
EOS
|
22
42
|
assert_equal exp_template.chomp, act_template
|