Skip to content

Commit

Permalink
fix: add extra validation to the global_event_routing_settings to e…
Browse files Browse the repository at this point in the history
…nsure only one of the supported target regions are passed. Supported regions are currently "eu-gb", "eu-de", "au-syd", "us-east", "us-south", "eu-es" (#401)
  • Loading branch information
shemau authored Nov 27, 2023
1 parent 0874a24 commit 413e582
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/observability_at_event_routing/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ variable "metadata_region_backup" {
variable "permitted_target_regions" {
type = list(string)
description = "List of regions where target can be defined."
default = ["us-south", "eu-de", "us-east", "eu-gb", "au-syd"]
default = ["us-south", "eu-de", "us-east", "eu-es", "eu-gb", "au-syd"]
}

variable "private_api_endpoint_only" {
Expand Down
12 changes: 12 additions & 0 deletions modules/activity_tracker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,16 @@ variable "global_event_routing_settings" {
})
description = "Global settings for event routing"
default = null

# https://cloud.ibm.com/docs/atracker?topic=atracker-regions#regions-atracker
validation {
error_message = "Valid regions for permitted_target_regions are: [eu-gb eu-de au-syd us-east us-south eu-es]"
condition = (var.global_event_routing_settings == null ?
true :
alltrue([
for region in var.global_event_routing_settings.permitted_target_regions :
contains(["eu-gb", "eu-de", "au-syd", "us-east", "us-south", "eu-es"], region)
])
)
}
}

0 comments on commit 413e582

Please sign in to comment.