rspec-terraform 0.1.0.pre.31 → 0.1.0.pre.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaa5c41415be59f0dc571fa3f26d719ef78d5e18604688ade58770f39f3b124a
4
- data.tar.gz: a27d2cef84a89423e11ddb46e117c9c37677ae54d1d23d28ba2f5d2ff5a2ac94
3
+ metadata.gz: de609f31b1c8beb997d49dfcc1424e2d2bdbd6c47f7948f6df09537229c861c5
4
+ data.tar.gz: 983c18c0cc01ebfcfeeb1c77a45bec4efa35f61620ddd45b37e6beae45af363b
5
5
  SHA512:
6
- metadata.gz: 2306fb4b85b10fb4bbe7e2bf05e9782d0a9b7c08792597c14495d1efa1819af4188878621e988fd71d06d880f928280002922fb71669359135a8e84323918043
7
- data.tar.gz: 408eff4057c23a6185aa34065ebc8f1c64aa309d2f574983a40020ec129b5747656ebf12bea469997139b7d6b37f7102d2a8ea20e17c28793f384ff2be3206e8
6
+ metadata.gz: 414ff88f26a5e8b1a3aa558d22eb145e61dadfb4a2b12780324187271e6e793be6532974e598df25e3722a7bec15371386f58c2e002a6e9dcd47efba13d69ff8
7
+ data.tar.gz: '0871db83e6adc06c8d4d9cb48bfb06ef03a81362f23790a032c59dc216473c4b1cd0eebb855a555b8f2cb86fe010d4a7e3ba2511d04227bc880a2d979f04b9d1'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.31)
4
+ rspec-terraform (0.1.0.pre.34)
5
5
  confidante (>= 0.27)
6
6
  rspec (>= 3.0)
7
7
  ruby-terraform (= 1.7.0.pre.15)
@@ -7,6 +7,7 @@ module RSpec
7
7
  module Configuration
8
8
  module Providers
9
9
  class Base
10
+ def resolve(_ = {}); end
10
11
  def reset; end
11
12
  end
12
13
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby_terraform'
4
+
5
+ require_relative './base'
6
+
7
+ module RSpec
8
+ module Terraform
9
+ module Configuration
10
+ module Providers
11
+ class Chain < Base
12
+ attr_reader(:providers)
13
+
14
+ def initialize(opts = {})
15
+ super()
16
+ @providers = opts[:providers] || []
17
+ end
18
+
19
+ def resolve(overrides = {})
20
+ providers.reduce(overrides) do |acc, provider|
21
+ provider.resolve(acc)
22
+ end
23
+ end
24
+
25
+ def reset
26
+ providers.each { |provider| provider.reset }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -4,6 +4,7 @@ require_relative 'providers/identity'
4
4
  require_relative 'providers/in_memory'
5
5
  require_relative 'providers/confidante'
6
6
  require_relative 'providers/seed'
7
+ require_relative 'providers/chain'
7
8
 
8
9
  module RSpec
9
10
  module Terraform
@@ -12,13 +12,21 @@ module RSpec
12
12
  Providers::Identity.new
13
13
  end
14
14
 
15
- def in_memory_provider(opts)
15
+ def in_memory_provider(opts = {})
16
16
  Providers::InMemory.new(opts)
17
17
  end
18
18
 
19
- def confidante_provider(opts)
19
+ def confidante_provider(opts = {})
20
20
  Providers::Confidante.new(opts)
21
21
  end
22
+
23
+ def seed_provider(opts = {})
24
+ Providers::Seed.new(opts)
25
+ end
26
+
27
+ def chain_provider(opts = {})
28
+ Providers::Chain.new(opts)
29
+ end
22
30
  end
23
31
  end
24
32
  end
@@ -15,8 +15,8 @@ module RSpec
15
15
  def initialize(opts = {})
16
16
  @configuration_provider =
17
17
  opts[:configuration_provider] || Configuration.identity_provider
18
- @binary = RSpec.configuration.terraform_binary
19
- @execution_mode = RSpec.configuration.terraform_execution_mode
18
+ @binary = opts[:binary] || 'terraform'
19
+ @execution_mode = opts[:execution_mode] || :in_place
20
20
  end
21
21
 
22
22
  def execute(overrides = {}, &block)
@@ -15,8 +15,8 @@ module RSpec
15
15
  def initialize(opts = {})
16
16
  @configuration_provider =
17
17
  opts[:configuration_provider] || Configuration.identity_provider
18
- @binary = RSpec.configuration.terraform_binary
19
- @execution_mode = RSpec.configuration.terraform_execution_mode
18
+ @binary = opts[:binary] || 'terraform'
19
+ @execution_mode = opts[:execution_mode] || :in_place
20
20
  end
21
21
 
22
22
  def execute(overrides = {}, &block)
@@ -13,8 +13,8 @@ module RSpec
13
13
  def initialize(opts = {})
14
14
  @configuration_provider =
15
15
  opts[:configuration_provider] || Configuration.identity_provider
16
- @binary = RSpec.configuration.terraform_binary
17
- @execution_mode = RSpec.configuration.terraform_execution_mode
16
+ @binary = opts[:binary] || 'terraform'
17
+ @execution_mode = opts[:execution_mode] || :in_place
18
18
  end
19
19
 
20
20
  def execute(overrides = {})
@@ -18,8 +18,8 @@ module RSpec
18
18
  def initialize(opts = {})
19
19
  @configuration_provider =
20
20
  opts[:configuration_provider] || Configuration.identity_provider
21
- @binary = RSpec.configuration.terraform_binary
22
- @execution_mode = RSpec.configuration.terraform_execution_mode
21
+ @binary = opts[:binary] || 'terraform'
22
+ @execution_mode = opts[:execution_mode] || :in_place
23
23
  end
24
24
 
25
25
  def execute(overrides = {}, &block)
@@ -9,6 +9,47 @@ require_relative './helpers/var'
9
9
  module RSpec
10
10
  module Terraform
11
11
  module Helpers
12
+ def apply(overrides = {}, &block)
13
+ RSpec::Terraform::Helpers::Apply
14
+ .new(helper_options)
15
+ .execute(overrides, &block)
16
+ end
17
+
18
+ def destroy(overrides = {}, &block)
19
+ RSpec::Terraform::Helpers::Destroy
20
+ .new(helper_options)
21
+ .execute(overrides, &block)
22
+ end
23
+
24
+ def output(overrides = {}, &block)
25
+ RSpec::Terraform::Helpers::Output
26
+ .new(helper_options)
27
+ .execute(overrides, &block)
28
+ end
29
+
30
+ def plan(overrides = {}, &block)
31
+ RSpec::Terraform::Helpers::Plan
32
+ .new(helper_options)
33
+ .execute(overrides, &block)
34
+ end
35
+
36
+ def var(overrides = {}, &block)
37
+ RSpec::Terraform::Helpers::Var
38
+ .new(helper_options)
39
+ .execute(overrides, &block)
40
+ end
41
+
42
+ private
43
+
44
+ def helper_options
45
+ config = RSpec.configuration
46
+
47
+ {
48
+ binary: config.terraform_binary,
49
+ execution_mode: config.terraform_execution_mode,
50
+ configuration_provider: config.terraform_configuration_provider
51
+ }
52
+ end
12
53
  end
13
54
  end
14
55
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.31'
5
+ VERSION = '0.1.0.pre.34'
6
6
  end
7
7
  end
@@ -8,9 +8,24 @@ require_relative 'terraform/configuration'
8
8
  require_relative 'terraform/matchers'
9
9
  require_relative 'terraform/helpers'
10
10
 
11
+ # TODO
12
+ # ====
13
+ #
14
+ # * Logging
15
+ # * Test session
16
+ # * Before support in matchers
17
+ # * Reference support in matchers
18
+ # * Sensitive support in matchers
19
+ #
20
+
11
21
  RSpec.configure do |config|
12
22
  config.include(RSpec::Terraform::Matchers)
23
+ config.include(RSpec::Terraform::Helpers)
13
24
 
14
25
  config.add_setting(:terraform_binary, default: 'terraform')
15
26
  config.add_setting(:terraform_execution_mode, default: :in_place)
27
+ config.add_setting(
28
+ :terraform_configuration_provider,
29
+ default: RSpec::Terraform::Configuration.identity_provider
30
+ )
16
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.31
4
+ version: 0.1.0.pre.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-26 00:00:00.000000000 Z
11
+ date: 2022-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: confidante
@@ -297,6 +297,7 @@ files:
297
297
  - lib/rspec/terraform/configuration/merger.rb
298
298
  - lib/rspec/terraform/configuration/providers.rb
299
299
  - lib/rspec/terraform/configuration/providers/base.rb
300
+ - lib/rspec/terraform/configuration/providers/chain.rb
300
301
  - lib/rspec/terraform/configuration/providers/confidante.rb
301
302
  - lib/rspec/terraform/configuration/providers/identity.rb
302
303
  - lib/rspec/terraform/configuration/providers/in_memory.rb