datadrivers / terraform-provider-nexus

Terraform provider for Sonatype Nexus
https://registry.terraform.io/providers/datadrivers/nexus
Mozilla Public License 2.0
119 stars 53 forks source link

bug ? nexus_security_role error when the role is modified #388

Open zephyrin13 opened 1 year ago

zephyrin13 commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

v1.5.1

Nexus Provider Version

1.21.2

Nexus Version

3.41.0-01

Affected Resource(s)/Data Source(s)

nexus_security_role

Terraform Configuration Files

I want to update a role which is used by other roles.
This specific role allow to read to all public repository and for that I add to it "read privilege" of all projet.

When I add a projet, I have to update that role.
and terraform returns an error

Why the role is not updated ?

thx
Michel

Debug Output/Panic Output

nexus_security_role.indus-all-acces-pub-read: Creating...
╷
│ Error: "Role 'indus-all-acces-pub-read' already exists, use a unique roleId."
│
│   with nexus_security_role.indus-all-acces-pub-read,
│   on main.tf line 30, in resource "nexus_security_role" "indus-all-acces-pub-read":
│   30: resource "nexus_security_role" "indus-all-acces-pub-read" {

Expected Behaviour

role updated

Actual Behaviour

error

Steps to Reproduce

locals { privileges_all_read = [for x in data.nexus_privileges.priv_pub_read.privileges: x.name if can(regex("public-browse|public-read", x.name)) ] }

resource "nexus_security_role" "indus-all-acces-pub-read" { description = "indus-all-acces-pub-read" name = "indus-all-acces-pub-read" roleid = "indus-all-acces-pub-read" privileges = local.privileges_all_read }

References

No response