ruby-terraform 1.9.0.pre.2 → 1.9.0.pre.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c65ee46422f0dfadfbddbb77d95c836b4bf154b4b720d5dedfb3976c34db5e9a
4
- data.tar.gz: 3e09a684d61a20306e41c9449e7b4d806537c51c375af3c32bee699a73ca419d
3
+ metadata.gz: 7f785dd368c756138288d8ac5be5cce139b42549e9e33b705a88b9618671df3b
4
+ data.tar.gz: 5cf820a332f2b6db7c8edd708e3b018c9979775cd3edc22efa58fefe9c0721e4
5
5
  SHA512:
6
- metadata.gz: 602291f0a8415196453a5301134d3ad734b593863d8621aa1d036adaba87e98ea44cfd1ea147ba2d34480c13cfa0be4e17416ea85e8d38befe0ef38eceae42bc
7
- data.tar.gz: 37b5f4580722669fa1d723c12c83beefb6d727b89bb5300fc6f2f5910a460c9370fd99cb6176d64b11a1851e8107d9d4aa9bba8f6cbd02de0952df88a4ee662a
6
+ metadata.gz: 22029c8ebc37a74fee4c70bff57f027aedec45937b6a2272e3444f0d840f879167d46ec98cc3353617c75a417eba1e4ea7d867d58161b68ff3b31aeaed06e9ba
7
+ data.tar.gz: b5dd1103942436aa721155e3dbffb01e509fe9d31f9908d9f6fc1e43c3b547ff2c640889b2569822769dc7f32967f27360c58824dc09a028fbe8a2257938448c
data/Gemfile.lock CHANGED
@@ -1,56 +1,62 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-terraform (1.9.0.pre.2)
4
+ ruby-terraform (1.9.0.pre.3)
5
5
  immutable-struct (~> 2.4)
6
6
  lino (>= 4.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.1.3.4)
11
+ activesupport (7.2.3.1)
12
12
  base64
13
+ benchmark (>= 0.3)
13
14
  bigdecimal
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
16
  connection_pool (>= 2.2.5)
16
17
  drb
17
18
  i18n (>= 1.6, < 2)
18
- minitest (>= 5.1)
19
- mutex_m
20
- tzinfo (~> 2.0)
21
- addressable (2.8.7)
22
- public_suffix (>= 2.0.2, < 7.0)
23
- ast (2.4.2)
24
- base64 (0.2.0)
25
- bigdecimal (3.1.8)
19
+ logger (>= 1.4.2)
20
+ minitest (>= 5.1, < 6)
21
+ securerandom (>= 0.3)
22
+ tzinfo (~> 2.0, >= 2.0.5)
23
+ addressable (2.9.0)
24
+ public_suffix (>= 2.0.2, < 8.0)
25
+ ast (2.4.3)
26
+ base64 (0.3.0)
27
+ benchmark (0.5.0)
28
+ bigdecimal (4.0.1)
26
29
  childprocess (5.0.0)
27
30
  coderay (1.1.3)
28
31
  colored2 (3.1.2)
29
- concurrent-ruby (1.3.3)
30
- connection_pool (2.4.1)
31
- diff-lcs (1.5.1)
32
+ concurrent-ruby (1.3.6)
33
+ connection_pool (2.5.5)
34
+ diff-lcs (1.6.2)
32
35
  docile (1.4.0)
33
- drb (2.2.1)
36
+ drb (2.2.3)
34
37
  excon (0.111.0)
35
- faker (3.4.2)
38
+ faker (3.6.1)
36
39
  i18n (>= 1.8.11, < 2)
37
- faraday (2.10.0)
38
- faraday-net_http (>= 2.0, < 3.2)
40
+ faraday (2.14.1)
41
+ faraday-net_http (>= 2.0, < 3.5)
42
+ json
39
43
  logger
