-
Notifications
You must be signed in to change notification settings - Fork 92
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
Terraform forces replacement if the project-level robot account prefix contains plus sign #479
Comments
Hi, could you please copy your code and logs ? |
I have to create a bare minimum Terraform code for testing, that takes some time. In the meantime...
Maybe replacing that line with |
In the previous version, the prefix was trimmed before the split: https://github.com/goharbor/terraform-provider-harbor/blob/v3.10.15/provider/resource_robot_account.go#L171 |
okay I understoud |
Alright, here is a minimal code just in case: terraform {
required_providers {
harbor = {
source = "goharbor/harbor"
version = "= 3.10.16"
}
}
}
variable "harbor_url" {
type = string
}
variable "harbor_username" {
type = string
}
variable "harbor_password" {
type = string
sensitive = true
}
variable "harbor_project" {
type = string
}
provider "harbor" {
url = var.harbor_url
username = var.harbor_username
password = var.harbor_password
}
resource "harbor_robot_account" "robot" {
level = "project"
name = "robot-pull"
description = "Robot account for pulling artifacts"
permissions {
kind = "project"
namespace = var.harbor_project
access {
action = "pull"
resource = "repository"
}
}
} After the second apply, it starts a force replacement loop:
|
Some kind of regular expression might also work: |
@berkitamas |
…x contains plus sign (fixes #479) Signed-off-by: flbla <[email protected]>
…x contains plus sign (fixes #479) (#484) fixes #479 Signed-off-by: flbla <[email protected]>
Hi @flbla, sorry for the late response, it is indeed fixed the issue, thanks! |
Describe the bug
With the new v3.10.16 the project level robot account breaks if the Robot Name Prefix is set to
robot+
or similar (if contains +).To Reproduce
Outcome: Terraform forces replacement
Expected behavior
Terraform reports back "No changes"
Additional context
I did a minimal investigation, and the issue is most probably this: 8e20c50
The line
shortName := strings.TrimPrefix(robot.Name, systemConfig.RobotNamePrefix.Value)
only exists on the system-level robot account branch while previously it was before theif
.The text was updated successfully, but these errors were encountered: