Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoints returning response object configuration in working form (with defaults, transformations, etc.) rather than exactly how they were configured #1000

Closed
wilkermichael opened this issue Jul 22, 2022 · 0 comments · Fixed by #999 or #1003
Labels
bug Something isn't working
Milestone

Comments

@wilkermichael
Copy link
Contributor

wilkermichael commented Jul 22, 2022

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:

  1. The response objects returned by Get /task/:name, Get /tasks and Post /tasks for the same task are equivalent
  2. 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 parent working_dir which is not what was configured.
  • task.buffer_period, if unset, will be populated with the parent buffer_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

  1. Create a task via the api
  2. Assess the response
  3. Get the same task
  4. Assess the response
  5. Get all tasks
  6. Assess the object pertaining to the task created in (1)
@wilkermichael wilkermichael added the bug Something isn't working label Jul 22, 2022
@wilkermichael wilkermichael linked a pull request Jul 22, 2022 that will close this issue
@wilkermichael wilkermichael changed the title Endpoints returning incorrect configuration information Endpoints returning configuration in working form rather than exactly how they were configured Jul 25, 2022
@wilkermichael wilkermichael changed the title Endpoints returning configuration in working form rather than exactly how they were configured Endpoints returning response object configuration in working form (with defaults, transformations, etc.) rather than exactly how they were configured Jul 25, 2022
@wilkermichael wilkermichael linked a pull request Jul 26, 2022 that will close this issue
@wilkermichael wilkermichael added this to the v0.7.0 milestone Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant