ruby-terraform 0.62.0 → 0.65.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +111 -32
  3. data/README.md +29 -9
  4. data/Rakefile +81 -37
  5. data/bin/console +3 -3
  6. data/lib/ruby-terraform.rb +1 -1
  7. data/lib/ruby_terraform.rb +1 -1
  8. data/lib/ruby_terraform/commands/apply.rb +24 -24
  9. data/lib/ruby_terraform/commands/base.rb +12 -14
  10. data/lib/ruby_terraform/commands/clean.rb +2 -2
  11. data/lib/ruby_terraform/commands/destroy.rb +24 -24
  12. data/lib/ruby_terraform/commands/format.rb +0 -1
  13. data/lib/ruby_terraform/commands/get.rb +7 -8
  14. data/lib/ruby_terraform/commands/import.rb +1 -1
  15. data/lib/ruby_terraform/commands/init.rb +22 -16
  16. data/lib/ruby_terraform/commands/output.rb +1 -2
  17. data/lib/ruby_terraform/commands/plan.rb +24 -23
  18. data/lib/ruby_terraform/commands/refresh.rb +22 -21
  19. data/lib/ruby_terraform/commands/remote_config.rb +12 -12
  20. data/lib/ruby_terraform/commands/show.rb +0 -1
  21. data/lib/ruby_terraform/commands/validate.rb +20 -19
  22. data/lib/ruby_terraform/commands/workspace.rb +4 -7
  23. data/lib/ruby_terraform/errors/execution_error.rb +1 -1
  24. data/lib/ruby_terraform/version.rb +1 -1
  25. metadata +111 -43
  26. data/.circleci/config.yml +0 -56
  27. data/.circleci/gpg.private.enc +0 -0
  28. data/.envrc +0 -5
  29. data/.git-crypt/.gitattributes +0 -4
  30. data/.git-crypt/keys/default/0/41D2606F66C3FF28874362B61A16916844CE9D82.gpg +0 -0
  31. data/.git-crypt/keys/default/0/AAE932B730C2BA697FFDFAE05DA390873E38358B.gpg +0 -0
  32. data/.gitattributes +0 -1
  33. data/.gitignore +0 -31
  34. data/.rspec +0 -2
  35. data/.ruby-version +0 -1
  36. data/CHANGELOG.md +0 -44
  37. data/TODO.md +0 -1
  38. data/config/secrets/.unlocked +0 -1
  39. data/config/secrets/ci/encryption.passphrase +0 -1
  40. data/config/secrets/ci/gpg.private +0 -58
  41. data/config/secrets/ci/gpg.public +0 -31
  42. data/config/secrets/ci/ssh.private +0 -51
  43. data/config/secrets/ci/ssh.public +0 -1
  44. data/config/secrets/circle_ci/config.yaml +0 -2
  45. data/config/secrets/github/config.yaml +0 -2
  46. data/config/secrets/rubygems/credentials +0 -2
  47. data/go +0 -56
  48. data/ruby_terraform.gemspec +0 -37
  49. data/scripts/ci/common/configure-git.sh +0 -8
  50. data/scripts/ci/common/configure-rubygems.sh +0 -16
  51. data/scripts/ci/common/install-git-crypt.sh +0 -8
  52. data/scripts/ci/common/install-gpg-key.sh +0 -19
  53. data/scripts/ci/steps/prerelease.sh +0 -16
  54. data/scripts/ci/steps/release.sh +0 -18
  55. data/scripts/ci/steps/test.sh +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22bf25dd2efd16d4330e50d48f3b1db00735dbafb7c43962f57aef653c411ae2
4
- data.tar.gz: 87f64dc586399a15f60253be62831b9a8b26847fcff19bcd86fd5b423e52f884
3
+ metadata.gz: 8134ce739c38d0dc08a0ecdb0737d6227b8408809258c8eada6d95591182194d
4
+ data.tar.gz: bb5e4eeeaa9c3817ab67da0d2d2bb1b974aedb9b380934cbdc7ac633039e61c3
5
5
  SHA512:
6
- metadata.gz: 7a36781b57712b72281cec340e55ff5c43955ad6d4c9edfe8427bcb40edc39d05ac94c89e035d0303e39645f6d9cef0577acc1528b22b7c1bbab4c326a017b4f
7
- data.tar.gz: ca1e82dbab19175cd3b6bfc89cc1ee01939380907a6851288842e13de7a5d635cbd8b3fe60844fe6f2eea50eba130f1341472e2eb23c4cedbe6492a3a151ce7c
6
+ metadata.gz: e7b1373932d2c2ff94456bad7e8a96daab3a84500a509bfd3ae557193a54e00310d773fd3d99996459bf5859434b385df609a863db7e4844536a64d98c24af53
7
+ data.tar.gz: c80e73a02de20a50a8feec447b826b5a63a1a8f62b8d7e40ec89c3e4266ef8a3b2a836257bb5a005d9676d6ec0ab6238e9db15709a3b5f9d844781782b1bb796
data/Gemfile.lock CHANGED
@@ -1,95 +1,174 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-terraform (0.62.0)
4
+ ruby-terraform (0.65.0.pre.3)
5
5
  lino (>= 1.5)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (6.0.3.4)
10
+ activesupport (6.1.3.1)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (>= 0.7, < 2)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- zeitwerk (~> 2.2, >= 2.2.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
16
  addressable (2.7.0)
17
17
  public_suffix (>= 2.0.2, < 5.0)
18
+ ast (2.4.2)
19
+ coderay (1.1.3)
18
20
  colored2 (3.1.2)
19
- concurrent-ruby (1.1.7)
21
+ concurrent-ruby (1.1.8)
20
22
  diff-lcs (1.4.4)
21
- excon (0.78.0)
22
- faraday (1.1.0)
23
+ docile (1.3.5)
24
+ excon (0.79.0)
25
+ faker (2.17.0)
26
+ i18n (>= 1.6, < 2)
27
+ faraday (1.3.0)
28
+ faraday-net_http (~> 1.0)
23
29
  multipart-post (>= 1.2, < 3)
24
30
  ruby2_keywords
25
- gem-release (2.2.0)
31
+ faraday-net_http (1.0.1)
32
+ ffi (1.15.0)
33
+ formatador (0.2.5)
34
+ gem-release (2.2.1)
35
+ guard (2.16.2)
36
+ formatador (>= 0.2.4)
37
+ listen (>= 2.7, < 4.0)
38
+ lumberjack (>= 1.0.12, < 2.0)
39
+ nenv (~> 0.1)
40
+ notiffany (~> 0.0)
41
+ pry (>= 0.9.12)
42
+ shellany (~> 0.0)
43
+ thor (>= 0.18.1)
44
+ guard-compat (1.2.1)
45
+ guard-rspec (4.7.3)
46
+ guard (~> 2.1)
47
+ guard-compat (~> 1.1)
48
+ rspec (>= 2.99.0, < 4.0)
26
49
  hamster (3.0.0)
27
50
  concurrent-ruby (~> 1.0)
28
- i18n (1.8.5)
51
+ i18n (1.8.10)
29
52
  concurrent-ruby (~> 1.0)
30
- lino (1.5.0)
53
+ lino (1.9.0)
31
54
  hamster (~> 3.0)
32
55
  open4 (~> 1.3)
33
- minitest (5.14.2)
56
+ listen (3.5.1)
57
+ rb-fsevent (~> 0.10, >= 0.10.3)
58
+ rb-inotify (~> 0.9, >= 0.9.10)
59
+ lumberjack (1.2.8)
60
+ method_source (1.0.0)
61
+ minitest (5.14.4)
34
62
  multipart-post (2.1.1)
35
- octokit (4.19.0)
63
+ nenv (0.3.0)
64
+ notiffany (0.1.3)
65
+ nenv (~> 0.1)
66
+ shellany (~> 0.0)
67
+ octokit (4.20.0)
36
68
  faraday (>= 0.9)
37
69
  sawyer (~> 0.8.0, >= 0.5.3)
38
70
  open4 (1.3.4)
71
+ parallel (1.20.1)
72
+ parser (3.0.0.0)
73
+ ast (~> 2.4.1)
74
+ pry (0.14.0)
75
+ coderay (~> 1.1)
76
+ method_source (~> 1.0)
39
77
  public_suffix (4.0.6)
40
- rake (13.0.1)
41
- rake_circle_ci (0.7.0)
78
+ rainbow (3.0.0)
79
+ rake (13.0.3)
80
+ rake_circle_ci (0.9.0)
42
81
  colored2 (~> 3.1)
43
82
  excon (~> 0.72)
44
83
  rake_factory (~> 0.23)
45
84
  sshkey (~> 2.0)
46
- rake_factory (0.27.0)
85
+ rake_factory (0.29.0)
47
86
  activesupport (>= 4)
48
87
  rake (~> 13.0)
49
- rake_github (0.5.0)
88
+ rake_github (0.7.0)
50
89
  colored2 (~> 3.1)
51
90
  octokit (~> 4.16)
52
91
  rake_factory (~> 0.23)
53
92
  sshkey (~> 2.0)
54
- rake_ssh (0.4.0)
93
+ rake_gpg (0.14.0)
94
+ rake_factory (>= 0.23, < 1)
95
+ ruby_gpg2 (>= 0.6, < 1)
96
+ rake_ssh (0.6.0)
55
97
  colored2 (~> 3.1)
56
98
  rake_factory (~> 0.23)
57
99
  sshkey (~> 2.0)
100
+ rb-fsevent (0.10.4)
101
+ rb-inotify (0.10.1)
102
+ ffi (~> 1.0)
103
+ regexp_parser (2.1.1)
104
+ rexml (3.2.4)
58
105
  rspec (3.10.0)
59
106
  rspec-core (~> 3.10.0)
60
107
  rspec-expectations (~> 3.10.0)
61
108
  rspec-mocks (~> 3.10.0)
62
- rspec-core (3.10.0)
109
+ rspec-core (3.10.1)
63
110
  rspec-support (~> 3.10.0)
64
- rspec-expectations (3.10.0)
111
+ rspec-expectations (3.10.1)
65
112
  diff-lcs (>= 1.2.0, < 2.0)
66
113
  rspec-support (~> 3.10.0)
67
- rspec-mocks (3.10.0)
114
+ rspec-mocks (3.10.2)
68
115
  diff-lcs (>= 1.2.0, < 2.0)
69
116
  rspec-support (~> 3.10.0)
70
- rspec-support (3.10.0)
71
- ruby2_keywords (0.0.2)
117
+ rspec-support (3.10.2)
118
+ rubocop (1.12.0)
119
+ parallel (~> 1.10)
120
+ parser (>= 3.0.0.0)
121
+ rainbow (>= 2.2.2, < 4.0)
122
+ regexp_parser (>= 1.8, < 3.0)
123
+ rexml
124
+ rubocop-ast (>= 1.2.0, < 2.0)
125
+ ruby-progressbar (~> 1.7)
126
+ unicode-display_width (>= 1.4.0, < 3.0)
127
+ rubocop-ast (1.4.1)
128
+ parser (>= 2.7.1.5)
129
+ rubocop-rspec (2.2.0)
130
+ rubocop (~> 1.0)
131
+ rubocop-ast (>= 1.1.0)
132
+ ruby-progressbar (1.11.0)
133
+ ruby2_keywords (0.0.4)
134
+ ruby_gpg2 (0.8.0)
135
+ lino (>= 1.5)
72
136
  sawyer (0.8.2)
73
137
  addressable (>= 2.3.5)
74
138
  faraday (> 0.8, < 2.0)
139
+ shellany (0.0.1)
140
+ simplecov (0.21.2)
141
+ docile (~> 1.1)
142
+ simplecov-html (~> 0.11)
143
+ simplecov_json_formatter (~> 0.1)
144
+ simplecov-html (0.12.3)
145
+ simplecov_json_formatter (0.1.2)
75
146
  sshkey (2.0.0)
76
- thread_safe (0.3.6)
77
- tzinfo (1.2.8)
78
- thread_safe (~> 0.1)
79
- zeitwerk (2.4.1)
147
+ thor (1.1.0)
148
+ tzinfo (2.0.4)
149
+ concurrent-ruby (~> 1.0)
150
+ unicode-display_width (2.0.0)
151
+ zeitwerk (2.4.2)
80
152
 
81
153
  PLATFORMS
82
154
  ruby
83
155
 
84
156
  DEPENDENCIES
85
157
  bundler (~> 2.0)
158
+ faker (~> 2.17)
86
159
  gem-release (~> 2.1)
160
+ guard (~> 2.16)
161
+ guard-rspec (~> 4.7)
87
162
  rake (~> 13.0)
88
- rake_circle_ci (~> 0.3)
89
- rake_github (~> 0.3)
90
- rake_ssh (~> 0.2)
163
+ rake_circle_ci (~> 0.9)
164
+ rake_github (~> 0.5)
165
+ rake_gpg (~> 0.12)
166
+ rake_ssh (~> 0.4)
91
167
  rspec (~> 3.9)
168
+ rubocop (~> 1.12)
169
+ rubocop-rspec (~> 2.2)
92
170
  ruby-terraform!
171
+ simplecov (~> 0.21)
93
172
 
94
173
  BUNDLED WITH
95
- 2.1.4
174
+ 2.2.15
data/README.md CHANGED
@@ -467,7 +467,7 @@ RubyTerraform.workspace(operation: 'delete', workspace: 'staging')
467
467
  arguments:
468
468
  * `directory`: the directory containing terraform configuration, the default is
469
469
  the current path.
470
- * `operation`: `list`, `select`, `new` or `delete`. default `list`.
470
+ * `operation`: `list`, `select`, `new` or `delete`. default `list`.
471
471
  * `workspace`: Workspace name.
472
472
 
473
473
 
@@ -551,15 +551,35 @@ interactive input from the terminal.
551
551
 
552
552
  ## Development
553
553
 
554
- After checking out the repo, run `bin/setup` to install dependencies. Then,
555
- run `rake spec` to run the tests. You can also run `bin/console` for an
556
- interactive prompt that will allow you to experiment.
554
+ To install dependencies and run the build, run the pre-commit build:
557
555
 
558
- To install this gem onto your local machine, run `bundle exec rake install`. To
559
- release a new version, update the version number in `version.rb`, and then run
560
- `bundle exec rake release`, which will create a git tag for the version, push
561
- git commits and tags, and push the `.gem` file to
562
- [rubygems.org](https://rubygems.org).
556
+ ```shell script
557
+ ./go
558
+ ```
559
+
560
+ This runs all unit tests and other checks including coverage and code linting /
561
+ formatting.
562
+
563
+ To run only the unit tests, including coverage:
564
+
565
+ ```shell script
566
+ ./go test:unit
567
+ ```
568
+
569
+ To attempt to fix any code linting / formatting issues:
570
+
571
+ ```shell script
572
+ ./go library:fix
573
+ ```
574
+
575
+ To check for code linting / formatting issues without fixing:
576
+
577
+ ```shell script
578
+ ./go library:check
579
+ ```
580
+
581
+ You can also run `bin/console` for an interactive prompt that will allow you to
582
+ experiment.
563
583
 
564
584
  ### Managing CircleCI keys
565
585
 
data/Rakefile CHANGED
@@ -2,78 +2,122 @@ require 'yaml'
2
2
  require 'rake_circle_ci'
3
3
  require 'rake_github'
4
4
  require 'rake_ssh'
5
+ require 'rake_gpg'
6
+ require 'securerandom'
5
7
  require 'rspec/core/rake_task'
8
+ require 'rubocop/rake_task'
6
9
 
7
- task :default => :spec
10
+ task default: [
11
+ #:'library:fix',
12
+ :'test:unit'
13
+ ]
8
14
 
9
- RSpec::Core::RakeTask.new(:spec)
15
+ namespace :encryption do
16
+ namespace :passphrase do
17
+ task :generate do
18
+ File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
19
+ f.write(SecureRandom.base64(36))
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ namespace :keys do
26
+ namespace :deploy do
27
+ RakeSSH.define_key_tasks(
28
+ path: 'config/secrets/ci/',
29
+ comment: 'maintainers@infrablocks.io'
30
+ )
31
+ end
32
+
33
+ namespace :gpg do
34
+ RakeGPG.define_generate_key_task(
35
+ output_directory: 'config/secrets/ci',
36
+ name_prefix: 'gpg',
37
+ owner_name: 'InfraBlocks Maintainers',
38
+ owner_email: 'maintainers@infrablocks.io',
39
+ owner_comment: 'ruby_terraform CI Key'
40
+ )
41
+ end
42
+ end
43
+
44
+ RuboCop::RakeTask.new
45
+
46
+ namespace :library do
47
+ desc 'Run all checks of the library'
48
+ task check: [:rubocop]
10
49
 
11
- RakeSSH.define_key_tasks(
12
- namespace: :deploy_key,
13
- path: 'config/secrets/ci/',
14
- comment: 'maintainers@infrablocks.io'
15
- )
50
+ desc 'Attempt to automatically fix issues with the library'
51
+ task fix: [:'rubocop:auto_correct']
52
+ end
53
+
54
+ namespace :test do
55
+ RSpec::Core::RakeTask.new(:unit)
56
+ end
16
57
 
17
58
  RakeCircleCI.define_project_tasks(
18
- namespace: :circle_ci,
19
- project_slug: 'github/infrablocks/ruby_terraform'
59
+ namespace: :circle_ci,
60
+ project_slug: 'github/infrablocks/ruby_terraform'
20
61
  ) do |t|
21
62
  circle_ci_config =
22
- YAML.load_file('config/secrets/circle_ci/config.yaml')
63
+ YAML.load_file('config/secrets/circle_ci/config.yaml')
23
64
 
24
- t.api_token = circle_ci_config["circle_ci_api_token"]
65
+ t.api_token = circle_ci_config['circle_ci_api_token']
25
66
  t.environment_variables = {
26
- ENCRYPTION_PASSPHRASE:
27
- File.read('config/secrets/ci/encryption.passphrase')
28
- .chomp
67
+ ENCRYPTION_PASSPHRASE:
68
+ File.read('config/secrets/ci/encryption.passphrase')
69
+ .chomp
29
70
  }
71
+ t.checkout_keys = []
30
72
  t.ssh_keys = [
31
- {
32
- hostname: "github.com",
33
- private_key: File.read('config/secrets/ci/ssh.private')
34
- }
73
+ {
74
+ hostname: 'github.com',
75
+ private_key: File.read('config/secrets/ci/ssh.private')
76
+ }
35
77
  ]
36
78
  end
37
79
 
38
80
  RakeGithub.define_repository_tasks(
39
- namespace: :github,
40
- repository: 'infrablocks/ruby_terraform',
81
+ namespace: :github,
82
+ repository: 'infrablocks/ruby_terraform'
41
83
  ) do |t|
42
84
  github_config =
43
- YAML.load_file('config/secrets/github/config.yaml')
85
+ YAML.load_file('config/secrets/github/config.yaml')
44
86
 
45
- t.access_token = github_config["github_personal_access_token"]
87
+ t.access_token = github_config['github_personal_access_token']
46
88
  t.deploy_keys = [
47
- {
48
- title: 'CircleCI',
49
- public_key: File.read('config/secrets/ci/ssh.public')
50
- }
89
+ {
90
+ title: 'CircleCI',
91
+ public_key: File.read('config/secrets/ci/ssh.public')
92
+ }
51
93
  ]
52
94
  end
53
95
 
54
96
  namespace :pipeline do
55
- task :prepare => [
56
- :'circle_ci:env_vars:ensure',
57
- :'circle_ci:ssh_keys:ensure',
58
- :'github:deploy_keys:ensure'
97
+ task prepare: %i[
98
+ circle_ci:project:follow
99
+ circle_ci:env_vars:ensure
100
+ circle_ci:checkout_keys:ensure
101
+ circle_ci:ssh_keys:ensure
102
+ github:deploy_keys:ensure
59
103
  ]
60
104
  end
61
105
 
62
106
  namespace :version do
63
- desc "Bump version for specified type (pre, major, minor, patch)"
107
+ desc 'Bump version for specified type (pre, major, minor, patch)'
64
108
  task :bump, [:type] do |_, args|
65
109
  bump_version_for(args.type)
66
110
  end
67
111
  end
68
112
 
69
- desc "Release gem"
113
+ desc 'Release gem'
70
114
  task :release do
71
- sh "gem release --tag --push"
115
+ sh 'gem release --tag --push'
72
116
  end
73
117
 
74
118
  def bump_version_for(version_type)
75
- sh "gem bump --version #{version_type} " +
76
- "&& bundle install " +
77
- "&& export LAST_MESSAGE=\"$(git log -1 --pretty=%B)\" " +
78
- "&& git commit -a --amend -m \"${LAST_MESSAGE} [ci skip]\""
119
+ sh "gem bump --version #{version_type} " \
120
+ '&& bundle install ' \
121
+ '&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
122
+ '&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
79
123
  end
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "ruby_terraform"
3
+ require 'bundler/setup'
4
+ require 'ruby_terraform'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "ruby_terraform"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)