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:
1 parent
0c26e251cd
commit
f8b69875c3
2 files changed
+8
-1
No files matched your search
@@ -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"])
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in new issue
Block a user