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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile.lock +13 -40
  4. data/README.md +34 -83
  5. data/bin/kumogata-template +2 -2
  6. data/kumogata-template.gemspec +4 -4
  7. data/lib/kumogata/template/autoscaling.rb +19 -0
  8. data/lib/kumogata/template/cloudwatch.rb +1 -9
  9. data/lib/kumogata/template/const.rb +22 -4
  10. data/lib/kumogata/template/ec2.rb +18 -8
  11. data/lib/kumogata/template/ecs.rb +34 -0
  12. data/lib/kumogata/template/elasticbeanstalk.rb +937 -3
  13. data/lib/kumogata/template/ext/kumogata.rb +64 -16
  14. data/lib/kumogata/template/helper.rb +146 -19
  15. data/lib/kumogata/template/iam.rb +2 -3
  16. data/lib/kumogata/template/lambda.rb +10 -1
  17. data/lib/kumogata/template/version.rb +1 -1
  18. data/template/_template.rb +20 -3
  19. data/template/alb-load-balancer.rb +8 -1
  20. data/template/autoscaling-launch-configuration.rb +2 -11
  21. data/template/autoscaling-scheduled-action.rb +2 -17
  22. data/template/ec2-instance.rb +5 -7
  23. data/template/ec2-network-acl-entry.rb +3 -1
  24. data/template/ec2-route.rb +3 -1
  25. data/template/ec2-security-group.rb +2 -0
  26. data/template/ec2-subnet.rb +2 -1
  27. data/template/ec2-vpc.rb +2 -1
  28. data/template/ecs-service.rb +4 -0
  29. data/template/ecs-task-definition.rb +6 -4
  30. data/template/elasticbeanstalk-application-version.rb +9 -4
  31. data/template/elasticbeanstalk-application.rb +4 -3
  32. data/template/elasticbeanstalk-configuration-template.rb +7 -2
  33. data/template/elasticbeanstalk-environment.rb +10 -10
  34. data/template/emr-cluster.rb +8 -3
  35. data/template/iam-instance-profile.rb +2 -0
  36. data/template/lambda-function.rb +8 -3
  37. data/template/mappings-ec2.rb +44 -44
  38. data/template/output-access-key.rb +7 -2
  39. data/template/output-alb.rb +16 -11
  40. data/template/output-arn.rb +6 -3
  41. data/template/output-autoscaling.rb +7 -2
  42. data/template/output-dynamodb.rb +7 -2
  43. data/template/output-ec2-subnet.rb +14 -0
  44. data/template/output-ec2.rb +13 -4
  45. data/template/output-elasticache.rb +23 -7
  46. data/template/output-elasticbeanstalk-environment.rb +8 -0
  47. data/template/output-elb.rb +13 -6
  48. data/template/output-emr.rb +8 -3
  49. data/template/output-iam-instance-profile.rb +7 -2
  50. data/template/output-iam-role.rb +7 -2
  51. data/template/output-name.rb +3 -1
  52. data/template/output-rds.rb +7 -3
  53. data/template/output-redshift.rb +7 -3
  54. data/template/output-s3.rb +11 -3
  55. data/template/output-security-group.rb +4 -1
  56. data/template/output-sqs.rb +4 -1
  57. data/template/output-topic.rb +8 -3
  58. data/template/output-vpc.rb +16 -4
  59. data/template/output.rb +3 -1
  60. data/template/rds-db-instance.rb +7 -0
  61. data/template/redshift-cluster.rb +2 -0
  62. data/template/sqs-queue.rb +14 -0
  63. data/test/abstract_unit.rb +31 -8
  64. data/test/elasticbeanstalk_test.rb +3 -3
  65. data/test/helper_test.rb +431 -0
  66. data/test/template/autoscaling-launch-configuration_test.rb +1 -4
  67. data/test/template/ec2-instance_test.rb +2 -2
  68. data/test/template/ec2-vpc_test.rb +2 -2
  69. data/test/template/ecs-task-definition_test.rb +13 -13
  70. data/test/template/elasticbeanstalk-application-version_test.rb +13 -3
  71. data/test/template/elasticbeanstalk-template_test.rb +1 -1
  72. data/test/template/iam-instance-profile_test.rb +20 -0
  73. data/test/template/lambda-function_test.rb +60 -4
  74. data/test/template/{output-az_test.rb → output-ec2-subet_test.rb} +7 -8
  75. data/test/template/output-elasticache_test.rb +18 -0
  76. data/test/template/output_test.rb +23 -0
  77. data/test/template/rds-db-instance_test.rb +1 -1
  78. metadata +22 -22
  79. data/lib/kumogata/template/ext/argument_parser.rb +0 -8
  80. data/template/output-az.rb +0 -6
@@ -3,7 +3,7 @@ require 'abstract_unit'
3
3
  class LambdaFunctionTest < Minitest::Test
4
4
  def test_normal
5
5
  template = <<-EOS
6
- _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_name: "test", ref_role: "test", runtime: "nodejs4.3"
6
+ _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_name: "test", ref_role: "test"
7
7
  EOS
8
8
  act_template = run_client_as_json(template)
9
9
  exp_template = <<-EOS
@@ -24,8 +24,36 @@ _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_n
24
24
  "Arn"
25
25
  ]
26
26
  },
27
- "Runtime": "nodejs4.3",
28
- "Timeout": "3"
27
+ "Runtime": "nodejs",
28
+ "Timeout": "3",
29
+ "Tags": [
30
+ {
31
+ "Key": "Name",
32
+ "Value": {
33
+ "Fn::Join": [
34
+ "-",
35
+ [
36
+ {
37
+ "Ref": "Service"
38
+ },
39
+ "test"
40
+ ]
41
+ ]
42
+ }
43
+ },
44
+ {
45
+ "Key": "Service",
46
+ "Value": {
47
+ "Ref": "Service"
48
+ }
49
+ },
50
+ {
51
+ "Key": "Version",
52
+ "Value": {
53
+ "Ref": "Version"
54
+ }
55
+ }
56
+ ]
29
57
  }
30
58
  }
31
59
  }
@@ -64,7 +92,35 @@ _lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, fun
64
92
  ]
65
93
  },
66
94
  "Runtime": "python2.7",
67
- "Timeout": "3"
95
+ "Timeout": "3",
96
+ "Tags": [
97
+ {
98
+ "Key": "Name",
99
+ "Value": {
100
+ "Fn::Join": [
101
+ "-",
102
+ [
103
+ {
104
+ "Ref": "Service"
105
+ },
106
+ "test"
107
+ ]
108
+ ]
109
+ }
110
+ },
111
+ {
112
+ "Key": "Service",
113
+ "Value": {
114
+ "Ref": "Service"
115
+ }
116
+ },
117
+ {
118
+ "Key": "Version",
119
+ "Value": {
120
+ "Ref": "Version"
121
+ }
122
+ }
123
+ ]
68
124
  }
69
125
  }
70
126
  }
@@ -1,25 +1,24 @@
1
1
  require 'abstract_unit'
2
2
 
3
3
  class OutputAzTest < Minitest::Test
4
- # FIXME?
5
4
  def test_normal
6
5
  template = <<-EOS
7
- _output_az "test"
6
+ _output_ec2_subnet "test"
8
7
  EOS
9
8
  act_template = run_client_as_json(template)
10
9
  exp_template = <<-EOS
11
10
  {
12
- "TestName": {
13
- "Description": "description of TestName",
11
+ "TestSubnet": {
12
+ "Description": "description of TestSubnet",
14
13
  "Value": {
15
- "Ref": "Test"
14
+ "Ref": "TestSubnet"
16
15
  }
17
16
  },
18
- "TestCidr": {
19
- "Description": "description of TestCidr",
17
+ "TestSubnetAz": {
18
+ "Description": "description of TestSubnetAz",
20
19
  "Value": {
21
20
  "Fn::GetAtt": [
22
- "Test",
21
+ "TestSubnet",
23
22
  "AvailabilityZone"
24
23
  ]
25
24
  }
@@ -30,6 +30,24 @@ _output_elasticache "test", replication: true, engine: "redis"
30
30
  "Ref": "TestCacheReplicationGroup"
31
31
  }
32
32
  },
33
+ "TestCacheReplicationGroupConfigurationAddress": {
34
+ "Description": "description of TestCacheReplicationGroupConfigurationAddress",
35
+ "Value": {
36
+ "Fn::GetAtt": [
37
+ "TestCacheReplicationGroup",
38
+ "ConfigurationEndPoint.Address"
39
+ ]
40
+ }
41
+ },
42
+ "TestCacheReplicationGroupConfigurationPort": {
43
+ "Description": "description of TestCacheReplicationGroupConfigurationPort",
44
+ "Value": {
45
+ "Fn::GetAtt": [
46
+ "TestCacheReplicationGroup",
47
+ "ConfigurationEndPoint.Port"
48
+ ]
49
+ }
50
+ },
33
51
  "TestCacheReplicationGroupPrimaryAddress": {
34
52
  "Description": "description of TestCacheReplicationGroupPrimaryAddress",
35
53
  "Value": {
@@ -48,7 +48,9 @@ _output "test", { value: [ "test1", "test2" ] }
48
48
  }
49
49
  EOS
50
50
  assert_equal exp_template.chomp, act_template
51
+ end
51
52
 
53
+ def test_ref
52
54
  template = <<-EOS
53
55
  _output "test", { ref_value: [ "test1", "test2" ] }
54
56
  EOS
@@ -80,6 +82,27 @@ _output "test", { ref_value: "test1" }
80
82
  "Ref": "Test1"
81
83
  }
82
84
  }
85
+ }
86
+ EOS
87
+ assert_equal exp_template.chomp, act_template
88
+ end
89
+
90
+ def test_export
91
+ template = <<-EOS
92
+ _output "test", { value: "test", export: "test-export" }
93
+ EOS
94
+ act_template = run_client_as_json(template)
95
+ exp_template = <<-EOS
96
+ {
97
+ "Test": {
98
+ "Description": "description of Test",
99
+ "Value": "test",
100
+ "Export": {
101
+ "Name": {
102
+ "Fn::Sub": "${AWS::StackName}-test-export"
103
+ }
104
+ }
105
+ }
83
106
  }
