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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rspec/terraform/configuration/providers/base.rb +1 -0
- data/lib/rspec/terraform/configuration/providers/chain.rb +32 -0
- data/lib/rspec/terraform/configuration/providers.rb +1 -0
- data/lib/rspec/terraform/configuration.rb +10 -2
- data/lib/rspec/terraform/helpers/apply.rb +2 -2
- data/lib/rspec/terraform/helpers/destroy.rb +2 -2
- data/lib/rspec/terraform/helpers/output.rb +2 -2
- data/lib/rspec/terraform/helpers/plan.rb +2 -2
- data/lib/rspec/terraform/helpers.rb +41 -0
- data/lib/rspec/terraform/version.rb +1 -1
- data/lib/rspec/terraform.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de609f31b1c8beb997d49dfcc1424e2d2bdbd6c47f7948f6df09537229c861c5
|
4
|
+
data.tar.gz: 983c18c0cc01ebfcfeeb1c77a45bec4efa35f61620ddd45b37e6beae45af363b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 414ff88f26a5e8b1a3aa558d22eb145e61dadfb4a2b12780324187271e6e793be6532974e598df25e3722a7bec15371386f58c2e002a6e9dcd47efba13d69ff8
|
7
|
+
data.tar.gz: '0871db83e6adc06c8d4d9cb48bfb06ef03a81362f23790a032c59dc216473c4b1cd0eebb855a555b8f2cb86fe010d4a7e3ba2511d04227bc880a2d979f04b9d1'
|
data/Gemfile.lock
CHANGED
@@ -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
|
@@ -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 =
|
19
|
-
@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 =
|
19
|
-
@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 =
|
17
|
-
@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 =
|
22
|
-
@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
|
data/lib/rspec/terraform.rb
CHANGED
@@ -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.
|
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-
|
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
|