Skip to content

Commit

Permalink
fix support for empty lists
Browse files Browse the repository at this point in the history
  • Loading branch information
benPearce1 committed Dec 2, 2024
1 parent 5d661ff commit 7fb99ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions octopusdeploy_framework/resource_deployment_freeze_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (d *deploymentFreezeProjectResource) Read(ctx context.Context, req resource
}
}

data.EnvironmentIDs = util.FlattenStringList(freeze.ProjectEnvironmentScope[projectId])
data.EnvironmentIDs = util.Ternary(len(freeze.ProjectEnvironmentScope[projectId]) > 0, util.FlattenStringList(freeze.ProjectEnvironmentScope[projectId]), types.ListNull(types.StringType))
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
util.Read(ctx, description)
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (d *deploymentFreezeProjectResource) Update(ctx context.Context, req resour
}

plan.ID = types.StringValue(util.BuildCompositeId(plan.DeploymentFreezeID.ValueString(), plan.ProjectID.ValueString()))
plan.EnvironmentIDs = util.FlattenStringList(freeze.ProjectEnvironmentScope[plan.ProjectID.ValueString()])
plan.EnvironmentIDs = util.Ternary(len(freeze.ProjectEnvironmentScope[plan.ProjectID.ValueString()]) > 0, util.FlattenStringList(freeze.ProjectEnvironmentScope[plan.ProjectID.ValueString()]), types.ListNull(types.StringType))

resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
tflog.Debug(ctx, fmt.Sprintf("updated project (%s) to deployment freeze (%s)", plan.ProjectID.ValueString(), plan.DeploymentFreezeID.ValueString()))
Expand Down

0 comments on commit 7fb99ab

Please sign in to comment.