Skip to content

Commit

Permalink
r/build_config: support for updating the name field
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Apr 24, 2020
1 parent dd8d2c2 commit 7ebae88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion teamcity/resource_build_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func resourceBuildConfig() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"is_template": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -308,6 +307,10 @@ func resourceBuildConfigUpdate(d *schema.ResourceData, meta interface{}) error {
return err
}

if d.HasChange("name") {
dt.Name = d.Get("name").(string)
}

var changed bool
if d.HasChange("sys_params") || d.HasChange("config_params") || d.HasChange("env_params") {
log.Printf("[DEBUG] resourceBuildConfigUpdate: change detected for params")
Expand Down
8 changes: 5 additions & 3 deletions teamcity/resource_build_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package teamcity_test
import (
"errors"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"regexp"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"

api "github.com/cvbarros/go-teamcity/teamcity"
)

Expand Down Expand Up @@ -195,6 +196,7 @@ func TestAccBuildConfig_UpdateBasic(t *testing.T) {
Config: TestAccBuildConfigBasicUpdated,
Check: resource.ComposeTestCheckFunc(
testAccCheckBuildConfigExists(resName, &bc),
resource.TestCheckResourceAttr(resName, "name", "build config updated"),
resource.TestCheckResourceAttr(resName, "description", "build config test desc updated"),
),
},
Expand Down Expand Up @@ -861,7 +863,7 @@ resource "teamcity_project" "build_config_project_test" {
}
resource "teamcity_build_config" "build_configuration_test" {
name = "build config test"
name = "build config updated"
project_id = "${teamcity_project.build_config_project_test.id}"
description = "build config test desc updated"
settings {
Expand Down

0 comments on commit 7ebae88

Please # to comment.