Closed agrare closed 5 months ago
app/models/service_terraform_template.rb
NOTE I am getting the following exception from Terraform::Runner
:
[----] E, [2024-05-23T11:38:16.432267#157937:9ee8] ERROR -- evm: MIQ(MiqQueue#deliver) Message id: [3886], Error: [undefined method `id' for 2:Integer
'connection_parameters' => Terraform::Runner::Credential.new(cred.id).connection_parameters
^^^
Did you mean? i]
[----] E, [2024-05-23T11:38:16.432739#157937:9ee8] ERROR -- evm: [NoMethodError]: undefined method `id' for 2:Integer
'connection_parameters' => Terraform::Runner::Credential.new(cred.id).connection_parameters
^^^
Did you mean? i Method:[block (2 levels) in <class:LogProxy>]
[----] E, [2024-05-23T11:38:16.432852#157937:9ee8] ERROR -- evm: /home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/lib/terraform/runner.rb:109:in `block in provider_connection_parameters'
/home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/lib/terraform/runner.rb:107:in `collect'
/home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/lib/terraform/runner.rb:107:in `provider_connection_parameters'
/home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/lib/terraform/runner.rb:129:in `create_stack_job'
/home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/lib/terraform/runner.rb:30:in `run_async'
/home/grare/adam/src/manageiq/manageiq-providers-embedded_terraform/app/models/manageiq/providers/embedded_terraform/automation_manager/job.rb:25:in `execute'
It seems that it is expecting authentication records: https://github.com/ManageIQ/manageiq-providers-embedded_terraform/blob/master/lib/terraform/runner.rb#L109
def provider_connection_parameters(credentials)
credentials.collect do |cred|
{
'connection_parameters' => Terraform::Runner::Credential.new(cred.id).connection_parameters
}
end
end
But the doc mentions that it expects a list of IDs: https://github.com/ManageIQ/manageiq-providers-embedded_terraform/blob/master/lib/terraform/runner.rb#L24
# @param credentials [Array] List of Authentication object ids to provide to the terraform run
@agrare LGTM - do you want me to merge and then the Terraform runner thing fixed later, or do you expect it to be fixed in this PR also?
@Fryguy that's a different issue so I'll push a separate PR for that so you can merge this as is
Backported to radjabov
in commit 5e8b39a7601823aa5941df4cc98c81de9c632047.
commit 5e8b39a7601823aa5941df4cc98c81de9c632047
Author: Jason Frey <fryguy9@gmail.com>
Date: Fri May 24 10:23:32 2024 -0400
Merge pull request #30 from agrare/fix_service_options
Fix Provision options for EmbeddedTerraform Stack
(cherry picked from commit ac7a4094bebafcc31fa556a9edd596eb43befa92)
The options column for a ServiceTerraformTemplate includes information that isn't necessary for a provision request and the options sent to the Stack.create_stack should be tailored to only include what is necessary.
Also this fixes the credential IDs being passed down since those values were in the options.config_info.provision hash.
Example
:options
from aServiceTerraformTemplate
Example
provision_job_options
which is what is sent to theStack.create_stack
Example options sent to Terraform::Runner.run`