Class: TerraformWrapper::Tasks::PlanDestroy
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- TerraformWrapper::Tasks::PlanDestroy
- Includes:
- Shared::Logging
- Defined in:
- lib/terraform-wrapper/tasks/plandestroy.rb
Instance Method Summary collapse
-
#initialize(binary:, code:, options:) {|_self| ... } ⇒ PlanDestroy
constructor
A new instance of PlanDestroy.
- #plan_destroy_task ⇒ Object
Methods included from Shared::Logging
configure_logger_for, logger_for
Constructor Details
#initialize(binary:, code:, options:) {|_self| ... } ⇒ PlanDestroy
Returns a new instance of PlanDestroy.
25 26 27 28 29 30 31 32 33 |
# File 'lib/terraform-wrapper/tasks/plandestroy.rb', line 25 def initialize(binary:, code:, options:) @binary = binary @code = code @options = yield self if block_given? plan_destroy_task end |
Instance Method Details
#plan_destroy_task ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/terraform-wrapper/tasks/plandestroy.rb', line 37 def plan_destroy_task desc "Creates a Terraform destroy plan for a given configuration on an infrastructure component." task :"plan-destroy", [:config, :out] => :binary do |t, args| = @options.merge({"name" => args[:config]}) logger.info("Processing configuration for Terraform destroy plan...") config = TerraformWrapper::Shared::Config.new(code: @code, options: ) runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code) logger.info("Running Terraform destroy plan for service: #{config.service}, component: #{@code.name}...") runner.init(config: config) runner.plan(destroy: true, file: args[:out]) end end |