From e096d1bdd3883a7eda5ad8a29682623dbfc80674 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> Date: Wed, 24 Jul 2024 09:15:41 +0000 Subject: [PATCH] Fix instance creation Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> --- cmd/instance_create.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/instance_create.go b/cmd/instance_create.go index a01bc7ce..f4828396 100644 --- a/cmd/instance_create.go +++ b/cmd/instance_create.go @@ -99,7 +99,7 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin } if l := len(c.AntiAffinityGroups); l > 0 { - antiAffinityGroupIDs := make([]v3.AntiAffinityGroup, l) + instanceReq.AntiAffinityGroups = make([]v3.AntiAffinityGroup, l) af, err := client.ListAntiAffinityGroups(ctx) if err != nil { return fmt.Errorf("error listing Anti-Affinity Group: %w", err) @@ -109,10 +109,8 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin if err != nil { return fmt.Errorf("error retrieving Anti-Affinity Group: %w", err) } - antiAffinityGroupIDs[i] = antiAffinityGroup + instanceReq.AntiAffinityGroups[i] = v3.AntiAffinityGroup{ID: antiAffinityGroup.ID} } - - instanceReq.AntiAffinityGroups = antiAffinityGroupIDs } if c.DeployTarget != "" { @@ -171,7 +169,7 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin if err != nil { return fmt.Errorf("error retrieving Security Group: %w", err) } - instanceReq.SecurityGroups[i] = securityGroup + instanceReq.SecurityGroups[i] = v3.SecurityGroup{ID: securityGroup.ID} } }