cfndk 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +8 -5
  3. data/.gitignore +1 -0
  4. data/.rspec +2 -0
  5. data/Gemfile +0 -11
  6. data/Gemfile.lock +1069 -587
  7. data/README.md +124 -10
  8. data/cfndk.gemspec +7 -2
  9. data/docker/Dockerfile +8 -0
  10. data/docker/build.sh +3 -0
  11. data/docker/cfndk.sh +14 -0
  12. data/lib/cfndk/change_set_command.rb +14 -8
  13. data/lib/cfndk/command.rb +14 -6
  14. data/lib/cfndk/credential_provider_chain.rb +12 -42
  15. data/lib/cfndk/credential_resolvable.rb +10 -0
  16. data/lib/cfndk/diff.rb +38 -0
  17. data/lib/cfndk/global_config.rb +33 -2
  18. data/lib/cfndk/key_pair.rb +33 -1
  19. data/lib/cfndk/key_pair_command.rb +10 -3
  20. data/lib/cfndk/key_pairs.rb +12 -0
  21. data/lib/cfndk/stack.rb +67 -60
  22. data/lib/cfndk/stack_command.rb +26 -8
  23. data/lib/cfndk/stacks.rb +16 -0
  24. data/lib/cfndk/template_packager.rb +210 -0
  25. data/lib/cfndk/uuid.rb +10 -0
  26. data/lib/cfndk/version.rb +1 -1
  27. data/lib/cfndk.rb +12 -1
  28. data/spec/cfndk_spec.rb +1 -1
  29. data/spec/cfndk_stack_create_spec.rb +365 -5
  30. data/spec/cfndk_stack_destroy_spec.rb +64 -0
  31. data/spec/cfndk_stack_update_spec.rb +86 -0
  32. data/spec/fixtures/big_vpc.yaml +533 -0
  33. data/spec/fixtures/lambda_function/index.js +4 -0
  34. data/spec/fixtures/lambda_function/lambda_function.json +4 -0
  35. data/spec/fixtures/lambda_function/lambda_function.yaml +28 -0
  36. data/spec/fixtures/nested_stack.json +35 -0
  37. data/spec/fixtures/nested_stack.yaml +20 -0
  38. data/spec/fixtures/serverless_function/index.js +4 -0
  39. data/spec/fixtures/serverless_function/serverless_function.json +4 -0
  40. data/spec/fixtures/serverless_function/serverless_function.yaml +21 -0
  41. data/spec/fixtures/stack.json +8 -0
  42. data/spec/fixtures/stack.template.json +39 -0
  43. data/spec/fixtures/stack.yaml +22 -0
  44. data/spec/fixtures/vpc.template.json +40 -0
  45. data/vagrant/Vagrantfile +89 -0
  46. metadata +117 -13
