Skip to content

Commit

Permalink
ensure browser step supports all parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lalo-galvan committed Aug 21, 2024
1 parent 53044d9 commit c34e62a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
4 changes: 2 additions & 2 deletions synthetics/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ No modules.
| <a name="input_browser_synthetic_enabled"></a> [browser\_synthetic\_enabled](#input\_browser\_synthetic\_enabled) | Flag to enable Browser Synthetic Test. | `bool` | `true` | no |
| <a name="input_browser_synthetic_locations"></a> [browser\_synthetic\_locations](#input\_browser\_synthetic\_locations) | An array of datadog locations used to run Browser Synthetic Test. | `list(string)` | <pre>[<br> "aws:us-east-1"<br>]</pre> | no |
| <a name="input_browser_synthetic_request_url"></a> [browser\_synthetic\_request\_url](#input\_browser\_synthetic\_request\_url) | URL to send Browser Synthetic Test requests to. | `string` | n/a | yes |
| <a name="input_browser_synthetic_steps"></a> [browser\_synthetic\_steps](#input\_browser\_synthetic\_steps) | Steps for the Browser Synthetic Test to take. | <pre>list(object({<br> name = string<br> type = string<br> params = object({<br> attribute = optional(string)<br> check = optional(string)<br> click_type = optional(string)<br> code = optional(string)<br> delay = optional(number)<br> element = optional(string)<br> email = optional(string)<br> file = optional(string)<br> files = optional(string)<br> modifiers = optional(list(string))<br> playing_tab_id = optional(string)<br> request = optional(string)<br> subtest_public_id = optional(string)<br> value = optional(string)<br> with_click = optional(bool)<br> x = optional(number)<br> y = optional(number)<br> })<br> }))</pre> | n/a | yes |
| <a name="input_browser_synthetic_steps"></a> [browser\_synthetic\_steps](#input\_browser\_synthetic\_steps) | Steps for the Browser Synthetic Test to take. | <pre>list(object({<br> name = string<br> type = string<br> params = object({<br> attribute = optional(string)<br> check = optional(string)<br> click_type = optional(string)<br> code = optional(string)<br> delay = optional(number)<br> element = optional(string)<br> element_user_locator = optional(map(string))<br> email = optional(string)<br> file = optional(string)<br> files = optional(string)<br> modifiers = optional(list(string))<br> playing_tab_id = optional(string)<br> request = optional(string)<br> subtest_public_id = optional(string)<br> value = optional(string)<br> variable = optional(map(string))<br> with_click = optional(bool)<br> x = optional(number)<br> y = optional(number)<br> })<br> }))</pre> | n/a | yes |
| <a name="input_browser_synthetic_tick_every"></a> [browser\_synthetic\_tick\_every](#input\_browser\_synthetic\_tick\_every) | How often Browser Synthetic Test should run in seconds. | `number` | `900` | no |
| <a name="input_cost_center"></a> [cost\_center](#input\_cost\_center) | Cost Center of the monitored resource (leave blank to omit tag) | `string` | `null` | no |
| <a name="input_dashboard_link"></a> [dashboard\_link](#input\_dashboard\_link) | Dashboard link to include in message | `string` | `null` | no |
Expand All @@ -67,4 +67,4 @@ No modules.
## Outputs

No outputs.
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
35 changes: 26 additions & 9 deletions synthetics/browser/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@ resource "datadog_synthetics_test" "browser" {
name = browser_step.value.name
type = browser_step.value.type
params {
attribute = lookup(browser_step.value.params, "attribute", null)
check = lookup(browser_step.value.params, "check", null)
click_type = lookup(browser_step.value.params, "click_type", null)
code = lookup(browser_step.value.params, "code", null)
delay = lookup(browser_step.value.params, "delay", null)
element = lookup(browser_step.value.params, "element", null)
attribute = lookup(browser_step.value.params, "attribute", null)
check = lookup(browser_step.value.params, "check", null)
click_type = lookup(browser_step.value.params, "click_type", null)
code = lookup(browser_step.value.params, "code", null)
delay = lookup(browser_step.value.params, "delay", null)
element = lookup(browser_step.value.params, "element", null)
dynamic "element_user_locator" {
for_each = lookup(browser_step.value.params, "element_user_locator", null)
content {
value {
value = lookup(element_user_locator.value, "value", null)
type = lookup(element_user_locator.value, "type", null)
}
fail_test_on_cannot_locate = lookup(element_user_locator.value, "fail_test_on_cannot_locate", null)
}
}
email = lookup(browser_step.value.params, "email", null)
file = lookup(browser_step.value.params, "file", null)
files = lookup(browser_step.value.params, "files", null)
Expand All @@ -44,9 +54,16 @@ resource "datadog_synthetics_test" "browser" {
request = lookup(browser_step.value.params, "request", null)
subtest_public_id = lookup(browser_step.value.params, "subtest_public_id", null)
value = lookup(browser_step.value.params, "value", null)
with_click = lookup(browser_step.value.params, "with_click", null)
x = lookup(browser_step.value.params, "x", null)
y = lookup(browser_step.value.params, "y", null)
dynamic "variable" {
for_each = lookup(browser_step.value.params, "variable", null)
content {
example = lookup(variable.value, "example", null)
name = lookup(variable.value, "name", null)
}
}
with_click = lookup(browser_step.value.params, "with_click", null)
x = lookup(browser_step.value.params, "x", null)
y = lookup(browser_step.value.params, "y", null)
}
}
}
Expand Down
36 changes: 19 additions & 17 deletions synthetics/browser/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,25 @@ variable "browser_synthetic_steps" {
name = string
type = string
params = object({
attribute = optional(string)
check = optional(string)
click_type = optional(string)
code = optional(string)
delay = optional(number)
element = optional(string)
email = optional(string)
file = optional(string)
files = optional(string)
modifiers = optional(list(string))
playing_tab_id = optional(string)
request = optional(string)
subtest_public_id = optional(string)
value = optional(string)
with_click = optional(bool)
x = optional(number)
y = optional(number)
attribute = optional(string)
check = optional(string)
click_type = optional(string)
code = optional(string)
delay = optional(number)
element = optional(string)
element_user_locator = optional(map(string))
email = optional(string)
file = optional(string)
files = optional(string)
modifiers = optional(list(string))
playing_tab_id = optional(string)
request = optional(string)
subtest_public_id = optional(string)
value = optional(string)
variable = optional(map(string))
with_click = optional(bool)
x = optional(number)
y = optional(number)
})
}))
}
Expand Down

0 comments on commit c34e62a

Please sign in to comment.