Skip to content

Commit

Permalink
Merge pull request #1 from euqen/fix-build-steps-dup
Browse files Browse the repository at this point in the history
Fix build steps dup
  • Loading branch information
euqen authored Apr 12, 2022
2 parents dd8d2c2 + ee17e63 commit 82086ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion teamcity/resource_build_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ func resourceBuildConfigUpdate(d *schema.ResourceData, meta interface{}) error {
}
}

if dt.IsTemplate == false && len(dt.Steps) > 0 {
var emptySteps []api.Step
dt.Steps = emptySteps
}

if changed {
_, err := client.BuildTypes.Update(dt)
d.SetPartial("settings")
Expand Down Expand Up @@ -370,6 +375,7 @@ func resourceBuildConfigUpdate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}

if len(remove) > 0 {
for _, s := range remove {
err := client.BuildTypes.DeleteStep(dt.ID, s.GetID())
Expand Down Expand Up @@ -478,7 +484,7 @@ func resourceBuildConfigRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
if steps != nil && len(steps) > 0 {
if steps != nil && dt.IsTemplate == true && len(steps) > 0 {
var stepsToSave []map[string]interface{}
for _, el := range steps {
l, err := flattenBuildStep(el)
Expand Down

0 comments on commit 82086ad

Please sign in to comment.