Class: Terraspace::Terraform::Tfc::Syncer
Instance Method Summary
collapse
Methods included from Util::Sure
#sure?
#cache_dirs, #dirs, #local_paths, #mod_names, #select_stack?, #stack_names, #with_each_mod
Methods inherited from CLI::Base
#initialize
#pretty_path, #pretty_time
#logger
Instance Method Details
#are_you_sure? ⇒ Boolean
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/terraspace/terraform/tfc/syncer.rb', line 28
def are_you_sure?
message =" About to sync these project stacks with Terraform Cloud workspaces:\n\n Stack => Workspace\n EOL\n\n mods.each do |mod|\n sync = sync(mod)\n message << \" \#{mod} => \#{sync.workspace_name}\\n\"\n end\n message << <<~EOL\n\n A sync does the following for each workspace:\n\n 1. Create or update workspace, including the VCS settings.\n 2. Set the working dir.\n 3. Set env and terraform variables.\n\n Are you sure?\n EOL\n sure?(message.chop)\nend\n"
|
#mods ⇒ Object
14
15
16
17
|
# File 'lib/terraspace/terraform/tfc/syncer.rb', line 14
def mods
stacks = @options[:stacks]
stacks.empty? ? stack_names : stacks
end
|
#run ⇒ Object
7
8
9
10
11
12
|
# File 'lib/terraspace/terraform/tfc/syncer.rb', line 7
def run
are_you_sure?
mods.each do |mod|
run_sync(mod)
end
end
|
#run_sync(mod) ⇒ Object
19
20
21
|
# File 'lib/terraspace/terraform/tfc/syncer.rb', line 19
def run_sync(mod)
sync(mod).run
end
|
#sync(mod) ⇒ Object
23
24
25
|
# File 'lib/terraspace/terraform/tfc/syncer.rb', line 23
def sync(mod)
Sync.new(@options.merge(mod: mod))
end
|