kumogata-template 0.0.33 → 0.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +30 -49
- data/kumogata-template.gemspec +1 -1
- data/lib/kumogata/template/ec2.rb +16 -18
- data/lib/kumogata/template/helper.rb +14 -36
- data/lib/kumogata/template/iam.rb +2 -0
- data/lib/kumogata/template/s3.rb +15 -0
- data/lib/kumogata/template/sns.rb +7 -2
- data/lib/kumogata/template/version.rb +1 -1
- data/template/ec2-customer-gateway.rb +21 -0
- data/template/ec2-dhcp-options.rb +25 -0
- data/template/ec2-egress-only-internet-gateway.rb +15 -0
- data/template/ec2-instance.rb +2 -2
- data/template/ec2-network-interface-attachment.rb +22 -0
- data/template/ec2-network-interface.rb +32 -0
- data/template/ec2-placement-group.rb +17 -0
- data/template/ec2-security-group-egress.rb +15 -0
- data/template/ec2-security-group-ingress.rb +19 -0
- data/template/ec2-security-group.rb +4 -4
- data/template/ec2-subnet-cidr-block.rb +17 -0
- data/template/ec2-vpc-cidr-block.rb +17 -0
- data/template/ec2-vpc-dhcp-options-association.rb +17 -0
- data/template/ec2-vpc-peering-connection.rb +23 -0
- data/template/ec2-vpn-connection-route.rb +17 -0
- data/template/ec2-vpn-connection.rb +23 -0
- data/template/ec2-vpn-gateway-route-propagation.rb +17 -0
- data/template/ec2-vpn-gateway.rb +17 -0
- data/template/ecs-service.rb +2 -2
- data/template/iam-group.rb +2 -2
- data/template/iam-instance-profile.rb +2 -2
- data/template/iam-role.rb +2 -2
- data/template/iam-user.rb +2 -2
- data/template/output-access-key.rb +2 -2
- data/template/{output-iam-instance-profile.rb → output-instance-profile.rb} +1 -1
- data/template/output-network-interface.rb +14 -0
- data/template/{output-iam-role.rb → output-role.rb} +1 -1
- data/template/{output-ec2-subnet.rb → output-subnet.rb} +1 -1
- data/template/rds-db-instance.rb +5 -1
- data/template/s3-bucket.rb +1 -2
- data/template/sns-topic.rb +2 -2
- data/test/ec2_test.rb +17 -18
- data/test/helper_test.rb +4 -2
- data/test/sns_test.rb +16 -0
- data/test/template/ec2-customer-gateway_tet.rb +55 -0
- data/test/template/ec2-dhcp-options_test.rb +49 -0
- data/test/template/ec2-egress-only-internet-gateway_test.rb +23 -0
- data/test/template/ec2-instance_test.rb +1 -1
- data/test/template/ec2-network-interface-attachment_tet.rb +28 -0
- data/test/template/ec2-network-interface_test.rb +52 -0
- data/test/template/ec2-placement-group_test.rb +21 -0
- data/test/template/ec2-security-group-egress_test.rb +25 -0
- data/test/template/ec2-security-group-ingress_test.rb +25 -0
- data/test/template/ec2-security-group_test.rb +1 -0
- data/test/template/ec2-subnet-cidr-block_test.rb +26 -0
- data/test/template/ec2-vpc-cidr-block_test.rb +24 -0
- data/test/template/ec2-vpc-dhcp-options-association_test.rb +26 -0
- data/test/template/ec2-vpc-peering-connection_test.rb +54 -0
- data/test/template/ec2-vpn-connection-route_test.rb +26 -0
- data/test/template/ec2-vpn-connection_test.rb +56 -0
- data/test/template/ec2-vpn-gateway-route-propagation_test.rb +28 -0
- data/test/template/ec2-vpn-gateway_test.rb +49 -0
- data/test/template/ecs-service_test.rb +1 -0
- data/test/template/iam-instance-profile_test.rb +4 -3
- data/test/template/iam-user_test.rb +54 -0
- data/test/template/output-access-key_test.rb +2 -2
- data/test/template/{output-iam-instance-profile_test.rb → output-instance-profile_test.rb} +2 -2
- data/test/template/output-network-interface_test.rb +39 -0
- data/test/template/{output-iam-role_test.rb → output-role_test.rb} +2 -2
- data/test/template/{output-ec2-subet_test.rb → output-subet_test.rb} +2 -2
- data/test/template/rds-db-instance_test.rb +5 -5
- data/test/template/s3-bucket_test.rb +60 -0
- metadata +66 -16
- data/Gemfile.lock +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4614c777d40479422e7f81c0c24dfbe53a47c2e0
|
4
|
+
data.tar.gz: cdb0a588add13fb92a75e3e1c2ca78ef5e9a7706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43838f52cc049725b0f73250853f17ddce36ff41658db661622935dde7dc2f6cb119448c84926d97507fface0c4d60367f19ef50c55569993646e8720b36269c
|
7
|
+
data.tar.gz: 923adaaa2fe9d84de9d225ce129f440423f1bb22443bbc7b57391d01fc8f06b8db1274ee85b16bb41594af3f20d94a6b6375e0f54ac4aa784e9217d3f710a6ee
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/kumogata-template.svg)](http://badge.fury.io/rb/kumogata-template)
|
4
4
|
[![Build Status](https://travis-ci.org/n0ts/kumogata-template.svg?branch=master)](https://travis-ci.org/n0ts/kumogata-template)
|
5
5
|
|
6
|
+
|
6
7
|
## About
|
7
8
|
|
8
9
|
- `kumogate-template` is a template sets for [kumogata2](https://github.com/winebarrel/kumogata2).
|
9
10
|
|
11
|
+
|
10
12
|
## Installation
|
11
13
|
|
12
14
|
Add this line to your application's Gemfile:
|
@@ -17,11 +19,15 @@ gem 'kumogata-template'
|
|
17
19
|
|
18
20
|
And then execute:
|
19
21
|
|
20
|
-
|
22
|
+
```
|
23
|
+
$ bundle
|
24
|
+
```
|
21
25
|
|
22
26
|
Or install it yourself as:
|
23
27
|
|
24
|
-
|
28
|
+
```
|
29
|
+
$ gem install kumogata-template
|
30
|
+
```
|
25
31
|
|
26
32
|
|
27
33
|
## Usage
|
@@ -31,10 +37,10 @@ Usage: kumogate-template <command> [args] [options]
|
|
31
37
|
|
32
38
|
Commands:
|
33
39
|
init STACK_NAME Initialize template
|
34
|
-
* Other command same as
|
40
|
+
* Other command same as kumogata2 commands
|
35
41
|
|
36
42
|
Options:
|
37
|
-
* Options is same as the
|
43
|
+
* Options is same as the kumogata2 options
|
38
44
|
```
|
39
45
|
|
40
46
|
- Initialize a sample template
|
@@ -60,28 +66,28 @@ Parameters do
|
|
60
66
|
description: "sample version"
|
61
67
|
end
|
62
68
|
|
63
|
-
Mappings do
|
64
|
-
end
|
65
|
-
|
66
69
|
Resources do
|
67
|
-
|
70
|
+
# And more kumogata-template examples at examples/
|
71
|
+
|
72
|
+
# Create a S3 Bucket
|
73
|
+
#_s3_bucket "sample"
|
68
74
|
end
|
69
75
|
|
70
76
|
Outputs do
|
71
|
-
|
77
|
+
# Output S3 Bucket Information
|
78
|
+
#_output_s3 "sample"
|
72
79
|
end
|
73
80
|
```
|
74
81
|
|
75
|
-
- Below sample template is create a s3 bucket.
|
76
82
|
|
77
|
-
|
78
|
-
## What is difference `kumogata-template` and `kumogata`
|
83
|
+
## What is **THE** difference `kumogata-template` and `kumogata2`
|
79
84
|
|
80
85
|
- For example launch EC2 instance.
|
81
86
|
|
82
|
-
###
|
87
|
+
### kumogata2
|
83
88
|
|
84
89
|
```
|
90
|
+
Resources do
|
85
91
|
myEC2Instance do
|
86
92
|
Type "AWS::EC2::Instance"
|
87
93
|
Properties do
|
@@ -98,6 +104,8 @@ end
|
|
98
104
|
end
|
99
105
|
end
|
100
106
|
end
|
107
|
+
...
|
108
|
+
end
|
101
109
|
```
|
102
110
|
|
103
111
|
|
@@ -106,6 +114,7 @@ end
|
|
106
114
|
- More simply write cloudformation stack.
|
107
115
|
|
108
116
|
```
|
117
|
+
Resources do
|
109
118
|
user_data =<<EOS
|
110
119
|
yum install -y httpd
|
111
120
|
service httpd start
|
@@ -116,41 +125,13 @@ EOS
|
|
116
125
|
ref_instance_type: "my",
|
117
126
|
key_name: "your_key_name",
|
118
127
|
user_data: user_data
|
128
|
+
...
|
129
|
+
end
|
119
130
|
```
|
120
131
|
|
121
|
-
- more example see [test code](test/template)
|
122
|
-
|
123
|
-
|
124
|
-
## AWS CloudFormation
|
125
|
-
|
126
|
-
|
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::*
|
132
|
+
- And more example see [test code](test/template/)
|
133
|
+
|
134
|
+
|
135
|
+
## Support AWS CloudFormation Relase
|
136
|
+
|
137
|
+
**January 17, 2017** [Relese notes](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html)
|
data/kumogata-template.gemspec
CHANGED
@@ -19,7 +19,7 @@ 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 'kumogata2-plugin-ruby', '0.1.
|
22
|
+
spec.add_dependency 'kumogata2-plugin-ruby', '>= 0.1.6'
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
25
25
|
spec.add_development_dependency 'minitest'
|
@@ -19,38 +19,38 @@ def _ec2_tags(args)
|
|
19
19
|
_tags(args)
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def _ec2_security_group_egress_rules(name, args)
|
23
23
|
return [] unless args.key? name.to_sym
|
24
24
|
|
25
25
|
rules = []
|
26
26
|
_array(args[name.to_sym]).each do |arg|
|
27
|
-
rules <<
|
27
|
+
rules << _ec2_security_group_egress_rule(arg)
|
28
28
|
end
|
29
29
|
rules
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def _ec2_security_group_egress_rule(args)
|
33
33
|
cidr = args[:cidr] || "0.0.0.0/0"
|
34
34
|
cidr_ipv6 = args[:cidr_ipv6] || ""
|
35
|
-
|
35
|
+
dest_security = _ref_string("dest_security", args, "security group")
|
36
36
|
from = _ref_string("from", args)
|
37
|
-
group = _ref_string("group", args, "security group")
|
38
37
|
ip = args[:ip] || "tcp"
|
38
|
+
dest_prefix = _ref_string("dest_prefix", args, "vpc endpoint")
|
39
39
|
to = _ref_string("to", args)
|
40
40
|
from = to if from.empty?
|
41
41
|
|
42
42
|
_{
|
43
|
-
CidrIp cidr if
|
43
|
+
CidrIp cidr if dest_security.empty?
|
44
44
|
CidrIpv6 cidr_ipv6 unless cidr_ipv6.empty?
|
45
|
-
|
45
|
+
DestinationPrefixListId dest_prefix unless dest_prefix.empty?
|
46
46
|
FromPort from unless ip == "icmp"
|
47
|
-
GroupId group unless group.empty?
|
48
47
|
IpProtocol ip
|
48
|
+
DestinationSecurityGroupId dest_security unless dest_security.empty?
|
49
49
|
ToPort to unless ip == "icmp"
|
50
50
|
}
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def _ec2_security_group_ingress_rules(name, args)
|
54
54
|
return [] unless args.key? name.to_sym
|
55
55
|
|
56
56
|
rules = []
|
@@ -61,17 +61,15 @@ def _ec2_security_group_ingresses(name, args)
|
|
61
61
|
to: arg,
|
62
62
|
}
|
63
63
|
end
|
64
|
-
rules <<
|
64
|
+
rules << _ec2_security_group_ingress_rule(arg)
|
65
65
|
end
|
66
66
|
rules
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def _ec2_security_group_ingress_rule(args)
|
70
70
|
cidr = args[:cidr] || "0.0.0.0/0"
|
71
71
|
cidr_ipv6 = args[:cidr_ipv6] || ""
|
72
72
|
from = _ref_string("from", args)
|
73
|
-
group_id = _ref_string("group", args, "security group")
|
74
|
-
group_name = args[:group_name] || ""
|
75
73
|
ip = args[:ip] || "tcp"
|
76
74
|
source_group_name = _ref_string("source_group_name", args, "security group")
|
77
75
|
source_group_id = _ref_string("source_group_id", args, "security group")
|
@@ -84,8 +82,6 @@ def _ec2_security_group_ingress(args)
|
|
84
82
|
CidrIp cidr if source_group_name.empty? and source_group_id.empty?
|
85
83
|
CidrIpv6 cidr_ipv6 unless cidr_ipv6.empty?
|
86
84
|
FromPort from unless ip == "icmp"
|
87
|
-
GroupId group_id unless group_id.empty?
|
88
|
-
GroupName group_name unless group_name.empty?
|
89
85
|
IpProtocol ip
|
90
86
|
SourceSecurityGroupName source_group_name unless source_group_name.empty?
|
91
87
|
SourceSecurityGroupId source_group_id unless source_group_id.empty?
|
@@ -120,7 +116,7 @@ def _ec2_block_device(args)
|
|
120
116
|
}
|
121
117
|
end
|
122
118
|
|
123
|
-
def
|
119
|
+
def _ec2_network_interface_embedded(args, is_spot = false)
|
124
120
|
associate_public = _bool("associate_public", args, true)
|
125
121
|
delete = _bool("delete", args, true)
|
126
122
|
description = args[:description] || ""
|
@@ -196,7 +192,9 @@ end
|
|
196
192
|
def _ec2_spot_fleet_request(args)
|
197
193
|
allocation = _valid_values(args[:allocation], %w( lowestPrice diversified), "lowestPrice")
|
198
194
|
express = _valid_values(args[:express], %w( noTermination default), "")
|
199
|
-
iam =
|
195
|
+
iam = _ref_attr_string("iam", "Arn", args, "role")
|
196
|
+
# TODO move to role.rb
|
197
|
+
iam = "aws-ec2-spot-fleet-role" if iam.empty?
|
200
198
|
launches = args[:launches].collect{|v| _ec2_spot_fleet_launches(v) }
|
201
199
|
price = args[:price] || 0.00
|
202
200
|
target = _ref_string("target", args, "")
|
@@ -235,7 +233,7 @@ def _ec2_spot_fleet_launches(args)
|
|
235
233
|
kernel = args[:kernel] || ""
|
236
234
|
key_name = _ref_string("key_name", args, "key name")
|
237
235
|
monitoring = _bool("monitoring", args, false)
|
238
|
-
network_interfaces = (args[:network_interfaces] || []).collect{|v|
|
236
|
+
network_interfaces = (args[:network_interfaces] || []).collect{|v| _ec2_network_interface_embedded(v, true) }
|
239
237
|
placement = _ref_string("placement", args)
|
240
238
|
ram_disk = args[:ram_disk] || ""
|
241
239
|
security_groups = _ref_array("security_groups", args, "security group")
|
@@ -59,8 +59,11 @@ def _valid_numbers(value, min = 0, max = 0, default = nil)
|
|
59
59
|
(min <= number and number <= max) ? number : default
|
60
60
|
end
|
61
61
|
|
62
|
-
def _real_name(name)
|
63
|
-
name
|
62
|
+
def _real_name(name, args)
|
63
|
+
key = _ref_key?(name, args) ? name : "name"
|
64
|
+
real_name = _ref_string(key, args)
|
65
|
+
real_name = real_name.gsub(" ", "-") if real_name.is_a? String
|
66
|
+
real_name =~ /^false/i ? false : real_name
|
64
67
|
end
|
65
68
|
|
66
69
|
def _ref_key?(name, args, ref_name = '')
|
@@ -70,6 +73,13 @@ def _ref_key?(name, args, ref_name = '')
|
|
70
73
|
false
|
71
74
|
end
|
72
75
|
|
76
|
+
def _ref_number(name, args, ref_name = '')
|
77
|
+
return _import(args["import_#{name}".to_sym]) if args.key? "import_#{name}".to_sym
|
78
|
+
return args[name.to_sym].to_i || 0 unless args.key? "ref_#{name}".to_sym
|
79
|
+
|
80
|
+
_ref(_resource_name(args["ref_#{name}".to_sym].to_s, ref_name))
|
81
|
+
end
|
82
|
+
|
73
83
|
def _ref_string(name, args, ref_name = '')
|
74
84
|
return _import(args["import_#{name}".to_sym]) if args.key? "import_#{name}".to_sym
|
75
85
|
return args[name.to_sym].to_s || '' unless args.key? "ref_#{name}".to_sym
|
@@ -197,7 +207,7 @@ def _base64(data)
|
|
197
207
|
end
|
198
208
|
|
199
209
|
def _base64_shell(data, shell = "/bin/bash")
|
200
|
-
_base64("#!#{shell}\n#{data}")
|
210
|
+
_base64("#!#{shell}\n#{data}\n")
|
201
211
|
end
|
202
212
|
|
203
213
|
def _find_in_map(name, top_level, secondary_level)
|
@@ -220,7 +230,7 @@ end
|
|
220
230
|
|
221
231
|
def _export_string(args, prefix)
|
222
232
|
if args.key? :export and args[:export] == true
|
223
|
-
"#{args[:name]}-#{prefix}"
|
233
|
+
"#{args[:name]}-#{prefix.gsub(' ', '-')}"
|
224
234
|
else
|
225
235
|
""
|
226
236
|
end
|
@@ -380,35 +390,3 @@ def _window_time(service, start_time)
|
|
380
390
|
end
|
381
391
|
"#{start_time.strftime(format)}-#{end_time.strftime(format)}"
|
382
392
|
end
|
383
|
-
|
384
|
-
def _ref_arn(service, name)
|
385
|
-
# FIXME
|
386
|
-
_{
|
387
|
-
Fn__Join [
|
388
|
-
",",
|
389
|
-
[
|
390
|
-
"arn:aws:#{service}:::",
|
391
|
-
_{ Ref _resource_name(name) },
|
392
|
-
]
|
393
|
-
]
|
394
|
-
}
|
395
|
-
end
|
396
|
-
|
397
|
-
def _ref_pseudo(type)
|
398
|
-
pseudo =
|
399
|
-
case type
|
400
|
-
when "account"
|
401
|
-
"AccountId"
|
402
|
-
when "notification arns"
|
403
|
-
"NotificationARNs"
|
404
|
-
when "no value"
|
405
|
-
"NoValue"
|
406
|
-
when "region"
|
407
|
-
"Region"
|
408
|
-
when "stack id"
|
409
|
-
"StackId"
|
410
|
-
when "stack name"
|
411
|
-
"StackName"
|
412
|
-
end
|
413
|
-
_{ Ref "AWS::#{pseudo}" }
|
414
|
-
end
|
@@ -251,6 +251,8 @@ def _iam_arn(service, resource)
|
|
251
251
|
"arn:aws:sts::#{v[:account_id]}:#{v[:type]}/#{v[:user]}"
|
252
252
|
elsif v.key? :policy
|
253
253
|
"arn:aws:iam::aws:policy/#{_iam_to_policy(v[:policy])}"
|
254
|
+
elsif v.key? :role
|
255
|
+
"#{arn_prefix}::#{v[:account_id]}:role/#{v[:role]}"
|
254
256
|
elsif v.key? :root
|
255
257
|
"#{arn_prefix}::#{v[:account_id]}:root"
|
256
258
|
else
|
data/lib/kumogata/template/s3.rb
CHANGED
@@ -3,6 +3,21 @@
|
|
3
3
|
#
|
4
4
|
require 'kumogata/template/helper'
|
5
5
|
|
6
|
+
def _s3_to_deletion_policy(value)
|
7
|
+
return "Retain" if value.nil?
|
8
|
+
|
9
|
+
case "value"
|
10
|
+
when "delete"
|
11
|
+
"Delete"
|
12
|
+
when "retain"
|
13
|
+
"Retain"
|
14
|
+
when "shapshot"
|
15
|
+
"Snapshot"
|
16
|
+
else
|
17
|
+
_valid_values(value, %w( Delete Retain Snapshot ), "Retain")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
6
21
|
def _s3_to_access(value)
|
7
22
|
return "Private" if value.nil?
|
8
23
|
|
@@ -23,8 +23,13 @@ def _sns_subscription_list(args)
|
|
23
23
|
|
24
24
|
array = []
|
25
25
|
subscription.each do |v|
|
26
|
-
|
27
|
-
|
26
|
+
if v.is_a? String
|
27
|
+
protocol = "email"
|
28
|
+
endpoint = v
|
29
|
+
else
|
30
|
+
protocol = _sns_to_protocol(v[:protocol])
|
31
|
+
endpoint = _sns_to_endpoint(protocol, v[:endpoint])
|
32
|
+
end
|
28
33
|
array << _{
|
29
34
|
Endpoint endpoint
|
30
35
|
Protocol protocol
|
@@ -1 +1 @@
|
|
1
|
-
KUMOGATA_TEMPLATE_VERSION = '0.0.
|
1
|
+
KUMOGATA_TEMPLATE_VERSION = '0.0.34'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Customer Gateway resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "customer gateway")
|
8
|
+
bgp = _ref_string("bgp", args, "bgp")
|
9
|
+
ip = _ref_string("ip", args, "ip")
|
10
|
+
tags = _tags(args)
|
11
|
+
type = _ref_string("type", args)
|
12
|
+
|
13
|
+
_(name) do
|
14
|
+
Type "AWS::EC2::CustomerGateway"
|
15
|
+
Properties do
|
16
|
+
BgpAsn bgp
|
17
|
+
IpAddress ip
|
18
|
+
Tags tags
|
19
|
+
Type type
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# EC2 DHCP Options resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "dhcp options")
|
8
|
+
domain_name = _ref_string("domain_name", args, "domain name")
|
9
|
+
domain_servers = _ref_array("domain_servers", args, "domain servers")
|
10
|
+
netbios_servers = _ref_array("netbios_servers", args, "netbios servers")
|
11
|
+
netbios_type = args[:netbios_type] || 2
|
12
|
+
ntp_serves = _ref_array("ntp_serves", args, "ntp servers")
|
13
|
+
tags = _tags(args)
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::EC2::DHCPOptions"
|
17
|
+
Properties do
|
18
|
+
DomainName domain_name unless domain_name.empty?
|
19
|
+
DomainNameServers domain_servers unless domain_servers.empty?
|
20
|
+
NetbiosNameServers netbios_servers unless netbios_servers.empty?
|
21
|
+
NetbiosNodeType netbios_type unless netbios_servers.empty?
|
22
|
+
NtpServers unless ntp_serves.empty?
|
23
|
+
Tags tags
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Egress Only Internet Gateway resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "egress only internet gateway")
|
8
|
+
vpc = _ref_string("vpc", args, "vpc")
|
9
|
+
|
10
|
+
_(name) do
|
11
|
+
Type "AWS::EC2::EgressOnlyInternetGateway"
|
12
|
+
Properties do
|
13
|
+
VpcId vpc
|
14
|
+
end
|
15
|
+
end
|
data/template/ec2-instance.rb
CHANGED
@@ -19,7 +19,7 @@ ipv6_addresses = args[:ipv6_addresses] || []
|
|
19
19
|
kernel = args[:kernel] || ""
|
20
20
|
key_name = _ref_string("key_name", args, "key name")
|
21
21
|
monitoring = _bool("monitoring", args, true)
|
22
|
-
network_interfaces = (args[:network_interfaces] || []).collect{|v|
|
22
|
+
network_interfaces = (args[:network_interfaces] || []).collect{|v| _ec2_network_interface_embedded(v) }
|
23
23
|
placement = _ref_string("placement", args)
|
24
24
|
private_ip = args[:private_ip] || ""
|
25
25
|
ram_disk = args[:ram_disk] || ""
|
@@ -29,7 +29,7 @@ ssm = args[:ssm] || []
|
|
29
29
|
subnet = _ref_string("subnet", args, "subnet")
|
30
30
|
tags = _ec2_tags(args)
|
31
31
|
tenancy = args[:tenancy] || "default"
|
32
|
-
user_data = _ec2_user_data(args)
|
32
|
+
user_data = _ec2_user_data(args)
|
33
33
|
volumes = args[:volumes] || ""
|
34
34
|
|
35
35
|
_(name) do
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Network Interface Attachment resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "network interface attachment")
|
8
|
+
delete = _bool("delete", args, true)
|
9
|
+
index = args[:index] || 0
|
10
|
+
instance = _ref_string("instance", args, "instance")
|
11
|
+
network = _ref_string("network", args, "network interface")
|
12
|
+
|
13
|
+
_(name) do
|
14
|
+
Type "AWS::EC2::NetworkInterfaceAttachment"
|
15
|
+
Properties do
|
16
|
+
DeleteOnTermination delete
|
17
|
+
DeviceIndex index
|
18
|
+
InstanceId instance
|
19
|
+
NetworkInterfaceId network
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Network Interface resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "network interface")
|
8
|
+
description = _ref_string_default("description", args)
|
9
|
+
group_set = _ref_array("group_set", args, "security group")
|
10
|
+
ipv6_addresses = args[:ipv6_addresses] || []
|
11
|
+
private_ip = args[:private_ip] || ""
|
12
|
+
private_ips = args[:private_ips] || ""
|
13
|
+
secondary_private_ip = args[:secondary_private_ip] || ""
|
14
|
+
source_dest = _bool("source_dest", args, false)
|
15
|
+
subnet = _ref_string("subnet", args, "subnet")
|
16
|
+
tags = _tags(args)
|
17
|
+
|
18
|
+
_(name) do
|
19
|
+
Type "AWS::EC2::NetworkInterface"
|
20
|
+
Properties do
|
21
|
+
Description description unless description.empty?
|
22
|
+
GroupSet group_set unless group_set.empty?
|
23
|
+
Ipv6AddressCount ipv6_addresses.size unless ipv6_addresses.empty?
|
24
|
+
Ipv6Addresses ipv6_addresses unless ipv6_addresses.empty?
|
25
|
+
PrivateIpAddress private_ip unless private_ips.empty?
|
26
|
+
PrivateIpAddresses private_ips unless private_ip.empty?
|
27
|
+
SecondaryPrivateIpAddressCount secondary_private_ip unless secondary_private_ip.empty?
|
28
|
+
SourceDestCheck source_dest
|
29
|
+
SubnetId subnet
|
30
|
+
Tags tags
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Placement Group resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "placement group")
|
8
|
+
strategy = args[:strategy] || "cluster"
|
9
|
+
|
10
|
+
_(name) do
|
11
|
+
Type "AWS::EC2::PlacementGroup"
|
12
|
+
Properties do
|
13
|
+
Strategy strategy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Security Group Egress resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ec2'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "security group egress")
|
9
|
+
egress = _ec2_security_group_egress_rule(args)
|
10
|
+
egress["GroupId"] = _ref_string("group", args, "security group")
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::EC2::SecurityGroupEgress"
|
14
|
+
Properties egress
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Security Group Ingress resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ec2'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "security group ingress")
|
9
|
+
ingress = _ec2_security_group_ingress_rule(args)
|
10
|
+
group_id = _ref_string("group_id", args, "security group")
|
11
|
+
ingress["GroupId"] = group_id unless group_id.empty?
|
12
|
+
group_name = _ref_string("group_name", args, "security group")
|
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?
|
15
|
+
|
16
|
+
_(name) do
|
17
|
+
Type "AWS::EC2::SecurityGroupIngress"
|
18
|
+
Properties ingress
|
19
|
+
end
|
@@ -6,17 +6,17 @@ 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(
|
9
|
+
group_name = _real_name("group", args)
|
10
10
|
description = args[:description] || "#{args[:name]} security group description"
|
11
|
-
egress =
|
12
|
-
ingress =
|
11
|
+
egress = _ec2_security_group_egress_rules("egress", args)
|
12
|
+
ingress = _ec2_security_group_ingress_rules("ingress", args)
|
13
13
|
tags = _tags(args)
|
14
14
|
vpc = _ref_string("vpc", args, "vpc")
|
15
15
|
|
16
16
|
_(name) do
|
17
17
|
Type "AWS::EC2::SecurityGroup"
|
18
18
|
Properties do
|
19
|
-
GroupName group_name
|
19
|
+
GroupName group_name if group_name
|
20
20
|
GroupDescription description
|
21
21
|
SecurityGroupEgress egress unless egress.empty?
|
22
22
|
SecurityGroupIngress ingress unless ingress.empty?
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Subnet Cidr Block resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "subnet cidr block")
|
8
|
+
cidr = _ref_string("cidr", args, "cidr")
|
9
|
+
subnet = _ref_string("subnet", args, "subnet")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::SubnetCidrBlock"
|
13
|
+
Properties do
|
14
|
+
Ipv6CidrBlock cidr
|
15
|
+
SubnetId subnet
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 VPC Cidr Block resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "vpc cidr block")
|
8
|
+
cidr = true
|
9
|
+
vpc = _ref_string("vpc", args, "vpc")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::VPCCidrBlock"
|
13
|
+
Properties do
|
14
|
+
AmazonProvidedIpv6CidrBlock cidr
|
15
|
+
VpcId vpc
|
16
|
+
end
|
17
|
+
end
|