Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
New or Affected Resource(s) or Datasource(s)
ibm_sm_arbitrary_secret
Description
I'm currently using the ibm_sm_arbitrary_secretresource and according to the documentation the nameattribute uses the following regex: ^[A-Za-z0-9][A-Za-z0-9]*(?:_*-*\\.*[A-Za-z0-9]+)*$ . I created a variable with a validation block that checks exactly that regular expression, but it appears that naming my secret something like "github-pat" is not possible bc of the hyphen "-". When removing the validation, the code executes without a problem, even when the namedoes not match the stated regex. It appears, that the regex in the documentation is not correct.
variable "secrets_list" {
description = "List of all secrets that should be added to the secrets manager"
sensitive = true
type = list(
object({
name = string
payload = string
description = optional(string)
secret_group_id = optional(string)
}))
validation {
error_message = "All secret attributes must match their respective regular expressions documented here: https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/sm_arbitrary_secret"
condition = alltrue([
for secret in var.secrets_list : (can(regex("^[A-Za-z0-9][A-Za-z0-9]*(?:_*-*\\.*[A-Za-z0-9]+)*$", secret.name)) && can(regex("(.*?)", secret.payload)))
])
}
}
When checking the regex with the same name provided in this example, the regex fails with no match found:
I'm wondering what the correct regex actually looks like and appreciate any help you can provide.
Community Note
New or Affected Resource(s) or Datasource(s)
Description
I'm currently using the
ibm_sm_arbitrary_secret
resource and according to the documentation thename
attribute uses the following regex:^[A-Za-z0-9][A-Za-z0-9]*(?:_*-*\\.*[A-Za-z0-9]+)*$
. I created a variable with a validation block that checks exactly that regular expression, but it appears that naming my secret something like "github-pat" is not possible bc of the hyphen "-". When removing the validation, the code executes without a problem, even when thename
does not match the stated regex. It appears, that the regex in the documentation is not correct.When checking the regex with the same name provided in this example, the regex fails with no match found:
I'm wondering what the correct regex actually looks like and appreciate any help you can provide.
References
0000