40
- faraday-net_http (3.1.0)
41
- net-http
42
- ffi (1.17.0)
43
- ffi (1.17.0-arm64-darwin)
44
- ffi (1.17.0-x86_64-darwin)
45
- ffi (1.17.0-x86_64-linux)
46
- formatador (1.1.0)
47
- gem-release (2.2.2)
44
+ faraday-net_http (3.4.2)
45
+ net-http (~> 0.5)
46
+ ffi (1.17.3)
47
+ ffi (1.17.3-arm64-darwin)
48
+ ffi (1.17.3-x86_64-darwin)
49
+ ffi (1.17.3-x86_64-linux-gnu)
50
+ formatador (1.2.3)
51
+ reline
52
+ gem-release (2.2.4)
48
53
  git (1.19.1)
49
54
  addressable (~> 2.8)
50
55
  rchardet (~> 1.8)
51
- guard (2.18.1)
56
+ guard (2.20.1)
52
57
  formatador (>= 0.2.4)
53
58
  listen (>= 2.7, < 4.0)
59
+ logger (~> 1.6)
54
60
  lumberjack (>= 1.0.12, < 2.0)
55
61
  nenv (~> 0.1)
56
62
  notiffany (~> 0.0)
@@ -64,26 +70,28 @@ GEM
64
70
  rspec (>= 2.99.0, < 4.0)
65
71
  hamster (3.0.0)
66
72
  concurrent-ruby (~> 1.0)
67
- i18n (1.14.5)
73
+ i18n (1.14.8)
68
74
  concurrent-ruby (~> 1.0)
69
- immutable-struct (2.4.1)
70
- json (2.7.2)
71
- language_server-protocol (3.17.0.3)
75
+ immutable-struct (2.5.0)
76
+ io-console (0.8.2)
77
+ json (2.19.2)
78
+ language_server-protocol (3.17.0.5)
72
79
  lino (4.1.0)
73
80
  childprocess (~> 5.0.0)
74
81
  hamster (~> 3.0)
75
82
  open4 (~> 1.3)
76
- listen (3.9.0)
83
+ lint_roller (1.1.0)
84
+ listen (3.10.0)
85
+ logger
77
86
  rb-fsevent (~> 0.10, >= 0.10.3)
78
87
  rb-inotify (~> 0.9, >= 0.9.10)
79
- logger (1.6.0)
80
- lumberjack (1.2.10)
88
+ logger (1.7.0)
89
+ lumberjack (1.4.2)
81
90
  method_source (1.1.0)
82
- minitest (5.24.1)
83
- mutex_m (0.2.0)
91
+ minitest (5.27.0)
84
92
  nenv (0.3.0)
85
- net-http (0.4.1)
86
- uri
93
+ net-http (0.9.1)
94
+ uri (>= 0.11.1)
87
95
  notiffany (0.1.3)
88
96
  nenv (~> 0.1)
89
97
  shellany (~> 0.0)
@@ -92,17 +100,19 @@ GEM
92
100
  faraday (>= 1, < 3)
93
101
  sawyer (~> 0.9)
94
102
  open4 (1.3.4)
95
- parallel (1.25.1)
96
- parser (3.3.4.0)
103
+ parallel (1.27.0)
104
+ parser (3.3.10.1)
97
105
  ast (~> 2.4.1)
98
106
  racc
99
- pry (0.14.2)
107
+ prism (1.9.0)
108
+ pry (0.16.0)
100
109
  coderay (~> 1.1)
101
110
  method_source (~> 1.0)
102
- public_suffix (6.0.1)
103
- racc (1.8.0)
111
+ reline (>= 0.6.0)
112
+ public_suffix (6.0.2)
113
+ racc (1.8.1)
104
114
  rainbow (3.1.1)
105
- rake (13.2.1)
115
+ rake (13.4.2)
106
116
  rake_circle_ci (0.13.0)
107
117
  colored2 (~> 3.1)
108
118
  excon (~> 0.72)
@@ -136,39 +146,42 @@ GEM
136
146
  rb-inotify (0.11.1)
137
147
  ffi (~> 1.0)
138
148
  rchardet (1.8.0)