@@ -0,0 +1,20 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: Stack2
3
+ Parameters:
4
+ VpcId:
5
+ Type: String
6
+ Resources:
7
+ TestSg:
8
+ Type: AWS::EC2::SecurityGroup
9
+ Properties:
10
+ GroupDescription: Web ELB Acccess Security Group
11
+ VpcId: !Ref VpcId
12
+ SecurityGroupIngress:
13
+ - IpProtocol: tcp
14
+ FromPort: 80
15
+ ToPort: 80
16
+ CidrIp: 0.0.0.0/0
17
+ Description: Allow HTTP Access From Internet
18
+ Tags:
19
+ - Key: Name
20
+ Value: TestSg
@@ -0,0 +1,4 @@
1
+
2
+ exports.handler = function(event, context) {
3
+ console.log('test');
4
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "Parameters": [
3
+ ]
4
+ }
@@ -0,0 +1,21 @@
1
+
2
+
3
+ AWSTemplateFormatVersion: '2010-09-09'
4
+ Transform: AWS::Serverless-2016-10-31
5
+ Resources:
6
+ ServerlessFunction:
7
+ Type: AWS::Serverless::Function
8
+ Properties:
9
+ FunctionName: serverless-func
10
+ CodeUri: ./serverless_function
11
+ Handler: index.handler
12
+ Runtime: "nodejs12.x"
13
+ AutoPublishAlias: live
14
+ Timeout: 10
15
+ MemorySize: 128
16
+
17
+ ServerlessFunctionLogGroup:
18
+ Type: AWS::Logs::LogGroup
19
+ Properties:
20
+ LogGroupName: !Sub /aws/lambda/${ServerlessFunction}
21
+ RetentionInDays: 14
@@ -0,0 +1,8 @@
1
+ {
2
+ "Parameters": [
3
+ {
4
+ "ParameterKey": "VpcName",
5
+ "ParameterValue": "sample"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "Stack1",
4
+ "Parameters": {
5
+ "VpcName": {
6
+ "Description": "Name for this VPC",
7
+ "Type": "String"
8
+ }
9
+ },
10
+ "Resources": {
11
+ "Vpc": {
12
+ "Type": "AWS::EC2::VPC",
13
+ "Properties": {
14
+ "CidrBlock": "192.168.0.0/24",
15
+ "EnableDnsHostnames": true,
16
+ "Tags": [
17
+ {
18
+ "Key": "Name",
19
+ "Value": {
20
+ "Fn::Sub": "${VpcName}-VPC"
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ },
26
+ "SgStack": {
27
+ "Type": "AWS::CloudFormation::Stack",
28
+ "Properties": {
29
+ "Parameters": {
30
+ "VpcId": {
31
+ "Ref": "Vpc"
32
+ }
33
+ },
34
+ "TemplateURL": "./nested_stack.json",
35
+ "TimeoutInMinutes": 2
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,22 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: Stack1
3
+ Parameters:
4
+ VpcName:
5
+ Description: Name for this VPC
6
+ Type: String
7
+ Resources:
8
+ Vpc:
9
+ Type: AWS::EC2::VPC
10
+ Properties:
11
+ CidrBlock: 192.168.0.0/24
12
+ EnableDnsHostnames: true
13
+ Tags:
14
+ - Key: Name
15
+ Value: !Sub ${VpcName}-VPC
16
+ SgStack:
17
+ Type: AWS::CloudFormation::Stack
18
+ Properties:
19
+ Parameters:
20
+ VpcId: !Ref Vpc
21
+ TemplateURL: ./nested_stack.yaml
22
+ TimeoutInMinutes: 2
@@ -0,0 +1,40 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "Stack1",
4
+ "Parameters": {
5
+ "VpcName": {
6
+ "Description": "Name for this VPC",
7
+ "Type": "String"
8
+ }
9
+ },
10
+ "Resources": {
11
+ "Vpc": {
12
+ "Type": "AWS::EC2::VPC",
13
+ "Properties": {
14
+ "CidrBlock": "192.168.0.0/24",
15
+ "EnableDnsHostnames": true,
16
+ "Tags": [
17
+ {
18
+ "Key": "Name",
19
+ "Value": {
20
+ "Fn::Sub": "${VpcName}-VPC"
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ }
26
+ },
27
+ "Outputs": {
28
+ "VpcId": {
29
+ "Description": "VPC ID",
30
+ "Value": {
31
+ "Ref": "Vpc"
32
+ },
33
+ "Export": {
34
+ "Name": {
35
+ "Fn::Sub": "${VpcName}-VpcId"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,89 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure('2') do |config|
9
+ # vagrant plugin install vagrant-vbgues
10
+ config.vbguest.auto_update = true
11
+ config.vbguest.no_remote = true
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://vagrantcloud.com/search.
15
+ config.vm.box = 'centos/7'
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # NOTE: This will enable public access to the opened port
26
+ # config.vm.network "forwarded_port", guest: 80, host: 8081
27
+
28
+ # Create a forwarded port mapping which allows access to a specific port
29
+ # within the machine from a port on the host machine and only allow access
30
+ # via 127.0.0.1 to disable public access
31
+ # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
32
+
33
+ # Create a private network, which allows host-only access to the machine
34
+ # using a specific IP.
35
+ # config.vm.network "private_network", ip: "192.168.33.10"
36
+
37
+ # Create a public network, which generally matched to bridged network.
38
+ # Bridged networks make the machine appear as another physical device on
39
+ # your network.
40
+ # config.vm.network "public_network"
41
+
42
+ # Share an additional folder to the guest VM. The first argument is
43
+ # the path on the host to the actual folder. The second argument is
44
+ # the path on the guest to mount the folder. And the optional third
45
+ # argument is a set of non-required options.
46
+ # config.vm.synced_folder "../data", "/vagrant_data"
47
+ config.vm.synced_folder "~/.aws", "/home/vagrant/.aws"
48
+
49
+ config.vm.provider 'virtualbox' do |vb|
50
+ vb.memory = '1024'
51
+ vb.cpus = 2
52
+ vb.customize [
53
+ 'modifyvm', :id,
54
+ #'--vtxvpid', :on,
55
+ #'--hwvirtex', :on,
56
+ '--nestedpaging', :on,
57
+ '--largepages', :on,
58
+ '--ioapic', :on,
59
+ '--pae', :on,
60
+ '--paravirtprovider', :kvm
61
+ ]
62
+ end
63
+
64
+ #
65
+ # View the documentation for the provider you are using for more
66
+ # information on available options.
67
+
68
+ # Enable provisioning with a shell script. Additional provisioners such as
69
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
70
+ # documentation for more information about their specific syntax and use.
71
+ # config.vm.provision "shell", inline: <<-SHELL
72
+ # apt-get update
73
+ # apt-get install -y apache2
74
+ # SHELL
75
+
76
+ config.vm.provision "shell", inline: <<-SHELL
77
+ yum clean all
78
+ yum update -y
79
+ yum -y install epel-release centos-release-scl-rh
80
+ yum -y install jq git
81
+ yum -y --enablerepo=centos-sclo-rh install rh-ruby26
82
+ ln -s /opt/rh/rh-ruby26/enable /etc/profile.d/rh-ruby26.sh
83
+ source /etc/profile.d/rh-ruby26.sh
84
+ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
85
+ python get-pip.py
86
+ pip install awscli
87
+ gem install cfndk -V
88
+ SHELL
89
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshihisa AMAKATA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-21 00:00:00.000000000 Z
11
+ date: 2021-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: aruba
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: aruba
56
+ name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: simplecov
70
+ name: awspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: awspec
84
+ name: parallel_tests
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,13 +95,13 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: parallel_tests
98
+ name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
- type: :development
104
+ type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
@@ -137,7 +137,49 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: aws-sdk
140
+ name: rubyzip
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 1.3.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 1.3.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: aws-sdk-ec2
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: aws-sdk-s3
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: aws-sdk-cloudformation
141
183
  requirement: !ruby/object:Gem::Requirement
142
184
  requirements:
143
185
  - - ">="
@@ -178,6 +220,34 @@ dependencies:
178
220
  - - ">="
179
221
  - !ruby/object:Gem::Version
180
222
  version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: diff-lcs
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: polyfill
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
181
251
  description: cfndk is AWS Cloud Formation Development Kit
182
252
  email:
183
253
  - amakata@gmail.com
@@ -188,6 +258,7 @@ extra_rdoc_files: []
188
258
  files:
189
259
  - ".circleci/config.yml"
190
260
  - ".gitignore"
261
+ - ".rspec"
191
262
  - ".rspec_parallel"
192
263
  - ".rubocop.yml"
193
264
  - ".simplecov"
@@ -198,11 +269,16 @@ files:
198
269
  - Rakefile
199
270
  - bin/cfndk
200
271
  - cfndk.gemspec
272
+ - docker/Dockerfile
273
+ - docker/build.sh
274
+ - docker/cfndk.sh
201
275
  - lib/cfndk.rb
202
276
  - lib/cfndk/change_set_command.rb
203
277
  - lib/cfndk/command.rb
204
278
  - lib/cfndk/config_file_loadable.rb
205
279
  - lib/cfndk/credential_provider_chain.rb
280
+ - lib/cfndk/credential_resolvable.rb
281
+ - lib/cfndk/diff.rb
206
282
  - lib/cfndk/erb_string.rb
207
283
  - lib/cfndk/global_config.rb
208
284
  - lib/cfndk/key_pair.rb
@@ -213,6 +289,8 @@ files:
213
289
  - lib/cfndk/stack_command.rb
214
290
  - lib/cfndk/stacks.rb
215
291
  - lib/cfndk/subcommand_help_returnable.rb
292
+ - lib/cfndk/template_packager.rb
293
+ - lib/cfndk/uuid.rb
216
294
  - lib/cfndk/version.rb
217
295
  - skel/cfndk.yml
218
296
  - skel/db/db.yaml
@@ -246,19 +324,33 @@ files:
246
324
  - spec/cfndk_stack_report_spec.rb
247
325
  - spec/cfndk_stack_spec.rb
248
326
  - spec/cfndk_stack_update_spec.rb
327
+ - spec/fixtures/big_vpc.yaml
249
328
  - spec/fixtures/empty_resource.yaml
250
329
  - spec/fixtures/iam.json
251
330
  - spec/fixtures/iam.yaml
252
331
  - spec/fixtures/iam_different.json
253
332
  - spec/fixtures/invalid_vpc.yaml
333
+ - spec/fixtures/lambda_function/index.js
334
+ - spec/fixtures/lambda_function/lambda_function.json
335
+ - spec/fixtures/lambda_function/lambda_function.yaml
336
+ - spec/fixtures/nested_stack.json
337
+ - spec/fixtures/nested_stack.yaml
338
+ - spec/fixtures/serverless_function/index.js
339
+ - spec/fixtures/serverless_function/serverless_function.json
340
+ - spec/fixtures/serverless_function/serverless_function.yaml
254
341
  - spec/fixtures/sg.json
255
342
  - spec/fixtures/sg.yaml
256
343
  - spec/fixtures/sg_different.yaml
344
+ - spec/fixtures/stack.json
345
+ - spec/fixtures/stack.template.json
346
+ - spec/fixtures/stack.yaml
257
347
  - spec/fixtures/vpc.json
348
+ - spec/fixtures/vpc.template.json
258
349
  - spec/fixtures/vpc.yaml
259
350
  - spec/fixtures/vpc_different.yaml
260
351
  - spec/spec_helper.rb
261
352
  - spec/support/aruba.rb
353
+ - vagrant/Vagrantfile
262
354
  homepage: https://github.com/Amakata/cfndk
263
355
  licenses:
264
356
  - http://www.apache.org/licenses/license-2.0
@@ -278,8 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
370
  - !ruby/object:Gem::Version
279
371
  version: '0'
280
372
  requirements: []
281
- rubyforge_project:
282
- rubygems_version: 2.5.1
373
+ rubygems_version: 3.1.2
283
374
  signing_key:
284
375
  specification_version: 4
285
376
  summary: cfndk is AWS Cloud Formation Development Kit
@@ -300,15 +391,28 @@ test_files:
300
391
  - spec/cfndk_stack_report_spec.rb
301
392
  - spec/cfndk_stack_spec.rb
302
393
  - spec/cfndk_stack_update_spec.rb
394
+ - spec/fixtures/big_vpc.yaml
303
395
  - spec/fixtures/empty_resource.yaml
304
396
  - spec/fixtures/iam.json
305
397
  - spec/fixtures/iam.yaml
306
398
  - spec/fixtures/iam_different.json
307
399
  - spec/fixtures/invalid_vpc.yaml
400
+ - spec/fixtures/lambda_function/index.js
401
+ - spec/fixtures/lambda_function/lambda_function.json
402
+ - spec/fixtures/lambda_function/lambda_function.yaml
403
+ - spec/fixtures/nested_stack.json
404
+ - spec/fixtures/nested_stack.yaml
405
+ - spec/fixtures/serverless_function/index.js
406
+ - spec/fixtures/serverless_function/serverless_function.json
407
+ - spec/fixtures/serverless_function/serverless_function.yaml
308
408
  - spec/fixtures/sg.json
309
409
  - spec/fixtures/sg.yaml
310
410
  - spec/fixtures/sg_different.yaml
411
+ - spec/fixtures/stack.json
412
+ - spec/fixtures/stack.template.json
413
+ - spec/fixtures/stack.yaml
311
414
  - spec/fixtures/vpc.json
415
+ - spec/fixtures/vpc.template.json
312
416
  - spec/fixtures/vpc.yaml
313
417
  - spec/fixtures/vpc_different.yaml
314
418
  - spec/spec_helper.rb