Skip to content

Conversation

@arya-girish-k
Copy link
Contributor

@arya-girish-k arya-girish-k commented Oct 22, 2025

Description

Add UI regex valiadation in ibm_catalog.json.

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

This PR is to enable input validation in the UI for the variable using the value_constraints array defined in the catalog, which the UI will use to validate user input at runtime.

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@arya-girish-k
Copy link
Contributor Author

/run pipeline

Copy link
Member

@jor2 jor2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question about regex

@arya-girish-k
Copy link
Contributor Author

Updated Subscription_id_secret_crn ,Tested the variable against incorrect input, and correct input. Corresponding screenshots are attached below.
image
image
subscription_id_secret_crn ®

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

Updated the validation and attached a screenshot showing the variable when invalid inputs are provided.
repos_git_token_secret_crn
Pasted Graphic 17
subscription_id_secret_crn
Pasted Graphic 18
db2_s2s_policy_target_crn
Pasted Graphic 19
mq_capacity_s2s_policy_target_crn
Error Invalid value for variable

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

/run pipeline

Copy link
Member

@vbontempi vbontempi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asked a question valid for all the changes on variables.tf

default = null
validation {
condition = var.repos_git_token_secret_crn != null ? can(regex("^crn\\:v\\d(\\:[\\w\\-_]*){4}\\:([aos]\\/[\\w_\\-]+)?(\\:[\\w_\\-]*){3}$", var.repos_git_token_secret_crn)) : true
condition = var.repos_git_token_secret_crn != null ? can(regex("^crn:(.*:){3}secrets-manager:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}:secret:[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$", var.repos_git_token_secret_crn)) : true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are making the regexp more strict forcing the service name to secrets-manager but you also make it more relaxed in terms of account/service IDs
Moreover is there a reason why you are replacing \w with [0-9a-fA-F] which represents the same set of characters?

Copy link
Contributor Author

@arya-girish-k arya-girish-k Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • @vbontempi :I initially misunderstood that the CRN pattern for this variable only allowed Secrets Manager secrets, but I’ve now realized it supports secret CRNs from other services as well. I’m reverting my changes to the previous version and will do the same in the catalog.

I was following the same pattern for other CRNs as well. As per your suggestion, since the account ID pattern is currently relaxed, I’ll make it stricter. Also, I’d like to confirm whether we’re using the service ID as part of the CRN.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the variable description (repos_git_token_secret_crn), this represents the CRN of an existing secret stored in Secrets Manager. However, when I tested it, the existing secret CRN didn’t match the current pattern.

Image

I have done some modification in the CRN pattern (made it more stricter),it is matching to the CRN .

Image

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

Updated variable validation,Tested ss:
Pasted Graphic
Error Invalid value for variable
Pasted Graphic 2
Pasted Graphic 3

@arya-girish-k
Copy link
Contributor Author

/run pipeline

@arya-girish-k
Copy link
Contributor Author

/run pipeline

Copy link
Member

@vbontempi vbontempi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@maheshwarishikha maheshwarishikha merged commit ed3b5e1 into main Dec 5, 2025
2 checks passed
@maheshwarishikha maheshwarishikha deleted the regex-validation branch December 5, 2025 05:39
@terraform-ibm-modules-ops
Copy link
Contributor

🎉 This PR is included in version 2.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants