Endpoints returning response object configuration in working form (with defaults, transformations, etc.) rather than exactly how they were configured
wilkermichael opened this issue · 0 comments
Describe the bug
Issue where the API responses for Post /task
, Get /task
and Get /task/:name
return objects which have been mutated into their working form (e.g. with defaults, transformations, etc) rather than responding with the configuration exactly as configured.
Versions
Consul-Terraform-Sync
consul-terraform-sync >= v0.5.0 (dbfcb19)
Compatible with Terraform >= 0.13.0, < 0.15
Consul Version
N/A
Terraform Version
N/A
Expected Behavior
Expect the following:
- The response objects returned by
Get /task/:name
,Get /tasks
andPost /tasks
for the same task are equivalent - The response objects are reflective of the tasks as they are configured
Actual Behavior
The response objects for Get /task/:name
and Get /tasks
are equivalent for tasks of the same name, however response objects returned by Post /tasks
are different.
The objects returned also contain transformations that occur after configuration has been processed and converted to an internal task object for use with automation.
Examples:
task.working_dir
, if unset, will be populated with the parentworking_dir
which is not what was configured.task.buffer_period
, if unset, will be populated with the parentbuffer_period
which is not what was configured.- When using a local
task.module
this field is populated with an absolute path, rather than the configured relative path.
The above transformations are required when using the task for automations, so fixing this bug would not change any of the existing behaviour, tasks will still inherit qualities from the parent configuration on usage. This fix will instead create consistency between endpoints and convey to the user exactly what was configured.
Steps to Reproduce
- Create a task via the api
- Assess the response
- Get the same task
- Assess the response
- Get all tasks
- Assess the object pertaining to the task created in (1)