diff --git a/examples/pagerduty-service-integration-email/inputs.tf b/examples/pagerduty-service-integration-email/inputs.tf index f6a4918..c2e7b1b 100644 --- a/examples/pagerduty-service-integration-email/inputs.tf +++ b/examples/pagerduty-service-integration-email/inputs.tf @@ -13,10 +13,12 @@ variable "email_filter" { from_email_regex = string subject_regex = string }) + default = { from_email_regex = null subject_regex = null } + description = <<-EOT email_filter = { from_email_regex : "The regex used to match the 'from' field in the inbound email. Should be a valid regex or null" diff --git a/modules/honest-two-level-schedule/inputs.tf b/modules/honest-two-level-schedule/inputs.tf index fcb5651..8983a5c 100644 --- a/modules/honest-two-level-schedule/inputs.tf +++ b/modules/honest-two-level-schedule/inputs.tf @@ -11,6 +11,7 @@ variable "name" { variable "rotation_turn_length_seconds" { description = "The time in seconds each individual is on-call for." type = number + validation { condition = var.rotation_turn_length_seconds > 0 error_message = "Rotation turn length must be greater than 0." @@ -32,6 +33,7 @@ variable "time_zone" { variable "user_ids" { description = "An ordered list of PagerDuty User IDs to add to the schedule. The individual's order in the schedule depends on the order of this list." type = list(string) + validation { # This validation does not catch repeating user IDs with different cases (uppercase/lowercase, etc) # So duplicate values of "A" and "a" will be allowed. @@ -40,6 +42,7 @@ variable "user_ids" { length(distinct(var.user_ids)) == length(var.user_ids), length(distinct([for u in var.user_ids : lower(u)])) == length(var.user_ids), ]) + error_message = "At least two unique responders are required to build a two-level schedule. Repeated values are not allowed." } } diff --git a/modules/pagerduty-service-integration-email/generic-email-inbound-integration.tf b/modules/pagerduty-service-integration-email/generic-email-inbound-integration.tf index 495aefd..dcc8ed0 100644 --- a/modules/pagerduty-service-integration-email/generic-email-inbound-integration.tf +++ b/modules/pagerduty-service-integration-email/generic-email-inbound-integration.tf @@ -7,6 +7,7 @@ resource "pagerduty_service_integration" "generic_email_inbound_integration" { # hardcoded because this is a generic_email_inbound_integration module. type = "generic_email_inbound_integration" email_incident_creation = var.email_incident_creation + email_filter { # v1 we don't expose this yet. body_mode = "always" diff --git a/modules/pagerduty-service-integration-email/inputs.tf b/modules/pagerduty-service-integration-email/inputs.tf index cdc3e8f..6fccca8 100644 --- a/modules/pagerduty-service-integration-email/inputs.tf +++ b/modules/pagerduty-service-integration-email/inputs.tf @@ -16,6 +16,7 @@ variable "integration_email" { variable "email_incident_creation" { default = "use_rules" description = "Behaviour of Email Management feature (explained in PD docs)[https://support.pagerduty.com/docs/email-management-filters-and-rules#control-when-a-new-incident-or-alert-is-triggered]. Can be on_new_email, on_new_email_subject, only_if_no_open_incidents or use_rules." + validation { condition = contains(["on_new_email", "on_new_email_subject", "only_if_no_open_incidents", "use_rules"], var.email_incident_creation) error_message = "Invalid value passed to email_incident_creation. Must be one of on_new_email, on_new_email_subject, only_if_no_open_incidents or use_rules." @@ -27,10 +28,12 @@ variable "email_filter" { from_email_regex = string subject_regex = string }) + default = { from_email_regex = null subject_regex = null } + description = <<-EOT email_filter = { from_email_regex : "The regex used to match the 'from' field in the inbound email. Should be a valid regex or null" diff --git a/modules/pagerduty-user/inputs.tf b/modules/pagerduty-user/inputs.tf index 0a77a98..12564f3 100644 --- a/modules/pagerduty-user/inputs.tf +++ b/modules/pagerduty-user/inputs.tf @@ -12,6 +12,7 @@ variable "role" { default = "user" description = "The user's role in PagerDuty. Can be `admin`, `limited_user`, `read_only_user` (Full Stakeholder), or `user`." type = string + validation { condition = anytrue([ var.role == "admin", @@ -19,6 +20,7 @@ variable "role" { var.role == "read_only_user", var.role == "user", ]) + error_message = "role must be one of `admin`, `limited_user`, `read_only_user`, or `user`." } }