Class: Yutani::RemoteConfig
- Inherits:
-
Object
- Object
- Yutani::RemoteConfig
show all
- Includes:
- Hiera
- Defined in:
- lib/yutani/remote_config.rb
Defined Under Namespace
Classes: BackendConfig
Instance Method Summary
collapse
Methods included from Hiera
#hiera, init_hiera, lookup, pop, push, scope
Constructor Details
Returns a new instance of RemoteConfig.
9
10
11
|
# File 'lib/yutani/remote_config.rb', line 9
def initialize(&block)
Docile.dsl_eval(self, &block) if block_given?
end
|
Instance Method Details
#backend(backend_type) ⇒ Object
36
37
38
|
# File 'lib/yutani/remote_config.rb', line 36
def backend(backend_type)
@backend = backend_type
end
|
#backend_config(&block) ⇒ Object
40
41
42
|
# File 'lib/yutani/remote_config.rb', line 40
def backend_config(&block)
@backend_config = BackendConfig.new(&block)
end
|
#command ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/yutani/remote_config.rb', line 13
def command
cmds = []
cmds << "terraform remote config"
cmds << "-backend=#{@backend}"
@backend_config.fields.each do |k,v|
cmds << "-backend-config=\"#{k}=#{v}\""
end
cmds << "-pull=false"
cmds.join(' ')
end
|
#execute! ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/yutani/remote_config.rb', line 27
def execute!
_, stderr, ret_code = Open3.capture3(command)
if ret_code != 0
raise TerraformCommandError,
"running the command \"#{command}\" returned error: #{stderr}"
end
end
|