Class: Bauble::Cli::Pulumi
- Inherits:
-
Object
- Object
- Bauble::Cli::Pulumi
- Defined in:
- lib/bauble/cli/pulumi.rb
Overview
Pulumi class
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #create_or_select_stack(stack_name) ⇒ Object
- #create_pulumi_yml(template) ⇒ Object
- #destroy ⇒ Object
- #init! ⇒ Object
-
#initialize(config:) ⇒ Pulumi
constructor
A new instance of Pulumi.
- #preview ⇒ Object
- #up(target = nil) ⇒ Object
Constructor Details
#initialize(config:) ⇒ Pulumi
Returns a new instance of Pulumi.
13 14 15 |
# File 'lib/bauble/cli/pulumi.rb', line 13 def initialize(config:) @config = config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/bauble/cli/pulumi.rb', line 11 def config @config end |
Instance Method Details
#create_or_select_stack(stack_name) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/bauble/cli/pulumi.rb', line 42 def create_or_select_stack(stack_name) if stack_initialized?(stack_name) Logger.debug "Selecting stack #{stack_name}" select_stack(stack_name) else Logger.debug "Initializing stack #{stack_name}" init_stack(stack_name) end end |
#create_pulumi_yml(template) ⇒ Object
17 18 19 20 21 |
# File 'lib/bauble/cli/pulumi.rb', line 17 def create_pulumi_yml(template) Logger.debug 'Creating Pulumi.yaml...' FileUtils.mkdir_p(@config.pulumi_home) File.write("#{@config.pulumi_home}/Pulumi.yaml", template, mode: 'w') end |
#destroy ⇒ Object
37 38 39 40 |
# File 'lib/bauble/cli/pulumi.rb', line 37 def destroy Logger.debug "Running pulumi destroy...\n" output_command('destroy --yes') end |
#init! ⇒ Object
23 24 25 |
# File 'lib/bauble/cli/pulumi.rb', line 23 def init! init_pulumi unless pulumi_initialized? end |