Skip to content

Commit 2693bd8

Browse files
authored
fix: added validation for the managed_domain_mappings input (#138)
1 parent 533f5f7 commit 2693bd8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

modules/app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ No modules.
5858
| <a name="input_image_port"></a> [image\_port](#input\_image\_port) | The port which is used to connect to the port that is exposed by the container image. | `number` | `8080` | no |
5959
| <a name="input_image_reference"></a> [image\_reference](#input\_image\_reference) | The name of the image that is used for the app. | `string` | n/a | yes |
6060
| <a name="input_image_secret"></a> [image\_secret](#input\_image\_secret) | The name of the image registry access secret. | `string` | `null` | no |
61-
| <a name="input_managed_domain_mappings"></a> [managed\_domain\_mappings](#input\_managed\_domain\_mappings) | Define which of the system managed domain mappings will be setup for the application. Valid values are 'local\_public', 'local\_private' and 'local'. | `string` | `null` | no |
61+
| <a name="input_managed_domain_mappings"></a> [managed\_domain\_mappings](#input\_managed\_domain\_mappings) | Define which of the following values for the system-managed domain mappings to set up for the application: `local_public`, `local_private`, and `local`. See https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads#optionsvisibility | `string` | `null` | no |
6262
| <a name="input_name"></a> [name](#input\_name) | The name of the app. | `string` | n/a | yes |
6363
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | The ID of the project where app will be created. | `string` | n/a | yes |
6464
| <a name="input_run_arguments"></a> [run\_arguments](#input\_run\_arguments) | Arguments for the app that are passed to start the container. | `list(string)` | `[]` | no |

modules/app/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ variable "image_port" {
5454
}
5555

5656
variable "managed_domain_mappings" {
57-
description = "Define which of the system managed domain mappings will be setup for the application. Valid values are 'local_public', 'local_private' and 'local'."
57+
description = "Define which of the following values for the system-managed domain mappings to set up for the application: `local_public`, `local_private`, and `local`. See https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads#optionsvisibility"
5858
type = string
5959
default = null
60+
validation {
61+
condition = var.managed_domain_mappings == null || can(regex("local_public|local_private|local", var.managed_domain_mappings))
62+
error_message = "Valid values are 'local_public', 'local_private', or 'local'."
63+
}
6064
}
6165

6266
variable "run_arguments" {

solutions/apps/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ variable "image_port" {
9595
}
9696

9797
variable "managed_domain_mappings" {
98-
description = "Specify which of the following values for the system-managed domain mappings to set up for the application: `local_public`, `local_private`, and `local`."
98+
description = "Define which of the following values for the system-managed domain mappings to set up for the application: `local_public`, `local_private`, and `local`. See https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads#optionsvisibility"
9999
type = string
100100
default = null
101+
validation {
102+
condition = var.managed_domain_mappings == null || can(regex("local_public|local_private|local", var.managed_domain_mappings))
103+
error_message = "Valid values are 'local_public', 'local_private', or 'local'."
104+
}
101105
}
102106

103107
variable "run_arguments" {

0 commit comments

Comments
 (0)