From 8b5ff119fb40e0bb6b621f0d5d858c8f0797b478 Mon Sep 17 00:00:00 2001 From: Matthias Theuermann Date: Tue, 3 Dec 2024 19:28:46 +0100 Subject: [PATCH] fix: added TriggerAction Signed-off-by: Matthias Theuermann --- internal/provider/integration_gitlab_resource.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/provider/integration_gitlab_resource.go b/internal/provider/integration_gitlab_resource.go index 18b2ea6..5ce7633 100644 --- a/internal/provider/integration_gitlab_resource.go +++ b/internal/provider/integration_gitlab_resource.go @@ -197,6 +197,18 @@ func (r *integrationGitlabResource) Create(ctx context.Context, req resource.Cre ) return } + + // trigger integration to gather results quickly after the first setup + // NOTE: we ignore the error since the integration state does not depend on it + _, err = r.client.TriggerAction(ctx, string(integration.Mrn), mondoov1.ActionTypeRunScan) + if err != nil { + resp.Diagnostics. + AddWarning("Client Error", + fmt.Sprintf("Unable to trigger integration, got error: %s", err), + ) + return + } + // Save space mrn into the Terraform state. data.Mrn = types.StringValue(string(integration.Mrn)) data.Name = types.StringValue(data.Name.ValueString())