Fix boundary_worker auth token overwritten during creation & ForceNew on auth token change (#461)

* cannot update a worker generated auth token

* dont grab auth token from api reply
This commit is contained in:
drewmullen authored and GitHub committed 2023-12-13 10:11:32 -08:00
1 parent 0c26e251cd
commit f8b69875c3
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -69,6 +69,7 @@ func resourceWorker() *schema.Resource {
Description: "The worker authentication token required to register the worker for the worker-led authentication flow. Leaving this blank will result in a controller generated token.",
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
controllerGeneratedActivationToken: {
Description: "A single use token generated by the controller to be passed to the self-managed worker.",
@@ -98,7 +99,6 @@ func setFromWorkerResponseMap(d *schema.ResourceData, raw map[string]interface{}
d.Set(NameKey, raw["name"])
d.Set(DescriptionKey, raw["description"])
d.Set(address, raw["address"])
d.Set(workerGeneratedAuthToken, raw["worker_generated_auth_token"])
d.Set(controllerGeneratedActivationToken, raw["controller_generated_activation_token"])
d.Set(releaseVersion, raw["release_version"])
d.Set(authorizedActions, raw["authorized_actions"])
+7
View File
@@ -80,8 +80,14 @@ func TestWorkerWorkerLed(t *testing.T) {
testAccCheckworkerResourceExists(provider, "boundary_worker.worker_led"),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "description", workerDesc),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "name", workerName),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "worker_generated_auth_token", workerToken),
),
},
{
// create
Config: testConfig(url, workerLedCreate),
PlanOnly: true,
},
importStep("boundary_worker.worker_led"),
{
// update
@@ -90,6 +96,7 @@ func TestWorkerWorkerLed(t *testing.T) {
testAccCheckworkerResourceExists(provider, "boundary_worker.worker_led"),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "description", workerDescUpdate),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "name", workerNameUpdate),
resource.TestCheckResourceAttr("boundary_worker.worker_led", "worker_generated_auth_token", workerToken),
),
},
importStep("boundary_worker.worker_led"),