diff --git a/spacelift/resource_worker_pool.go b/spacelift/resource_worker_pool.go index e18231fb..3ee76d19 100644 --- a/spacelift/resource_worker_pool.go +++ b/spacelift/resource_worker_pool.go @@ -53,6 +53,7 @@ func resourceWorkerPool() *schema.Resource { Optional: true, Computed: true, Sensitive: true, + ForceNew: true, }, "description": { Type: schema.TypeString, diff --git a/spacelift/resource_worker_pool_test.go b/spacelift/resource_worker_pool_test.go index afc630c5..4cdeb8bb 100644 --- a/spacelift/resource_worker_pool_test.go +++ b/spacelift/resource_worker_pool_test.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - . "github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/testhelpers" ) @@ -252,4 +251,35 @@ func TestWorkerPoolResourceSpace(t *testing.T) { }, }) }) + + t.Run("CSR Updates recreate resource", func(t *testing.T) { + testSteps(t, []resource.TestStep{ + { + Config: ` + resource "spacelift_worker_pool" "test" { + name = "My test workerpool" + } + `, + Check: Resource( + resourceName, + Attribute("id", IsNotEmpty()), + Attribute("csr", IsNotEmpty()), + Attribute("csr", NotEquals("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJRWtqQ0NBbm9DQVFBd1RURUxNQWtHQTFVRUJoTUNVRXd4RGpBTUJnTlZCQW9NQldKaFkyOXVNUTR3REFZRApWUVFEREFWaVlXTnZiakVlTUJ3R0NTcUdTSWIzRFFFSkFSWVBZbUZqYjI1QVltRmpiMjR1YjNKbk1JSUNJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQWc4QU1JSUNDZ0tDQWdFQXdhand1UmlreTFkODF0TVpJZytJSXBHUHQxclUKV2t4UGhDOENKNzNUWmx3ZTdVcC9McFFiNnpYU0I2eStCWkludnptd1ZBNzNuM0dnVEdFeS9VbDF2VUthaXZmaQpna3lnd05vV0ExYzRTaUNnbjdYTnl1T2c2MktSWGxNb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