DataDog / terraform-provider-datadog

Terraform Datadog provider
https://www.terraform.io/docs/providers/datadog/
Mozilla Public License 2.0
403 stars 379 forks source link

Setting `restricted_roles` in `datadog_synthetics_test` leaves access unrestricted #2583

Open oshmyrko opened 2 months ago

oshmyrko commented 2 months ago

Datadog Terraform Provider Version

v3.44.1

Terraform Version

v1.9.5

What resources or data sources are affected?

Terraform Configuration Files

resource "datadog_synthetics_test" "test" {
  name      = "Jenkins login page is unreachable"
  type      = "api"
  subtype   = "http"
  status    = "live"
  message   = "@email@example.com"
  locations = ["pl:*******"]
  tags      = ["team:my", "env:prod"]

  request_definition {
    method = "GET"
    url    = "https://jenkins.mydomain.com/login"
  }

  request_headers = {
    Content-Type = "application/json"
  }

  assertion {
    type     = "statusCode"
    operator = "is"
    target   = "200"
  }

  options_list {
    tick_every = 3600
    restricted_roles = ["4549****-****-****-****-************"]

    retry {
      count    = 2
      interval = 300
    }
  }
}

Relevant debug or panic output

No response

Expected Behavior

When role ID is specified in the restricted_roles argument in datadog_synthetics_test, the Terraform should restrict the access to the test to this role.

Actual Behavior

The provider just prints the plan with the role but does not apply it to the test:

      + options_list {
          + http_version        = "any"
          + min_location_failed = 1
          + restricted_roles    = [
              + "4549****-****-****-****-************",
            ]
          + tick_every          = 3600

          + retry {
              + count    = 2
              + interval = 300
            }
        }

image

Steps to Reproduce

  1. terraform apply a synthetic test with a restricted role defined
  2. Find the created test in Datadog Synthetics and open to edit
  3. Scroll down to Set permissions and see that the access is Unrestricted (specified role is not set)
  4. Add any role manually and run terraform apply again - it shows no changes

Important Factoids

No response

References

No response

chiokejjones commented 1 month ago

I'm seeing the same behavior with datadog_synthetics_private_location as well.