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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e12e89a89f82fa03c5fd7d65813a60a86c387a9
|
4
|
+
data.tar.gz: 6fb3b59eab473bd93551eaf0289cc3d79bef748b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 344f8ec28fa37924fefc87483d9de29dad189195aa8a5a470994487833a44486da9e1a676c73f029962396ac7ac202d5e24a743b711cc914fd2759c8c1653ca8
|
7
|
+
data.tar.gz: c2005b2a03797e94e535d7bcfd624067b1fc31773037926d878d95ced42f443caab739e9d5138346059c398cb6aeba432f4ee31cdfdd3a21a45b2f7e2d3a03cb
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kumogata-template (0.0.
|
4
|
+
kumogata-template (0.0.29)
|
5
5
|
aws-sdk (~> 2.3)
|
6
|
-
|
6
|
+
kumogata2-plugin-ruby (= 0.1.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -15,64 +15,37 @@ GEM
|
|
15
15
|
jmespath (~> 1.0)
|
16
16
|
aws-sdk-resources (2.9.25)
|
17
17
|
aws-sdk-core (= 2.9.25)
|
18
|
-
aws-sdk-v1 (1.67.0)
|
19
|
-
json (~> 1.4)
|
20
|
-
nokogiri (~> 1)
|
21
18
|
aws-sigv4 (1.0.0)
|
22
19
|
coderay (1.1.1)
|
23
|
-
coffee-script (2.4.1)
|
24
|
-
coffee-script-source
|
25
|
-
execjs
|
26
|
-
coffee-script-source (1.12.2)
|
27
20
|
diffy (3.2.0)
|
28
|
-
dslh (0.
|
29
|
-
execjs (2.7.0)
|
21
|
+
dslh (0.4.8)
|
30
22
|
hashie (3.5.5)
|
31
23
|
highline (1.7.8)
|
32
24
|
jmespath (1.3.1)
|
33
|
-
|
34
|
-
|
35
|
-
kumogata (0.5.12)
|
36
|
-
aws-sdk-v1
|
25
|
+
kumogata2 (0.1.9)
|
26
|
+
aws-sdk (>= 2.3.0)
|
37
27
|
coderay
|
38
|
-
coffee-script
|
39
28
|
diffy
|
40
|
-
dslh (>= 0.2.7, < 0.3)
|
41
29
|
hashie
|
42
30
|
highline
|
43
|
-
json (= 1.8.3)
|
44
|
-
json5
|
45
|
-
net-ssh
|
46
|
-
nokogiri (= 1.6.7.2)
|
47
|
-
retryable (~> 2.0.0)
|
48
31
|
term-ansicolor
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
mini_portile2 (2.0.0)
|
32
|
+
kumogata2-plugin-ruby (0.1.3)
|
33
|
+
dslh (>= 0.3.7)
|
34
|
+
kumogata2
|
53
35
|
minitest (5.10.2)
|
54
|
-
|
55
|
-
nokogiri (1.6.7.2)
|
56
|
-
mini_portile2 (~> 2.0.0.rc2)
|
57
|
-
rake (11.3.0)
|
58
|
-
ref (2.0.0)
|
59
|
-
retryable (2.0.4)
|
36
|
+
rake (12.0.0)
|
60
37
|
term-ansicolor (1.6.0)
|
61
38
|
tins (~> 1.0)
|
62
|
-
therubyracer (0.12.2)
|
63
|
-
libv8 (~> 3.16.14.0)
|
64
|
-
ref
|
65
39
|
tins (1.14.0)
|
66
|
-
uuidtools (2.1.5)
|
67
40
|
|
68
41
|
PLATFORMS
|
69
42
|
ruby
|
70
43
|
|
71
44
|
DEPENDENCIES
|
72
|
-
bundler
|
45
|
+
bundler
|
73
46
|
kumogata-template!
|
74
|
-
minitest
|
75
|
-
rake
|
47
|
+
minitest
|
48
|
+
rake
|
76
49
|
|
77
50
|
BUNDLED WITH
|
78
|
-
1.15.
|
51
|
+
1.15.1
|
data/README.md
CHANGED
@@ -5,13 +5,10 @@
|
|
5
5
|
|
6
6
|
## About
|
7
7
|
|
8
|
-
- `kumogate-template` is a template sets for [
|
8
|
+
- `kumogate-template` is a template sets for [kumogata2](https://github.com/winebarrel/kumogata2).
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
Add
|
13
|
-
|
14
|
-
|
15
12
|
Add this line to your application's Gemfile:
|
16
13
|
|
17
14
|
```ruby
|
@@ -124,82 +121,36 @@ EOS
|
|
124
121
|
- more example see [test code](test/template)
|
125
122
|
|
126
123
|
|
127
|
-
##
|
128
|
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
|
132
|
-
-
|
133
|
-
- AWS::AutoScaling
|
134
|
-
- AWS::
|
135
|
-
- AWS::
|
136
|
-
- AWS::
|
137
|
-
- AWS::
|
138
|
-
- AWS::
|
139
|
-
- AWS::
|
140
|
-
- AWS::
|
141
|
-
- AWS::
|
142
|
-
- AWS::
|
143
|
-
- AWS::EC2
|
144
|
-
- AWS::
|
145
|
-
- AWS::
|
146
|
-
- AWS::
|
147
|
-
- AWS::
|
148
|
-
- AWS::
|
149
|
-
- AWS::
|
150
|
-
- AWS::
|
151
|
-
-
|
152
|
-
- AWS::
|
153
|
-
- AWS::
|
154
|
-
- AWS::
|
155
|
-
- AWS::
|
156
|
-
- AWS::
|
157
|
-
- AWS::
|
158
|
-
- AWS::
|
159
|
-
- AWS::
|
160
|
-
- AWS::ElastiCache::CacheCluster
|
161
|
-
- AWS::ElastiCache::ParameterGroup
|
162
|
-
- AWS::ElastiCache::ReplicationGroup
|
163
|
-
- AWS::ElastiCache::SubnetGroup
|
164
|
-
- AWS::ElasticBeanstalk::ApplicationVersion
|
165
|
-
- AWS::ElasticBeanstalk::Application
|
166
|
-
- AWS::ElasticBeanstalk::ConfigurationTemplate
|
167
|
-
- AWS::ElasticBeanstalk::Environment
|
168
|
-
- AWS::ElasticLoadBalancing::LoadBalancer
|
169
|
-
- AWS::EMR::Cluster
|
170
|
-
- AWS::EMR::InstanceGroupConfig
|
171
|
-
- AWS::EMR::Step
|
172
|
-
- AWS::Events::Rule
|
173
|
-
- AWS::IAM::AccessKey
|
174
|
-
- AWS::IAM::Group
|
175
|
-
- AWS::IAM::InstanceProfile
|
176
|
-
- AWS::IAM::ManagedPolicy
|
177
|
-
- AWS::IAM::Policy
|
178
|
-
- AWS::IAM::Role
|
179
|
-
- AWS::IAM::UserToGroupAddition
|
180
|
-
- AWS::IAM::User
|
181
|
-
- AWS::Lambda::Alias
|
182
|
-
- AWS::Lambda::EventSourceMapping
|
183
|
-
- AWS::Lambda::Function
|
184
|
-
- AWS::Lambda::Permission
|
185
|
-
- AWS::Lambda::Version
|
186
|
-
- AWS::RDS::DBClusterParameterGroup
|
187
|
-
- AWS::RDS::DBCluster
|
188
|
-
- AWS::RDS::DBInstance
|
189
|
-
- AWS::RDS::DBParameterGroup
|
190
|
-
- AWS::RDS::DBSubnetGroup
|
191
|
-
- AWS::RDS::EventSubscription
|
192
|
-
- AWS::RDS::OptionGroup
|
193
|
-
- AWS::Redshift::ClusterParameterGroup
|
194
|
-
- AWS::Redshift::ClusterSubnetGroup
|
195
|
-
- AWS::Redshift::Cluster
|
196
|
-
- AWS::S3::BucketPolicy
|
197
|
-
- AWS::S3::Bucket
|
198
|
-
- AWS::SNS::Topic
|
199
|
-
- AWS::SQS::Queue
|
200
|
-
|
201
|
-
|
202
|
-
## TODO
|
203
|
-
|
204
|
-
- Support [Kumogata2](https://github.com/winebarrel/kumogata2)
|
205
|
-
- Useful kumogate-template snippets
|
124
|
+
## AWS CloudFormation
|
125
|
+
|
126
|
+
- [Relese notes](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html)
|
127
|
+
- Almost support release date is `January 17, 2017`
|
128
|
+
|
129
|
+
- [Support Resource Types](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html)
|
130
|
+
- AWS::AutoScaling::*
|
131
|
+
- AWS::CertificateManager::*
|
132
|
+
- AWS::CloudFront::**
|
133
|
+
- AWS::CloudTrail::*
|
134
|
+
- AWS::CloudWatch::*
|
135
|
+
- AWS::CodeBuild::*
|
136
|
+
- AWS::CodeCommit::*
|
137
|
+
- AWS::CodeDeploy::*
|
138
|
+
- AWS::DataPipeline::*
|
139
|
+
- AWS::DynamoDB::*
|
140
|
+
- AWS::EC2::*
|
141
|
+
- AWS::ECS::*
|
142
|
+
- AWS::ElastiCache::*
|
143
|
+
- AWS::ElasticBeanstalk::*
|
144
|
+
- AWS::ElasticLoadBalancing::*
|
145
|
+
- AWS::ElasticLoadBalancingV2::*
|
146
|
+
- AWS::EMR::*
|
147
|
+
- AWS::Events::*
|
148
|
+
- AMS::KMS::*
|
149
|
+
- AWS::IAM::*
|
150
|
+
- AWS::Lambda::*
|
151
|
+
- AWS::Logs::*
|
152
|
+
- AWS::RDS::*
|
153
|
+
- AWS::Redshift::*
|
154
|
+
- AWS::S3::*
|
155
|
+
- AWS::SNS::*
|
156
|
+
- AWS::SQS::*
|
data/bin/kumogata-template
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
$: << File.expand_path("#{File.dirname __FILE__}/../lib")
|
3
3
|
require 'rubygems'
|
4
4
|
require 'kumogata/template/ext/kumogata'
|
5
|
-
require 'kumogata/template/ext/
|
5
|
+
require 'kumogata/template/ext/option_parser'
|
6
6
|
require 'kumogata/template'
|
7
7
|
|
8
8
|
|
9
|
-
load Gem.bin_path('
|
9
|
+
load Gem.bin_path('kumogata2', 'kumogata2')
|
data/kumogata-template.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'aws-sdk', '~> 2.3'
|
22
|
-
spec.add_dependency '
|
23
|
-
spec.add_development_dependency 'bundler'
|
24
|
-
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency 'minitest'
|
22
|
+
spec.add_dependency 'kumogata2-plugin-ruby', '0.1.3'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'minitest'
|
26
26
|
end
|
@@ -43,6 +43,25 @@ def _autoscaling_to_policy(value)
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def _autoscaling_to_schedued_recurrence(value)
|
47
|
+
case value
|
48
|
+
when "every 5 min"
|
49
|
+
"*/5 * * * *"
|
50
|
+
when "every 30 min"
|
51
|
+
"0,30 * * * *"
|
52
|
+
when "every 1 hour"
|
53
|
+
"0 * * * *"
|
54
|
+
when "every day"
|
55
|
+
"0 0 * * *"
|
56
|
+
when "every week"
|
57
|
+
"0 0 * * Tue"
|
58
|
+
when /\*/
|
59
|
+
value
|
60
|
+
else
|
61
|
+
_timestamp_utc(value, "cron")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
46
65
|
def _autoscaling_metrics
|
47
66
|
_{
|
48
67
|
Granularity "1Minute"
|
@@ -238,15 +238,7 @@ end
|
|
238
238
|
|
239
239
|
def _cloudwatch_to_ec2_action(value)
|
240
240
|
value = _valid_values(value, %w( recover stop terminate reboot ), "recover")
|
241
|
-
|
242
|
-
Fn__Join "", [
|
243
|
-
"arn:aws:automate:",
|
244
|
-
_{
|
245
|
-
Ref "AWS::Region"
|
246
|
-
},
|
247
|
-
":ec2:#{value}"
|
248
|
-
]
|
249
|
-
}
|
241
|
+
_join([ "arn:aws:automate:", _region, ":ec2:#{value}" ], "")
|
250
242
|
end
|
251
243
|
|
252
244
|
def _cloudwatch_dimension(args)
|
@@ -95,7 +95,7 @@ EC2_INSTANCE_TYPES =
|
|
95
95
|
# x1.32xlarge 128 1,952 2 x 1,902 SSD 10
|
96
96
|
"x1.16xlarge", "x1.32xlarge",
|
97
97
|
]
|
98
|
-
EC2_DEFAULT_INSTANCE_TYPE = "t2.
|
98
|
+
EC2_DEFAULT_INSTANCE_TYPE = "t2.micro"
|
99
99
|
|
100
100
|
ELASTICACHE_DEFAULT_ENGINE = "redis"
|
101
101
|
ELASTICACHE_DEFAULT_ENGINE_VERSION = {
|
@@ -160,10 +160,10 @@ RDS_INSTANCE_CLASSES =
|
|
160
160
|
RDS_DEFAULT_INSTANCE_CLASS = "db.t2.medium"
|
161
161
|
RDS_DEFAULT_ENGINE = "mysql"
|
162
162
|
RDS_DEFAULT_ENGINE_VERSION = {
|
163
|
-
mysql: "5.7.
|
164
|
-
mariadb: "10.
|
163
|
+
mysql: "5.7.17",
|
164
|
+
mariadb: "10.1.19",
|
165
165
|
aurora: "5.6.10a",
|
166
|
-
postgres: "9.
|
166
|
+
postgres: "9.6.2-R1",
|
167
167
|
}
|
168
168
|
|
169
169
|
# https://aws.amazon.com/redshift/pricing/
|
@@ -204,3 +204,21 @@ ELB_ACCESS_LOG_ACCOUNT_ID = {
|
|
204
204
|
"ap-northeast-2": "600734575887",
|
205
205
|
"sa-east-1": "507241528517",
|
206
206
|
}
|
207
|
+
|
208
|
+
# http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html
|
209
|
+
ELASTIC_BEANTALK_LINUX = "64bit Amazon Linux 2017.03"
|
210
|
+
ELASTIC_BEANTALK_PLATFORM = {
|
211
|
+
packer: "#{ELASTIC_BEANTALK_LINUX} v2.2.0 running Packer 1.0.0",
|
212
|
+
docker: "#{ELASTIC_BEANTALK_LINUX} v2.6.0 running Docker 1.12.6",
|
213
|
+
go: "#{ELASTIC_BEANTALK_LINUX} v2.4.0 running Go 1.7",
|
214
|
+
java: "#{ELASTIC_BEANTALK_LINUX} v2.5.0 running Java 8",
|
215
|
+
java_tomcat: "#{ELASTIC_BEANTALK_LINUX} v2.6.0 running Tomcat 8 Java 8",
|
216
|
+
windows_server: "64bit Windows Server 2012 R2 v1.2.0 running IIS 8.5",
|
217
|
+
node: "#{ELASTIC_BEANTALK_LINUX} v4.1.0 running Node.js",
|
218
|
+
php: "#{ELASTIC_BEANTALK_LINUX} v2.4.0 running PHP 7.0",
|
219
|
+
python: "#{ELASTIC_BEANTALK_LINUX} v2.4.0 running Python 3.4",
|
220
|
+
ruby_puma: "#{ELASTIC_BEANTALK_LINUX} v2.4.0 running Ruby 2.3 (Puma)",
|
221
|
+
ruby_passenger: "#{ELASTIC_BEANTALK_LINUX} v2.4.0 running Ruby 2.3 (Passenger Standalone)",
|
222
|
+
}
|
223
|
+
|
224
|
+
ELASTIC_BEANTALK_EC2_DEFAULT_ROLE = "aws-elasticbeanstalk-ec2-role"
|
@@ -31,6 +31,7 @@ end
|
|
31
31
|
|
32
32
|
def _ec2_security_group_egress(args)
|
33
33
|
cidr = args[:cidr] || "0.0.0.0/0"
|
34
|
+
cidr_ipv6 = args[:cidr_ipv6] || ""
|
34
35
|
destination = _ref_string("destination", args, "security group")
|
35
36
|
from = _ref_string("from", args)
|
36
37
|
group = _ref_string("group", args, "security group")
|
@@ -40,6 +41,7 @@ def _ec2_security_group_egress(args)
|
|
40
41
|
|
41
42
|
_{
|
42
43
|
CidrIp cidr if destination.empty?
|
44
|
+
CidrIpv6 cidr_ipv6 unless cidr_ipv6.empty?
|
43
45
|
DestinationSecurityGroupId destination unless destination.empty?
|
44
46
|
FromPort from unless ip == "icmp"
|
45
47
|
GroupId group unless group.empty?
|
@@ -66,6 +68,7 @@ end
|
|
66
68
|
|
67
69
|
def _ec2_security_group_ingress(args)
|
68
70
|
cidr = args[:cidr] || "0.0.0.0/0"
|
71
|
+
cidr_ipv6 = args[:cidr_ipv6] || ""
|
69
72
|
from = _ref_string("from", args)
|
70
73
|
group_id = _ref_string("group", args, "security group")
|
71
74
|
group_name = args[:group_name] || ""
|
@@ -79,6 +82,7 @@ def _ec2_security_group_ingress(args)
|
|
79
82
|
|
80
83
|
_{
|
81
84
|
CidrIp cidr if source_group_name.empty? and source_group_id.empty?
|
85
|
+
CidrIpv6 cidr_ipv6 unless cidr_ipv6.empty?
|
82
86
|
FromPort from unless ip == "icmp"
|
83
87
|
GroupId group_id unless group_id.empty?
|
84
88
|
GroupName group_name unless group_name.empty?
|
@@ -153,7 +157,7 @@ def _ec2_image(instance_type, args)
|
|
153
157
|
|
154
158
|
resource_image = _resource_name(args[:image] || EC2_DEFAULT_IMAGE)
|
155
159
|
_find_in_map("AWSRegionArch2AMI#{resource_image}",
|
156
|
-
|
160
|
+
_region,
|
157
161
|
_find_in_map("AWSInstanceType2Arch", instance_type, "Arch"))
|
158
162
|
end
|
159
163
|
|
@@ -178,6 +182,17 @@ def _ec2_protocol_number(protocol)
|
|
178
182
|
end
|
179
183
|
end
|
180
184
|
|
185
|
+
def _ec2_user_data(args)
|
186
|
+
user_data = _ref_string("user_data", args, "user data")
|
187
|
+
return "" if user_data.empty?
|
188
|
+
|
189
|
+
if user_data.is_a? Hash
|
190
|
+
_base64(user_data)
|
191
|
+
else
|
192
|
+
_base64_shell(user_data)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
181
196
|
def _ec2_spot_fleet_request(args)
|
182
197
|
allocation = _valid_values(args[:allocation], %w( lowestPrice diversified), "lowestPrice")
|
183
198
|
express = _valid_values(args[:express], %w( noTermination default), "")
|
@@ -225,7 +240,7 @@ def _ec2_spot_fleet_launches(args)
|
|
225
240
|
ram_disk = args[:ram_disk] || ""
|
226
241
|
security_groups = _ref_array("security_groups", args, "security group")
|
227
242
|
subnet = _ref_string("subnet", args, "subnet")
|
228
|
-
user_data =
|
243
|
+
user_data = _ec2_user_data(args)
|
229
244
|
weighted = args[:weighted] || ""
|
230
245
|
|
231
246
|
_{
|
@@ -246,12 +261,7 @@ def _ec2_spot_fleet_launches(args)
|
|
246
261
|
RamdiskId ram_disk unless ram_disk.empty?
|
247
262
|
SecurityGroups security_groups unless security_groups.empty?
|
248
263
|
SubnetId subnet unless subnet.empty?
|
249
|
-
UserData
|
250
|
-
Fn__Base64 (<<-EOS).undent
|
251
|
-
#!/bin/bash
|
252
|
-
#{user_data}
|
253
|
-
EOS
|
254
|
-
end unless user_data.empty?
|
264
|
+
UserData user_data unless user_data.empty?
|
255
265
|
WeightedCapacity weighted if args.key? :weighted
|
256
266
|
}
|
257
267
|
end
|
@@ -126,3 +126,37 @@ def _ecs_deployment(args)
|
|
126
126
|
MinimumHealthyPercent args[:min]
|
127
127
|
}
|
128
128
|
end
|
129
|
+
|
130
|
+
def _ecs_placement_definition(args)
|
131
|
+
return "" unless args.key? :placement
|
132
|
+
|
133
|
+
placement = args[:placement]
|
134
|
+
type = _valid_values(placement[:type], %w( distinctInstance memberOf), "distinctInstance")
|
135
|
+
expression = placement[:expression] || ""
|
136
|
+
|
137
|
+
_{
|
138
|
+
Type type
|
139
|
+
Expression expression unless placement.empty?
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
143
|
+
def _ecs_placement_service(args)
|
144
|
+
return "" unless args.key? :placement
|
145
|
+
|
146
|
+
placement = args[:placement]
|
147
|
+
type = _valid_values(placement[:type], %w( random spread binpack ), "random")
|
148
|
+
field =
|
149
|
+
case type
|
150
|
+
when "binpack"
|
151
|
+
_valid_values(args[:field], %w( cpu memory ), "cpu")
|
152
|
+
when "spread"
|
153
|
+
args[:field] || ""
|
154
|
+
else
|
155
|
+
""
|
156
|
+
end
|
157
|
+
|
158
|
+
_{
|
159
|
+
Type type
|
160
|
+
Field field unless field.empty?
|
161
|
+
}
|
162
|
+
end
|