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

Issue with Updating multiLocator in Datadog Synthetic Browser #2684

Open
surajtikoo opened this issue Nov 20, 2024 · 0 comments
Open

Issue with Updating multiLocator in Datadog Synthetic Browser #2684

surajtikoo opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@surajtikoo
Copy link

surajtikoo commented Nov 20, 2024

Datadog Terraform Provider Version

v3.48.1

Terraform Version

v1.5.7

What resources or data sources are affected?

iam facing an issue while updating the multiLocator field in Datadog Synthetic Browser tests using Terraform. Despite making changes to the multiLocator configuration and applying it through Terraform, the updates are not reflected in the Datadog UI.

Steps Taken:

I have modified the multiLocator configuration in the Terraform script.
I ran terraform apply after making these changes, but the multiLocator field was not updated in the test configuration.
I attempted to use terraform taint on the resource, but the update still didn't apply as expected.
The resource is part of a module, and the full path is module.login_module.datadog_synthetics_test.datadog_brower_test.
I have also checked if the resource exists in the state file using terraform state list, and the resource is present.

Expected Behavior: Terraform should detect the changes to the multiLocator field and update the configuration in Datadog when terraform apply is executed.

Actual Behavior: The multiLocator field is not updated despite changes being applied via Terraform.

Workarounds Attempted:

Used terraform taint to mark the resource for recreation, but the update did not reflect.
Tried updating the field manually using the Datadog API as an alternative, which successfully updated the configuration.

Terraform Configuration Files

provider "datadog" {
  api_key = "your_api_key"
  app_key = "your_app_key"
}

module "login_module" {
  source = "./modules/datadog_browser_step"
  
  # Step 1 - Modify multiLocator in the first browser step
  datadog_brower_test = {
    name   = "Test Login Step"
    type   = "browser"
    steps = [
      {
        type = "typeText"
        name = "Input email in the search field"
        params = {
          value   = "{{ USERNAME }}@gmail.com"
          element = jsonencode({
            multiLocator = {
              ab = "/*[local-name()='html'][1]/*[local-name()='body'][1]/*[local-name()='main'][1]/*[local-name()='div'][1]/*[local-name()='div'][1]/*[local-name()='article'][1]/*[local-name()='form'][1]/*[local-name()='div'][1]/*[local-name()='input'][1]",
              at = "/descendant::*[@name='user[email]' and @value='']",
              cl = "/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' sign-in__form ')]/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' form__control ')][1]",
              co = "[{\"text\":\"email\",\"textType\":\"innerText\"}]",
              ro = "",
              clt = "/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' sign-in__form ')]/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' form__control ')][1]"
            },
            targetOuterHTML = "<input type=\"email\" id=\"user[email]\" name=\"user[email]\" value=\"\" placeholder=\"Email\" autocapitalize=\"off\" autocomplete=\"off\" autocorrect=\"off\" spellcheck=\"false\" required=\"\" class=\"form__control\" aria>"
          })
        }
      }
    ]
  }
}

resource "datadog_synthetics_test" "test" {
  name   = "Sample Synthetic Test"
  type   = "browser"
  config = module.login_module.datadog_brower_test
}

output "test_id" {
  value = datadog_synthetics_test.test.id
}

Relevant debug or panic output

No response

Expected Behavior

In your ticket, you can include the following relevant details:

Terraform Configuration Details:

The configuration defines a synthetic browser test for logging in.
The multiLocator field is configured inside the params for the typeText step in the test.
This configuration is passed to the datadog_synthetics_test resource using the module output.
Problem:

After applying this configuration, Terraform does not update the multiLocator field in Datadog when changes are made to the locator in the Terraform script.
Even after using terraform taint, the multiLocator field does not reflect the updated value.
Example Terraform Configuration:

Shared above, where the multiLocator is being passed dynamically to the browser step configuration.

No response

Actual Behavior

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@surajtikoo surajtikoo added the bug label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant