From 054be94fde4d3cfd4c6716fde2367d86956e7f1b Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Tue, 30 Jul 2024 23:00:10 +1000 Subject: [PATCH] Fix versioning strategy not return by API --- octopusdeploy_framework/resource_project.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/octopusdeploy_framework/resource_project.go b/octopusdeploy_framework/resource_project.go index f020e55ed..f1273b124 100644 --- a/octopusdeploy_framework/resource_project.go +++ b/octopusdeploy_framework/resource_project.go @@ -40,6 +40,7 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest project := expandProject(ctx, plan) persistenceSettings := project.PersistenceSettings + versioningStrategy := project.VersioningStrategy createdProject, err := projects.Add(r.Client, project) if err != nil { resp.Diagnostics.AddError("Error creating project", err.Error()) @@ -56,13 +57,17 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest } createdProject, err = projects.GetByID(r.Client, plan.SpaceID.ValueString(), createdProject.GetID()) + if err != nil { + resp.Diagnostics.AddError("Error retrieving created project", err.Error()) + return + } + if persistenceSettings != nil { createdProject.PersistenceSettings = persistenceSettings } - if err != nil { - resp.Diagnostics.AddError("Error retrieving created project", err.Error()) - return + if versioningStrategy != nil { + createdProject.VersioningStrategy = versioningStrategy } flattenedProject, diags := flattenProject(ctx, createdProject, &plan)