Skip to content

Commit

Permalink
Simplify scheduling logic by removing non-prod schedules
Browse files Browse the repository at this point in the history
Removed conditional logic for non-prod scheduling and related variables to streamline environment management. All schedules now use uniform variables regardless of environment, reducing complexity and potential errors.
  • Loading branch information
adampie committed Aug 19, 2024
1 parent 1a363c4 commit 64a79f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
16 changes: 8 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ module "cloudwatch-event" {
lambda_function_alias_names = module.lambda.lambda_function_alias_names
schedule = var.reports_schedule
takeover = local.takeover
update_schedule = local.env == local.production_environment ? var.update_schedule : var.update_schedule_nonprod
update_schedule = var.update_schedule
update_lambdas = var.update_lambdas
environment = local.env
}
Expand All @@ -185,7 +185,7 @@ module "resources-event" {
lambda_function_alias_names = module.lambda-resources[0].lambda_function_alias_names
schedule = var.reports_schedule
takeover = local.takeover
update_schedule = local.env == local.production_environment ? var.scan_schedule : var.scan_schedule_nonprod
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
}
Expand All @@ -196,9 +196,9 @@ module "accounts-event" {
lambda_function_arns = module.lambda-accounts.lambda_function_arns
lambda_function_names = module.lambda-accounts.lambda_function_names
lambda_function_alias_names = module.lambda-accounts.lambda_function_alias_names
schedule = local.env == local.production_environment ? var.scan_schedule : var.scan_schedule_nonprod
schedule = var.scan_schedule
takeover = local.takeover
update_schedule = local.env == local.production_environment ? var.scan_schedule : var.scan_schedule_nonprod
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
}
Expand Down Expand Up @@ -253,9 +253,9 @@ module "cloudflare-event" {
lambda_function_arns = module.lambda-cloudflare[0].lambda_function_arns
lambda_function_names = module.lambda-cloudflare[0].lambda_function_names
lambda_function_alias_names = module.lambda-cloudflare[0].lambda_function_alias_names
schedule = local.env == local.production_environment ? var.scan_schedule : var.scan_schedule_nonprod
schedule = var.scan_schedule
takeover = local.takeover
update_schedule = local.env == local.production_environment ? var.scan_schedule : var.scan_schedule_nonprod
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
}
Expand Down Expand Up @@ -389,9 +389,9 @@ module "accounts-event-ips" {
lambda_function_arns = module.lambda-accounts-ips[0].lambda_function_arns
lambda_function_names = module.lambda-accounts-ips[0].lambda_function_names
lambda_function_alias_names = module.lambda-accounts-ips[0].lambda_function_alias_names
schedule = local.env == local.production_environment ? var.ip_scan_schedule : var.ip_scan_schedule_nonprod
schedule = var.ip_scan_schedule
takeover = local.takeover
update_schedule = local.env == local.production_environment ? var.ip_scan_schedule : var.ip_scan_schedule_nonprod
update_schedule = var.ip_scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
}
Expand Down
15 changes: 0 additions & 15 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,16 @@ variable "scan_schedule" {
default = "60 minutes"
}

variable "scan_schedule_nonprod" {
description = "schedule for running domain-protect scans in non-prod, reduced to save costs, e.g. 12 hours"
default = "24 hours"
}

variable "update_schedule" {
description = "schedule for running domain-protect update function, e.g. 60 minutes"
default = "3 hours"
}

variable "update_schedule_nonprod" {
description = "schedule for running domain-protect update function in non-prod, e.g. 12 hours"
default = "24 hours"
}

variable "ip_scan_schedule" {
description = "schedule for IP address scanning used in A record checks"
default = "24 hours"
}

variable "ip_scan_schedule_nonprod" {
description = "schedule for IP address scans in non-prod, reduced to save costs, e.g. 24 hours"
default = "24 hours"
}

variable "stats_schedule" {
description = "Cron schedule for the stats message"
default = "cron(0 9 1 * ? *)" # 9am on the first of the month
Expand Down

0 comments on commit 64a79f5

Please sign in to comment.