Skip to content

Commit

Permalink
Fix versioning strategy not return by API
Browse files Browse the repository at this point in the history
  • Loading branch information
HuyPhanNguyen committed Jul 30, 2024
1 parent e0a0604 commit 054be94
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions octopusdeploy_framework/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down

0 comments on commit 054be94

Please sign in to comment.