139
- regexp_parser (2.9.2)
140
- rexml (3.3.2)
141
- strscan
142
- rspec (3.13.0)
149
+ regexp_parser (2.11.3)
150
+ reline (0.6.3)
151
+ io-console (~> 0.5)
152
+ rspec (3.13.2)
143
153
  rspec-core (~> 3.13.0)
144
154
  rspec-expectations (~> 3.13.0)
145
155
  rspec-mocks (~> 3.13.0)
146
- rspec-core (3.13.0)
156
+ rspec-core (3.13.6)
147
157
  rspec-support (~> 3.13.0)
148
- rspec-expectations (3.13.1)
158
+ rspec-expectations (3.13.5)
149
159
  diff-lcs (>= 1.2.0, < 2.0)
150
160
  rspec-support (~> 3.13.0)
151
- rspec-mocks (3.13.1)
161
+ rspec-mocks (3.13.7)
152
162
  diff-lcs (>= 1.2.0, < 2.0)
153
163
  rspec-support (~> 3.13.0)
154
- rspec-support (3.13.1)
155
- rubocop (1.65.0)
164
+ rspec-support (3.13.7)
165
+ rubocop (1.84.2)
156
166
  json (~> 2.3)
157
- language_server-protocol (>= 3.17.0)
167
+ language_server-protocol (~> 3.17.0.2)
168
+ lint_roller (~> 1.1.0)
158
169
  parallel (~> 1.10)
159
170
  parser (>= 3.3.0.2)
160
171
  rainbow (>= 2.2.2, < 4.0)
161
- regexp_parser (>= 2.4, < 3.0)
162
- rexml (>= 3.2.5, < 4.0)
163
- rubocop-ast (>= 1.31.1, < 2.0)
172
+ regexp_parser (>= 2.9.3, < 3.0)
173
+ rubocop-ast (>= 1.49.0, < 2.0)
164
174
  ruby-progressbar (~> 1.7)
165
- unicode-display_width (>= 2.4.0, < 3.0)
166
- rubocop-ast (1.31.3)
167
- parser (>= 3.3.1.0)
168
- rubocop-rake (0.6.0)
169
- rubocop (~> 1.0)
170
- rubocop-rspec (3.0.3)
171
- rubocop (~> 1.61)
175
+ unicode-display_width (>= 2.4.0, < 4.0)
176
+ rubocop-ast (1.49.0)
177
+ parser (>= 3.3.7.2)
178
+ prism (~> 1.7)
179
+ rubocop-rake (0.7.1)
180
+ lint_roller (~> 1.1)
181
+ rubocop (>= 1.72.1)
182
+ rubocop-rspec (3.9.0)
183
+ lint_roller (~> 1.1)
184
+ rubocop (~> 1.81)
172
185
  ruby-progressbar (1.13.0)
173
186
  ruby_git_crypt (0.1.0)
174
187
  immutable-struct (~> 2.4)
@@ -178,6 +191,7 @@ GEM
178
191
  sawyer (0.9.2)
179
192
  addressable (>= 2.3.5)
180
193
  faraday (>= 0.17.3, < 3)
194
+ securerandom (0.4.1)
181
195
  shellany (0.0.1)
182
196
  simplecov (0.22.0)
183
197
  docile (~> 1.1)
@@ -186,13 +200,14 @@ GEM
186
200
  simplecov-html (0.12.3)
187
201
  simplecov_json_formatter (0.1.4)
188
202
  sshkey (2.0.0)
189
- strscan (3.1.0)
190
- thor (1.3.1)
203
+ thor (1.5.0)
191
204
  tzinfo (2.0.6)
192
205
  concurrent-ruby (~> 1.0)
193
- unicode-display_width (2.5.0)
194
- uri (0.13.0)
195
- yard (0.9.36)
206
+ unicode-display_width (3.2.0)
207
+ unicode-emoji (~> 4.1)
208
+ unicode-emoji (4.2.0)
209
+ uri (1.1.1)
210
+ yard (0.9.43)
196
211
 
197
212
  PLATFORMS
198
213
  arm64-darwin-21
data/README.md CHANGED
@@ -29,7 +29,7 @@ require 'ruby-terraform'
29
29
 
30
30
  ### Supported versions and commands
31
31
 
32
- `RubyTerraform` supports all commands and options up to Terraform 0.15, except
32
+ `RubyTerraform` supports all commands and options up to Terraform 1.5.7, except
33
33
  `terraform console`, `terraform test` and `terraform version`.
34
34
 
35
35
  ### Getting started
data/Rakefile CHANGED
@@ -135,7 +135,7 @@ namespace :documentation do
135
135
 
136
136
  sh('git', 'commit',
137
137
  '-a',
138
- '-m', "Generate latest documentation#{skip_ci ? ' [ci skip]' : ''}")
138
+ '-m', "Generate latest documentation#{' [ci skip]' if skip_ci}")
139
139
  end
140
140
 
141
141
  desc 'Update documentation'
@@ -157,7 +157,7 @@ RakeCircleCI.define_project_tasks(
157
157
  t.environment_variables = {
158
158
  ENCRYPTION_PASSPHRASE:
159
159
  File.read('config/secrets/ci/encryption.passphrase')
160
- .chomp
160
+ .chomp
161
161
  }
162
162
  t.checkout_keys = []
163
163
  t.ssh_keys = [
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base'
4
+ require_relative '../options/global'
5
+
6
+ module RubyTerraform
7
+ module Commands
8
+ # Wraps the +terraform test+ command which executes automated integration
9
+ # tests defined in +.tftest.hcl+ files.
10
+ #
11
+ # Terraform discovers test files in the configured test directory (by
12
+ # default +tests+) and in the root module, then runs each +run+ block in
13
+ # turn, reporting on the outcome of the assertions.
14
+ #
15
+ # For options accepted on construction, see {#initialize}.
16
+ #
17
+ # When executing an instance of {Test} via {#execute}, the following
18
+ # options are supported:
19
+ #
20
+ # * +:chdir+: the path of a working directory to switch to before executing
21
+ # the given subcommand.
22
+ # * +:cloud_run+: if set, executes the tests remotely using the given
23
+ # Terraform Cloud/Enterprise module source address rather than running
24
+ # them locally.
25
+ # * +:filter+: restrict which test files are executed; if both +:filter+
26
+ # and +:filters+ are provided, all filters will be passed to terraform.
27
+ # * +:filters+: an array of test file paths to restrict which test files
28
+ # are executed; if both +:filter+ and +:filters+ are provided, all
29
+ # filters will be passed to terraform.
30
+ # * +:json+: whether or not to produce output in a machine-readable JSON
31
+ # format; defaults to +false+.
32
+ # * +:no_color+: whether or not the output from the command should be in
33
+ # color; defaults to +false+.
34
+ # * +:test_directory+: the directory containing test files; defaults to
35
+ # +"tests"+.
36
+ # * +:vars+: a map of variables to be passed to the terraform configuration.
37
+ # * +:var_file+: the path to a terraform var file; if both +:var_file+ and
38
+ # +:var_files+ are provided, all var files will be passed to terraform.
39
+ # * +:var_files+: an array of paths to terraform var files; if both
40
+ # +:var_file+ and +:var_files+ are provided, all var files will be passed
41
+ # to terraform.
42
+ # * +:verbose+: when +true+, print the plan or state for each test run
43
+ # block as it executes; defaults to +false+.
44
+ #
45
+ # The {#execute} method accepts an optional second parameter which is a map
46
+ # of invocation options. Currently, the only supported option is
47
+ # +:environment+ which is a map of environment variables to expose during
48
+ # invocation of the command.
49
+ #
50
+ # @example Basic Invocation
51
+ # RubyTerraform::Commands::Test.new.execute(
52
+ # filters: ['tests/network.tftest.hcl'],
53
+ # verbose: true)
54
+ #
55
+ class Test < Base
56
+ include RubyTerraform::Options::Global
57
+
58
+ # @!visibility private
59
+ def subcommands
60
+ %w[test]
61
+ end
62
+
63
+ # @!visibility private
64
+ def options
65
+ %w[
66
+ -cloud-run
67
+ -filter
68
+ -json
69
+ -no-color
70
+ -test-directory
71
+ -var
72
+ -var-file
73
+ -verbose
74
+ ] + super
75
+ end
76
+
77
+ # @!visibility private
78
+ def parameter_defaults(_parameters)
79
+ { vars: {}, var_files: [], filters: [] }
80
+ end
81
+ end
82
+ end
83
+ end
@@ -26,6 +26,7 @@ require_relative 'commands/state_replace_provider'
26
26
  require_relative 'commands/state_remove'
27
27
  require_relative 'commands/state_show'
28
28
  require_relative 'commands/taint'
29
+ require_relative 'commands/test'
29
30
  require_relative 'commands/untaint'
30
31
  require_relative 'commands/validate'
31
32
  require_relative 'commands/workspace_delete'
@@ -29,7 +29,7 @@ module RubyTerraform
29
29
  :repeated_permutation, :repeated_combination,
30
30
  :product, :take, :take_while, :drop, :drop_while,
31
31
  :bsearch, :bsearch_index, :any?, :all?, :none?, :one?, :dig, :sum,
32
- :deconstruct, :append, :prepend, :shuffle!, :shuffle, :sample, :pack
32
+ :deconstruct, :prepend, :shuffle!, :shuffle, :sample, :pack
33
33
  )
34
34
 
35
35
  def initialize(value, sensitive: false)
@@ -32,7 +32,7 @@ module RubyTerraform
32
32
  def resource_changes
33
33
  (@content[:resource_changes] || [])
34
34
  .map do |resource_change|
35
- ResourceChange.new(resource_change)
35
+ ResourceChange.new(resource_change)
36
36
  end
37
37
  end
38
38
 
@@ -47,7 +47,7 @@ module RubyTerraform
47
47
  def output_changes
48
48
  (@content[:output_changes] || [])
49
49
  .map do |output_name, output_change|
50
- OutputChange.new(output_name, output_change)
50
+ OutputChange.new(output_name, output_change)
51
51
  end
52
52
  end
53
53
 
@@ -22,7 +22,7 @@ module RubyTerraform
22
22
  end,
23
23
 
24
24
  # string repeatable options
25
- %w[-var-file -target -platform -plugin-dir -replace].map do |o|
25
+ %w[-var-file -target -platform -plugin-dir -replace -filter].map do |o|
26
26
  definition(
27
27
  name: o, option_type: :standard, value_type: :string,
28
28
  repeatable: true
@@ -68,6 +68,7 @@ module RubyTerraform
68
68
  -reconfigure
69
69
  -recursive
70
70
  -update
71
+ -verbose
71
72
  ].map do |o|
72
73
  definition(name: o, option_type: :flag, value_type: :boolean)
73
74
  end,
@@ -76,6 +77,7 @@ module RubyTerraform
76
77
  %w[
77
78
  -backup
78
79
  -backup-out
80
+ -cloud-run
79
81
  -from-module
80
82
  -fs-mirror
81
83
  -id
@@ -88,6 +90,7 @@ module RubyTerraform
88
90
  -provider
89
91
  -state
90
92
  -state-out
93
+ -test-directory
91
94
  -type
92
95
  ].map do |o|
93
96
  definition(name: o, option_type: :standard, value_type: :string)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyTerraform
4
- VERSION = '1.9.0.pre.2'
4
+ VERSION = '1.9.0.pre.3'
5
5
  end
@@ -1316,6 +1316,56 @@ module RubyTerraform
1316
1316
  parameters, invocation_options)
1317
1317
  end
1318
1318
 
1319
+ # Invokes the +terraform test+ command which executes integration tests
1320
+ # defined in +.tftest.hcl+ files.
1321
+ #
1322
+ # Terraform discovers test files in the configured test directory (by
1323
+ # default +tests+) and in the root module, then runs each +run+ block in
1324
+ # turn, reporting on the outcome of the assertions.
1325
+ #
1326
+ # @param parameters The parameters used to invoke the command
1327
+ # @option parameters [String] :chdir The path of a working directory to
1328
+ # switch to before executing the given subcommand.
1329
+ # @option parameters [String] :cloud_run If set, executes the tests
1330
+ # remotely using the given Terraform Cloud/Enterprise module source
1331
+ # address rather than running them locally.
1332
+ # @option parameters [String] :filter Restrict which test files are
1333
+ # executed; if both +:filter+ and +:filters+ are provided, all filters
1334
+ # will be passed to terraform.
1335
+ # @option parameters [Array<String>] :filters An array of test file paths
1336
+ # to restrict which test files are executed; if both +:filter+ and
1337
+ # +:filters+ are provided, all filters will be passed to terraform.
1338
+ # @option parameters [Boolean] :json (false) Whether or not to produce
1339
+ # output in a machine-readable JSON format.
1340
+ # @option parameters [Boolean] :no_color (false) Whether or not the output
1341
+ # from the command should be in color.
1342
+ # @option parameters [String] :test_directory The directory containing
1343
+ # test files; defaults to +"tests"+.
1344
+ # @option parameters [Hash<String, Object>] :vars A map of variables to
1345
+ # be passed to the terraform configuration.
1346
+ # @option parameters [String] :var_file The path to a terraform var file;
1347
+ # if both +:var_file+ and +:var_files+ are provided, all var files will
1348
+ # be passed to terraform.
1349
+ # @option parameters [Array<String>] :var_files An array of paths to
1350
+ # terraform var files; if both +:var_file+ and +:var_files+ are
1351
+ # provided, all var files will be passed to terraform.
1352
+ # @option parameters [Boolean] :verbose (false) When +true+, prints the
1353
+ # plan or state for each test run block as it executes.
1354
+ # @param [Hash<String, Object>] invocation_options Additional options
1355
+ # controlling the invocation of the command.
1356
+ # @option invocation_options [Hash<String, String>] :environment A map
1357
+ # of environment variables to expose at command invocation time.
1358
+ #
1359
+ # @example Basic Invocation
1360
+ # RubyTerraform.test(
1361
+ # filters: ['tests/network.tftest.hcl'],
1362
+ # verbose: true)
1363
+ #
1364
+ def test(parameters = {}, invocation_options = {})
1365
+ exec(RubyTerraform::Commands::Test,
1366
+ parameters, invocation_options)
1367
+ end
1368
+
1319
1369
  # Invokes the +terraform untaint+ command which removes the 'tainted' state
1320
1370
  # from a resource instance.
1321
1371
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.pre.2
4
+ version: 1.9.0.pre.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2026-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: immutable-struct
@@ -336,6 +336,7 @@ files:
336
336
  - lib/ruby_terraform/commands/state_replace_provider.rb
337
337
  - lib/ruby_terraform/commands/state_show.rb
338
338
  - lib/ruby_terraform/commands/taint.rb
339
+ - lib/ruby_terraform/commands/test.rb
339
340
  - lib/ruby_terraform/commands/untaint.rb
340
341
  - lib/ruby_terraform/commands/validate.rb
341
342
  - lib/ruby_terraform/commands/workspace_delete.rb
@@ -383,7 +384,7 @@ licenses:
383
384
  - MIT
384
385
  metadata:
385
386
  rubygems_mfa_required: 'false'
386
- post_install_message:
387
+ post_install_message:
387
388
  rdoc_options: []
388
389
  require_paths:
389
390
  - lib
@@ -398,8 +399,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
399
  - !ruby/object:Gem::Version
399
400
  version: 1.3.1
400
401
  requirements: []
401
- rubygems_version: 3.3.7
402
- signing_key:
402
+ rubygems_version: 3.4.19
403
+ signing_key:
403
404
  specification_version: 4
404
405
  summary: A simple Ruby wrapper for invoking Terraform commands.
405
406
  test_files: []