Skip to content

Commit

Permalink
Merge pull request #241 from Geeks-Academy/185
Browse files Browse the repository at this point in the history
Closes #185
  • Loading branch information
PiotrWachulec authored May 2, 2021
2 parents 17201bd + 72e81af commit aed85b2
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
12 changes: 11 additions & 1 deletion project-core/frankfurt.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@ environment_type = "dev"
vpc_cidr = "10.0.0.0/16"
public_subnets = ["10.0.10.0/24", "10.0.11.0/24", "10.0.12.0/24"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
azs = ["eu-central-1a", "eu-central-1b"]
azs = ["eu-central-1a", "eu-central-1b"]

# Azure
location = "westeurope"
mgmt_rg_name = "GA-MGMT"
mgmt_rg_lock_name = "GA-MGMT-RG-Lock"
budget_ag_name = "GA-Budget-AG"
budget_credit_card_owner_name = "PWachulec"
budget_credit_card_owner_email = "p.wachulec@gmail.com"
budget_slack_webhook_notification_name = "Slack notification"
budget_slack_webhook_notification_service_uri = "https://hooks.slack.com/services/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"
28 changes: 28 additions & 0 deletions project-core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@ module "bastion" {
vpc_id = module.vpc_common.vpc_id
}

resource "azurerm_resource_group" "mgmt_rg" {
name = var.mgmt_rg_name
location = var.location
}

resource "azurerm_management_lock" "mgmt_rg_lock" {
name = var.mgmt_rg_lock_name
scope = azurerm_resource_group.mgmt_rg.id
lock_level = "CanNotDelete"
notes = "This lock prevents before accidentaly removing the resource group with important resources, i.e. action group used for alarms in budget definition."
}

resource "azurerm_monitor_action_group" "name" {
name = var.budget_ag_name
short_name = var.budget_ag_name
resource_group_name = var.mgmt_rg_name

email_receiver {
name = var.budget_credit_card_owner_name
email_address = var.budget_credit_card_owner_email
}

webhook_receiver {
name = var.budget_slack_webhook_notification_name
service_uri = var.budget_slack_webhook_notification_service_uri
use_common_alert_schema = false
}
}

output "key_name" {
value = aws_key_pair.deployer.key_name
Expand Down
42 changes: 42 additions & 0 deletions project-core/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,45 @@ variable "account_number" {
description = "AWS account number"
}


# Azure

variable "location" {
type = string
description = "Location of the Azure resources"
}

variable "mgmt_rg_name" {
type = string
description = "RG for common resources"
}

variable "mgmt_rg_lock_name" {
type = string
description = "Lock prevents before accidentaly removing the resource group."
}

variable "budget_ag_name" {
type = string
description = "Name of the Action Group which will be notified when the budget will be burnt"
}

variable "budget_credit_card_owner_name" {
type = string
description = "The name of the person whose card is attached to the budget"
}

variable "budget_credit_card_owner_email" {
type = string
description = "The email address of the person whose card is attached to the budget"
}

variable "budget_slack_webhook_notification_name" {
type = string
description = "value"
}

variable "budget_slack_webhook_notification_service_uri" {
type = string
description = "value"
}

0 comments on commit aed85b2

Please sign in to comment.