jfrog / terraform-provider-xray

Terraform provider to manage JFrog Xray
https://jfrog.com/xray/
Apache License 2.0
151 stars 12 forks source link

Change HCL for adding resources to watches #4

Closed jasonwbarnett closed 2 years ago

jasonwbarnett commented 3 years ago

Currently the API for adding a repository (or any type of resource) is like so:

resource "artifactory_xray_watch" "test" {
  name        = "watch-npm-local-repo"
  description = "apply a severity-based policy to the npm local repo"

  resources {
    type       = "repository"
    name       = "npm-local"
    bin_mgr_id = "default"
    repo_type  = "local"
  }
}

I strongly believe that the resources key should be singular (i.e. resource) since it is intended to be specified once per resource you intend to add to the xray watch. This would make this more consistent with the core terraform modules. Given that resource is

resource "artifactory_xray_watch" "test" {
  name        = "watch-npm-local-repo"
  description = "apply a severity-based policy to the npm local repo"

  resource {
    type       = "repository"
    name       = "npm-local"
    bin_mgr_id = "default"
    repo_type  = "local"
  }

  resource {
    type       = "repository"
    name       = "npm-remote"
    bin_mgr_id = "default"
    repo_type  = "remote"
  }
}
skyzyx commented 3 years ago

I imagine this is a breaking change, so it should be deferred to v3.0.0. But I think it's a good idea.

chb0github commented 3 years ago

Yes, this would be breaking. I have actually spoken @jasonwbarnett. Right now I have an open discussion ticket about moving the xray code out into it's own provider. And, at that point, I think it would be a fair discussion to change the HCL.

I didn't come up with this HCL, and my editor gives me warnings about it. But I can't just break people. Please upvote and give your comments on the discussion to move xray to it's own provider

chb0github commented 3 years ago

I'd like to get your vote on this https://github.com/jfrog/terraform-provider-artifactory/issues/160

danielmkn commented 2 years ago

Released in v0.0.1