Skip to content

Commit

Permalink
chore: rm slack and takeover dev env
Browse files Browse the repository at this point in the history
Signed-off-by: nitrocode <[email protected]>
  • Loading branch information
nitrocode committed Aug 23, 2024
1 parent dd745c6 commit b72ffe3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
1 change: 0 additions & 1 deletion locals.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
locals {
env = coalesce(var.environment, lower(terraform.workspace))
production_environment = coalesce(var.production_environment, var.production_workspace)
takeover = var.takeover == true && local.env == var.production_workspace ? true : false
}
26 changes: 13 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module "lambda_slack" {
kms_arn = module.kms.kms_arn
sns_topic_arn = module.sns.sns_topic_arn
dlq_sns_topic_arn = module.sns_dead_letter_queue.sns_topic_arn
slack_channels = local.env == "dev" ? var.slack_channels_dev : var.slack_channels
slack_webhook_urls = local.env == "dev" && length(var.slack_webhook_urls_dev) > 0 ? var.slack_webhook_urls_dev : var.slack_webhook_urls
slack_channels = var.slack_channels
slack_webhook_urls = var.slack_webhook_urls
slack_webhook_type = var.slack_webhook_type
slack_emoji = var.slack_emoji
slack_fix_emoji = var.slack_fix_emoji
Expand Down Expand Up @@ -118,7 +118,7 @@ module "lambda_scan" {

module "lambda_takeover" {
#checkov:skip=CKV_AWS_274:role is ElasticBeanstalk admin, not full Administrator Access
count = local.takeover ? 1 : 0
count = var.takeover ? 1 : 0
source = "./terraform-modules/lambda-takeover"

runtime = var.runtime
Expand All @@ -133,21 +133,21 @@ module "lambda_takeover" {
}

module "takeover_role" {
count = local.takeover ? 1 : 0
count = var.takeover ? 1 : 0
source = "./terraform-modules/iam"

project = var.project
region = var.region
security_audit_role_name = var.security_audit_role_name
kms_arn = module.kms.kms_arn
takeover = local.takeover
takeover = var.takeover
policy = "takeover"
permissions_boundary_arn = var.permissions_boundary_arn
environment = local.env
}

module "lambda_resources" {
count = local.takeover ? 1 : 0
count = var.takeover ? 1 : 0
source = "./terraform-modules/lambda-resources"

lambdas = ["resources"]
Expand All @@ -162,7 +162,7 @@ module "lambda_resources" {
}

module "resources_role" {
count = local.takeover ? 1 : 0
count = var.takeover ? 1 : 0
source = "./terraform-modules/iam"

project = var.project
Expand All @@ -182,22 +182,22 @@ module "cloudwatch_event" {
lambda_function_names = module.lambda.lambda_function_names
lambda_function_alias_names = module.lambda.lambda_function_alias_names
schedule = var.reports_schedule
takeover = local.takeover
takeover = var.takeover
update_schedule = var.update_schedule
update_lambdas = var.update_lambdas
environment = local.env
}

module "resources_event" {
count = local.takeover ? 1 : 0
count = var.takeover ? 1 : 0
source = "./terraform-modules/cloudwatch"

project = var.project
lambda_function_arns = module.lambda_resources[0].lambda_function_arns
lambda_function_names = module.lambda_resources[0].lambda_function_names
lambda_function_alias_names = module.lambda_resources[0].lambda_function_alias_names
schedule = var.reports_schedule
takeover = local.takeover
takeover = var.takeover
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
Expand All @@ -211,7 +211,7 @@ module "accounts_event" {
lambda_function_names = module.lambda_accounts.lambda_function_names
lambda_function_alias_names = module.lambda_accounts.lambda_function_alias_names
schedule = var.scan_schedule
takeover = local.takeover
takeover = var.takeover
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
Expand Down Expand Up @@ -272,7 +272,7 @@ module "cloudflare_event" {
lambda_function_names = module.lambda_cloudflare[0].lambda_function_names
lambda_function_alias_names = module.lambda_cloudflare[0].lambda_function_alias_names
schedule = var.scan_schedule
takeover = local.takeover
takeover = var.takeover
update_schedule = var.scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
Expand Down Expand Up @@ -418,7 +418,7 @@ module "accounts_event_ips" {
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 = var.ip_scan_schedule
takeover = local.takeover
takeover = var.takeover
update_schedule = var.ip_scan_schedule
update_lambdas = var.update_lambdas
environment = local.env
Expand Down
12 changes: 0 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,12 @@ variable "slack_channels" {
type = list(any)
}

variable "slack_channels_dev" {
description = "List of Slack Channels to use for testing purposes with dev environment - enter in tfvars file"
default = []
type = list(any)
}

variable "slack_webhook_urls" {
description = "List of Slack webhook URLs, in the same order as the slack_channels list - enter in tfvars file"
default = []
type = list(any)
}

variable "slack_webhook_urls_dev" {
description = "List of Slack app webhook URLs for dev environments in the same order as the slack_channels list - enter in tfvars file"
default = []
type = list(any)
}

variable "slack_webhook_type" {
description = "Slack webhook type, can be legacy or app"
default = "legacy"
Expand Down

0 comments on commit b72ffe3

Please sign in to comment.