84
107
  EOS
85
108
  assert_equal exp_template.chomp, act_template
@@ -38,7 +38,7 @@ _rds_db_instance "test", ref_db_name: "test", ref_port: "test", ref_subnet_group
38
38
  "Ref": "TestDbSubnetGroup"
39
39
  },
40
40
  "Engine": "mysql",
41
- "EngineVersion": "5.7.10",
41
+ "EngineVersion": "5.7.17",
42
42
  "MasterUsername": {
43
43
  "Ref": "TestDbMasterUserName"
44
44
  },
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.29
4
+ version: 0.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoya Nakazawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: kumogata
28
+ name: kumogata2-plugin-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.12
33
+ version: 0.1.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.12
40
+ version: 0.1.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.11'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.11'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '11.1'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '11.1'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '5.8'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '5.8'
82
+ version: '0'
83
83
  description: Template for Kumogata. Kumogata is a tool for AWS CloudFormation. It
84
84
  can define a template in Ruby DSL.
85
85
  email:
@@ -118,7 +118,6 @@ files:
118
118
  - lib/kumogata/template/elb.rb
119
119
  - lib/kumogata/template/emr.rb
120
120
  - lib/kumogata/template/events.rb
121
- - lib/kumogata/template/ext/argument_parser.rb
122
121
  - lib/kumogata/template/ext/kumogata.rb
123
122
  - lib/kumogata/template/ext/option_parser.rb
124
123
  - lib/kumogata/template/helper.rb
@@ -213,10 +212,11 @@ files:
213
212
  - template/output-alb.rb
214
213
  - template/output-arn.rb
215
214
  - template/output-autoscaling.rb
216
- - template/output-az.rb
217
215
  - template/output-dynamodb.rb
216
+ - template/output-ec2-subnet.rb
218
217
  - template/output-ec2.rb
219
218
  - template/output-elasticache.rb
219
+ - template/output-elasticbeanstalk-environment.rb
220
220
  - template/output-elb.rb
221
221
  - template/output-emr.rb
222
222
  - template/output-iam-instance-profile.rb
@@ -358,8 +358,8 @@ files:
358
358
  - test/template/output-alb_test.rb
359
359
  - test/template/output-arn_test.rb
360
360
  - test/template/output-autoscaling_test.rb
361
- - test/template/output-az_test.rb
362
361
  - test/template/output-dynamodb_test.rb
362
+ - test/template/output-ec2-subet_test.rb
363
363
  - test/template/output-ec2_test.rb
364
364
  - test/template/output-elasticache_test.rb
365
365
  - test/template/output-elb_test.rb
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
415
415
  version: '0'
416
416
  requirements: []
417
417
  rubyforge_project:
418
- rubygems_version: 2.5.2
418
+ rubygems_version: 2.6.11
419
419
  signing_key:
420
420
  specification_version: 4
421
421
  summary: Template for Kumogata.
@@ -528,8 +528,8 @@ test_files:
528
528
  - test/template/output-alb_test.rb
529
529
  - test/template/output-arn_test.rb
530
530
  - test/template/output-autoscaling_test.rb
531
- - test/template/output-az_test.rb
532
531
  - test/template/output-dynamodb_test.rb
532
+ - test/template/output-ec2-subet_test.rb
533
533
  - test/template/output-ec2_test.rb
534
534
  - test/template/output-elasticache_test.rb
535
535
  - test/template/output-elb_test.rb
@@ -1,8 +0,0 @@
1
- class Kumogata::ArgumentParser
2
- Kumogata::ArgumentParser::COMMANDS.merge!(
3
- init: {
4
- :description => 'Generate basic template',
5
- :arguments => [:stack_name],
6
- }
7
- )
8
- end
@@ -1,6 +0,0 @@
1
- #
2
- # Output AZ
3
- #
4
-
5
- _output "#{args[:name]} name", ref_value: args[:name]
6
- _output "#{args[:name]} cidr", ref_value: [ args[:name], "AvailabilityZone" ]