Skip to content

Conversation

@agrare
Copy link
Member

@agrare agrare commented Aug 7, 2025

Base classes required for MiqProvisionTask based provisioning for TFE/EmbeddedTerraform/EmbeddedAnsible/AWX

source = ManageIQ::Providers::TerraformEnterprise::AutomationManager::ConfigurationScript.find_by(:manager_ref => 'ws-BkpXRVrXTfUNXuxT')
config_info = {:owner_email => "[email protected]", :source_id => source.id}
request = ManageIQ::Providers::TerraformEnterprise::AutomationManager::ProvisionWorkflow.new(config_info, "admin").make_request(nil, config_info)
request.approve("admin", "")

TODO:

  • After the provision is complete the ServiceTemplateProvisionTask is provisioned but the ManageIQ/Service/Provisioning/StateMachines#checkprovisioned is looking for finished so it loops retrying checkprovisioned.

Depends on:

Follow-up:

@agrare agrare requested review from Fryguy and kbrock as code owners August 7, 2025 18:08
@Fryguy Fryguy added the wip label Aug 7, 2025
@Fryguy Fryguy changed the title WIP MiqProvisionConfigurationScriptRequest [WIP] MiqProvisionConfigurationScriptRequest Aug 7, 2025
@agrare agrare force-pushed the miq_provision_configuration_scripts branch from 94ecda3 to 376acdc Compare August 8, 2025 14:33
@agrare agrare force-pushed the miq_provision_configuration_scripts branch from 376acdc to 33680e2 Compare August 21, 2025 19:01
@agrare agrare changed the title [WIP] MiqProvisionConfigurationScriptRequest [WIP] Add MiqRequest and MiqProvisionWorkflow classes for ConfigurationScript provisioning Aug 21, 2025
@agrare agrare force-pushed the miq_provision_configuration_scripts branch 2 times, most recently from 18320d5 to dad7ba8 Compare August 21, 2025 19:53
@@ -0,0 +1,23 @@
describe MiqProvisionConfigurationScriptRequest do
let(:admin) { FactoryBot.create(:user) }
let(:ems) { FactoryBot.create(:ems_terraform_enterprise) }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO can we validate the request task gets built without having to use TFE/AWX specifically

@agrare agrare force-pushed the miq_provision_configuration_scripts branch 5 times, most recently from 1b9ec7b to a061c6c Compare August 26, 2025 20:01
@agrare agrare force-pushed the miq_provision_configuration_scripts branch 3 times, most recently from bb06664 to ea8eaa7 Compare September 15, 2025 19:38
@agrare agrare force-pushed the miq_provision_configuration_scripts branch from ea8eaa7 to 80ff4c9 Compare September 18, 2025 14:20
@Fryguy
Copy link
Member

Fryguy commented Sep 23, 2025

That set of steps in the OP is so nice :)

@agrare
Copy link
Member Author

agrare commented Sep 25, 2025

Okay I've created a ServiceTemplateTerraformEnterprise and given the Provision ResourceAction a configuration_script_id but have run into the problem of having the ServiceTemplateProvisionRequest be the one send to workflows not the MiqProvisionTask. This is where the MiqProvisionRequestTemplate is used for VM provisioning.

Going to investigate where this is created...it isn't immediately obvious

@agrare agrare force-pushed the miq_provision_configuration_scripts branch 2 times, most recently from 986663d to 1bda6cd Compare October 7, 2025 16:59
@agrare
Copy link
Member Author

agrare commented Oct 7, 2025

Okay I've successfully used the builtin provision.asl workflow to run a TerraformEnterprise::AutomationManager::Provision and plan&apply a workspace.

This matches how VM provisioning works with two ServiceTemplateProvisionTask s and a ManageIQ::Providers::TerraformEnterprise::AutomationManager::Provision which is run through workflows.

The key is using a MiqProvisionConfigurationScriptRequestTemplate in the service_template.service_resources to create the subtasks. I'll update the OP with steps to create this (I hand modified an existing ServiceTemplateTerraformEnterprise service template for my example)

@agrare agrare force-pushed the miq_provision_configuration_scripts branch 2 times, most recently from e0e4a60 to bb1a042 Compare October 16, 2025 14:48
@agrare
Copy link
Member Author

agrare commented Oct 16, 2025

miq-bot pushed a commit to ManageIQ/manageiq-cross_repo-tests that referenced this pull request Oct 16, 2025
@agrare agrare changed the title [WIP] Add MiqRequest and MiqProvisionWorkflow classes for ConfigurationScript provisioning Add MiqRequest and MiqProvisionWorkflow classes for ConfigurationScript provisioning Oct 16, 2025
@agrare
Copy link
Member Author

agrare commented Oct 17, 2025

miq-bot pushed a commit to ManageIQ/manageiq-cross_repo-tests that referenced this pull request Oct 17, 2025
@agrare agrare force-pushed the miq_provision_configuration_scripts branch from db1fd4a to a0c3edd Compare October 17, 2025 14:36
@agrare agrare removed the wip label Oct 17, 2025
@Fryguy Fryguy self-assigned this Oct 17, 2025
@Fryguy Fryguy merged commit 62180d4 into ManageIQ:master Oct 17, 2025
9 checks passed
@agrare agrare deleted the miq_provision_configuration_scripts branch October 17, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants