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