1 min read

Development Infrastructure

Prerequisites

Steps

  1. Clone https://github.com/poqcommerce/Poq.Terraform.git repo
  2. Go to [your client name]/dev folder
  3. Create loc-westeurope.tf file with following information:
# Naming conventions are per this doc: https://docs.google.com/document/d/1MaxlO83-sTT01tBHSoyxMm_rB0iKSa0_xzJ8Mm3rzE8/edit#heading=h.seqf5unbk7w3
#
# poq-purpose-env-location-resourceKind[instanceNumber]
module "yourclientname_dev_westeurope" {
source = "../../modules/bfc/bfc_platform2"
client = "Your Client Name"
env = "dev"
location = "westeurope"
time_zone = "GMT Standard Time"
# Everything goes to a single RG
rg = {
name = "poq-yourclientname-dev-weu-rg"
}
# Single managed identity with AAD group to add it to
msi = {
name = "poq-yourclientname-dev-weu-id"
aad_group_name = "poq-yourclientname-dev-app"
}
# A list of app insights to create.
app_insights = [
{
name = "poq-yourclientname-dev-weu-appi"
}
]
# A list of app service plans to create.
app_service_plans = [
{
name = "poq-yourclientname-dev-weu-plan"
sku = {
tier = "Standard"
size = "S1"
}
auto_scaling = {
capacity_min = 1
capacity_default = 1
capacity_max = 2
ruleset_name = "dev_standard"
recurrence_profiles = [
{
name = "Scheduled scale down"
start_time = "22:00"
end_time = "06:59"
capacity_min = 1
capacity_max = 1
},
]
}
}
]
# Option 1: Add to the BFC Platform module, and use like this.
availability_alert_action_groups = [
{
action_group_name = "poq-yourclientname-dev-weu-availability-ag"
action_group_short_name = "DevP3" # this will show in SMS
slack_logic_app_name = "poq-yourclientname-dev-weu-availability-ag-slack-logic"
profile_name = "dev_standard"
enabled = true
}
]
app_alert_action_groups = [
{
action_group_name = "poq-yourclientname-dev-weu-app-ag"
action_group_short_name = "DevApp" # this will show in SMS
profile_name = "dev_standard"
enabled = true
},
{
action_group_name = "poq-yourclientname-dev-weu-app-info-ag"
action_group_short_name = "DevInfo" # this will show in SMS
profile_name = "dev_standard_info"
enabled = true
},
]
app_services = [
{
name = "poq-yourclientname-dev-weu-app"
app_service_plan_name = "poq-yourclientname-dev-weu-plan"
app_insights_name = "poq-yourclientname-dev-weu-appi"
ASPNETCORE_ENVIRONMENT = "Development"
# Required.
availability_alert = {
# Required.
enabled = true
# Required if enabled = true
action_group_name = "poq-yourclientname-dev-weu-availability-ag"
# Optional, default is ""
url_path = ""
}
# For now set as informational and see how it goes.
alert_failed_requests = {
enabled = true
action_group_name = "poq-yourclientname-dev-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
alert_response_time = {
enabled = true
action_group_name = "poq-yourclientname-dev-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
alert_http_5xx = {
enabled = true
action_group_name = "poq-yourclientname-dev-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
},
]
}
# REDIS
resource "azurerm_redis_cache" "yourclientname_dev_westeurope" {
depends_on = [
module.yourclientname_dev_westeurope
]
name = "poq-yourclientname-dev-weu-redis"
location = module.yourclientname_dev_westeurope.location
resource_group_name = module.yourclientname_dev_westeurope.rg.name
capacity = 0 #Basic/Standard: 0-6, Premium: 1-5. Basic/Standard Capacity Sizes: 0 = 0.25GB, 1 = 1GB, 2 = 2.5GB, 3 = 6GB, 4 = 13GB, 5 = 26GB, 6 = 53GB.
family = "C" #Basic/Standard: C, Premium: P.
sku_name = "Basic" #Basic, Standard, Premium.
enable_non_ssl_port = false
minimum_tls_version = "1.2"
redis_configuration {
}
}
  1. Replace yourClientName with proper client name everywhere in the file following the same naming convention, for ex: yourclientname -> amazingclient; Your Client Name -> Amazing Client
  2. Create PR
  3. Merge the PR
  4. Apply terraform scripts. In order for terraform scripts to take action they need to be applied. We are still in the process of defining how to better setup this process. If you have access to terraform console you can apply scripts by yourself, if you do not have access you should reach out to your Poq contact to apply scripts for you.
Congratulations, you have successfully created infrastructure for the Development environment.

See Next