terraformer
terraformer copied to clipboard
For Datadog synthetics, browser_step blocks should be exported in step order rather than alphabetically by name
I ran terraformer import datadog --resources=synthetics_test --api-key="" --app-key=""
, and I generated a .tf
file with all the correct browser_step
s in it which was great! Unfortunately, the browser_step
s export alphabetically by name
rather than in step order.
As a simple example, this could be generated from the above command:
browser_step {
name = "Click on button \"Sign in\""
...
}
browser_step {
name = "Type text on input \"email\""
...
}
browser_step {
name = "Type text on input \"password\""
...
}
We would want the synthetic to input email and password before clicking on "Sign in". Since the export orders alphabetically by name
, it's not possible to do a direct import of the .tf
file and have the synthetic work. I worked around this by manually re-ordering all the steps, but this can be tedious if the are test has a lot of browser steps (multiplied by X # of synthetics!).
Looking at Datadog's Synthetic API docs, it doesn't look like there are "step numbers" available as a parameter for steps
on creation. This could be a Datadog issue, but I wanted to run it by you here to see if there was a simple fix that was available on this end!
Hey I know this use case. terraformer sort results for preventing changes in files. HCL object by default use go map, so it's unsorted and we can get different results on 2 running. I look now in the code, maybe we need to delete this line https://github.com/GoogleCloudPlatform/terraformer/blob/master/terraformutils/hcl.go#L80 and don't sort the list, but need to test this. I think if we delete this line we get again unsorted/random sorted results, because it's go maps
@sergeylanzman Ah ok, that's unfortunate if the issue with with Go's map libraries. Let me know if the sorting works - if not, no big deal, I'll just update docs on our side explaining the issue.
hi, I think the unfortunate issue messes export outputs and should be fixed. My use case is to use the terraformer to backup browser_steps in code.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
I ran into this issue with a recent build as well. My dirty solution was:
- Use Terraformer to import and create the state file.
- Capture the output of
terraform show
into a new.TF
file - Fix any errors that come up
This was clunky and time-consuming, but terraformer still saved me a bunch of time. Only had to do surgery on custom_log_pipelines
because terraform show
didn't properly output what I needed.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Hi, The order is still not kept and this can be cumbersome when dealing with a ton of steps. That would help me a lot to have this feature. Any solution planned ? Thabk you!