Skip to content

Commit

Permalink
Don't recreate contexts on rename (#591)
Browse files Browse the repository at this point in the history
* Don't recreate contexts on rename

* Update tests to include rename check
  • Loading branch information
zhimsel authored Jan 24, 2025
1 parent e73968a commit b252356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion spacelift/resource_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func resourceContext() *schema.Resource {
Type: schema.TypeString,
Description: "Name of the context - should be unique in one account",
Required: true,
ForceNew: true,
ValidateDiagFunc: validations.DisallowEmptyString,
},
"space_id": {
Expand Down
6 changes: 4 additions & 2 deletions spacelift/resource_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestContextResource(t *testing.T) {
Config: config("old description"),
Check: Resource(
resourceName,
Attribute("id", StartsWith("provider-test-context-")),
Attribute("name", StartsWith("Provider test context")),
Attribute("id", Equals("provider-test-context-old-description")),
Attribute("name", Equals("Provider test context old description")),
Attribute("description", Equals("old description")),
SetEquals("labels", "one", "two"),
Attribute("after_apply.#", Equals("1")),
Expand Down Expand Up @@ -79,6 +79,8 @@ func TestContextResource(t *testing.T) {
Config: config("new description"),
Check: Resource(
resourceName,
Attribute("id", Equals("provider-test-context-old-description")), // ID shouldn't change on rename
Attribute("name", Equals("Provider test context new description")), // but the name should
Attribute("description", Equals("new description")),
),
},
Expand Down

0 comments on commit b252356

Please sign in to comment.