Skip to content

Include pattern and exclude pattern are both required when using path_ant_filter. #86

Description

@oallauddin

Describe the bug
I am doing some testing of path_ant_filter. I am trying to setup a xray that excludes a path. The provider is requiring both include_patterns and exlude_patterns. When creating the xray watch using the UI both are not required. Pulling the watch configuration using the REST API shows that include_patterns is an empty list.

Requirements for and issue

resource "xray_watch" "jf_license_watch" {
  name        = "jf-license-watch"
  active      = true
  project_key = "jf"

  watch_resource {
  type       = "repository"
  name       = artifactory_local_maven_repository.jf_mvn_snapshots.key
  
  path_ant_filter {
    exclude_patterns = ["org/apache/**", "org.apache.**"]
    include_patterns = ["**"]
    # include_patterns should not be required if exclude_patterns is provided.
    # default value of include_patterns and exclude_patterns could be an empty list []
  }

  assigned_policy {
    name = xray_license_policy.jf_license_policy.name
    type = "license"
  }

  watch_recipients = []
}
# Validation error when not providing include_patterns
Error: Missing required argument

  on ../modules/xray/watch_license.tf line 14, in resource "xray_watch" "license_watch":
  14:       path_ant_filter {

The argument "include_patterns" is required, but no definition was found.

# Validation error when using an empty list for include_patterns
Error: Not enough list items

  with module.xray.xray_watch.license_watch,
  on ../modules/xray/watch_license.tf line 1, in resource "xray_watch" "license_watch":
   1: resource "xray_watch" "license_watch" {

Attribute requires 1 item minimum, but config has only 0 declared.

Expected behavior
Create a xray watch using the provider that only requires include_patterns or exlude_patterns if path_ant_filter is used.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions