You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/da-implementation-guidelines.md
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Below you will find some guidance on best practises that should be used when aut
8
8
9
9
All Deployable Architecture solutions should have an optional **`prefix`** input variable that complies with the following criteria:
10
10
- Input should have no default value, but set `nullable = true` to allow user to pass `null` incase they do not wish to use a prefix. This would be for advanced users who may need full control over resource naming.
11
-
- Add validation to the variable. See the below code snippet for the recommended validation to be added across all DAs. Ideally all DAs should have the same validation so the `prefix` value is accepted for all DAs for the case where it may be used for input mapping when configuring dependant (add-on) DAs.
11
+
- Add validation to the variable. Validation should be added in both the terraform code and the ibm_catalog.json. See the below code snippets for the recommended validation to be added across all DAs. Ideally all DAs should have the same validation so the `prefix` value is accepted for all DAs for the case where it may be used for input mapping when configuring dependant (add-on) DAs.
12
12
- Ensure to include the details of the required format in the variable description, an example value, and link to the helper doc just like what is shown in the code snippet below. This should be consistent across all DAs.
13
13
- The prefix variable logic should be handled in a local variable so logic does not have repeated in the terraform code. For example:
14
14
```hcl
@@ -26,15 +26,16 @@ All Deployable Architecture solutions should have an optional **`prefix`** input
26
26
nullable = false
27
27
}
28
28
```
29
-
30
29
### Code snippet example
31
-
The following code should be used consistently across all DAs (tweak the example value that is included in the description so it is relevant to the DA being created):
30
+
The following code should be used consistently across all DAs.
31
+
32
+
#### variables.tf:
32
33
33
34
```hcl
34
35
variable "prefix" {
35
36
type = string
36
37
nullable = true
37
-
description = "The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-0205-cos. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)."
38
+
description = "The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To skip using a prefix, set this value to `null` or an empty string. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)."
38
39
39
40
validation {
40
41
# - null and empty string is allowed
@@ -58,3 +59,18 @@ variable "prefix" {
58
59
}
59
60
}
60
61
```
62
+
63
+
#### ibm_catalog.json:
64
+
65
+
```json
66
+
{
67
+
"key": "prefix",
68
+
"value_constraints": [
69
+
{
70
+
"type": "regex",
71
+
"description": "Prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It must not end with a hyphen ('-'), and cannot contain consecutive hyphens ('--'). It should not exceed 16 characters.",
0 commit comments