kitchen-pulumi 0.1.1 → 0.2.0

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: bef54f1efc387dfe35e325959ecccb66b21d8e8c5073b3d29b6d525f22c4ffd1
4
- data.tar.gz: b2452427f21971500e1c1a426b59c5ba079c2ca03694b5d2cd10753e9c788112
3
+ metadata.gz: a4a60b8665fa071e284264d175c23f1b48473a55b6df136a8612b37f6e749c6b
4
+ data.tar.gz: da5c21dda536dd9f821954b9eb684657ae69eeeab579b724d80afc5e30d94404
5
5
  SHA512:
6
- metadata.gz: cf7d2e24412bbff79c4405d5bf1c2d0e377c7bb2e16ba273c053bbd93403094930a6179e7482fa22ebb9f506990670a3ce379ec41999c2e28219e40266f55cc6
7
- data.tar.gz: d0d04b21f872eb55305c728d11682913d69673ed163e73f2d84e050a3c7ce8a340ffc1e2b672710f37fafe0e4e622ae1e3a1b8e621e462f7417e4df8f0d9910f
6
+ metadata.gz: 10be33e1ce1e9e6d6c17c25aff2e0d2609b16bc9b5968469f75a7da47320f3f15e8d124a5e0fcc7fb239e80af1065ab37e9ed3074616b94fa0cd26893f999d0e
7
+ data.tar.gz: 855a59728c1c2ec80664815e229df6b220190bce28db008803c2c105b2134e7eb2c31a8304bfe6647839ef3047953d7c02280c6afe1be65848daedf3ca07d19d
@@ -48,7 +48,7 @@ module Kitchen
48
48
  include ::Kitchen::Pulumi::ConfigAttribute::SecretsProvider
49
49
  include ::Kitchen::Pulumi::ConfigAttribute::PreserveConfig
50
50
 
51
- # Initializes a stack via `pulumi stack init`
51
+ # Initializes a stack via `pulumi stack init` & run a preview of changes
52
52
  #
53
53
  # @param _state [::Hash] the current kitchen state
54
54
  # @return [void]
@@ -56,13 +56,23 @@ module Kitchen
56
56
  dir = "-C #{config_directory}"
57
57
  login
58
58
  initialize_stack(stack, dir)
59
+
60
+ ::Kitchen::Pulumi.with_temp_conf(config_file) do |temp_conf_file|
61
+ refresh_config(stack, temp_conf_file, dir) if config_refresh_config
62
+ configure(config_config, stack, temp_conf_file, dir)
63
+ configure(config_secrets, stack, temp_conf_file, dir, is_secret: true)
64
+ preview_stack(stack, temp_conf_file, dir)
65
+ end
59
66
  end
60
67
 
61
68
  # Sets stack config values via `pulumi config` and updates the stack via `pulumi up`
62
69
  #
63
70
  # @param _state [::Hash] the current kitchen state
64
71
  # @param config_only [Boolean] specify true to update the stack config without
65
- # applying changes to the stack via `pulumi up`
72
+ # applying changes to the stack via `pulumi up`. This is used primarily for
73
+ # setting the correct stack inputs by successively applying `pulumi config` in
74
+ # the order of precedence for specifying stack config values in the config file or
75
+ # kitchen.yml file.
66
76
  #
67
77
  # for block {|temp_conf_file| ...}
68
78
  # @yield [temp_conf_file] provides the path to the temporary config file used
@@ -229,6 +239,20 @@ module Kitchen
229
239
  )
230
240
  end
231
241
 
242
+ # Preview effects of `pulumi up`
243
+ #
244
+ # @param stack [String] name of the stack being refreshed
245
+ # @param conf_file [String] path to a stack config file to use for configuration
246
+ # @param dir [String] path to the directory to run Pulumi commands in
247
+ # @return [void]
248
+ def preview_stack(stack, conf_file, dir = '')
249
+ base_cmd = "preview -r --show-config -s #{stack} #{dir}"
250
+ ::Kitchen::Pulumi::ShellOut.run(
251
+ cmd: "#{base_cmd} #{config_file(conf_file, flag: true)}",
252
+ logger: logger,
253
+ )
254
+ end
255
+
232
256
  # Evolves a stack via successive calls to `pulumi config set` and `pulumi up`
233
257
  # according to the `stack_evolution` instance attribute, if set. This permits
234
258
  # testing stack config changes over time.
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'kitchen/pulumi'
4
4
 
5
- ::Kitchen::Pulumi::VERSION = '0.1.1'
5
+ ::Kitchen::Pulumi::VERSION = '0.2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-pulumi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Learned
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -394,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
394
  - !ruby/object:Gem::Version
395
395
  version: '0'
396
396
  requirements: []
397
- rubygems_version: 3.1.4
397
+ rubygems_version: 3.1.6
398
398
  signing_key:
399
399
  specification_version: 4
400
400
  summary: Test-Kitchen plugins for Pulumi projects