Skip to content

Commit

Permalink
Solves Issue 41 - adds app_service and app_service_plan (Azure#46)
Browse files Browse the repository at this point in the history
* adds support for app service plan and app service

* fix regexes according to docs
  • Loading branch information
nils-woxholt authored Dec 8, 2020
1 parent e62ac76 commit 64b9489
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ postgresql_server = {
| analysis\_services\_server | n/a |
| api\_management | n/a |
| app\_configuration | n/a |
| app\_service | n/a |
| app\_service\_plan | n/a |
| application\_insights | n/a |
| application\_gateway | n/a |
| application\_security\_group | n/a |
Expand Down
2 changes: 1 addition & 1 deletion docs/defined_specs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ az = {
service_fabric = "sf"
app_service_environment = "ase"
app_service_plan = "plan"
web_app = "app"
web_app = "app" // this is an app_service in terraform
function_app = "func"
cloud_service = "cld"
notification_hubs = "ntf"
Expand Down
28 changes: 28 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ locals {
scope = "resourceGroup"
regex = "^[a-zA-Z0-9_-]+$"
}
app_service = {
name = substr(join("-", compact([local.prefix, "app", local.suffix])), 0, 60)
name_unique = substr(join("-", compact([local.prefix, "app", local.suffix_unique])), 0, 60)
dashes = true
slug = "app"
min_length = 2
max_length = 60
scope = "global"
regex = "^[a-z0-9][a-zA-Z0-9-]+[a-z0-9]"
}
app_service_plan = {
name = substr(join("-", compact([local.prefix, "plan", local.suffix])), 0, 40)
name_unique = substr(join("-", compact([local.prefix, "plan", local.suffix_unique])), 0, 40)
dashes = true
slug = "plan"
min_length = 1
max_length = 40
scope = "resourceGroup"
regex = "^[a-zA-Z0-9-]+$"
}
application_gateway = {
name = substr(join("-", compact([local.prefix, "agw", local.suffix])), 0, 80)
name_unique = substr(join("-", compact([local.prefix, "agw", local.suffix_unique])), 0, 80)
Expand Down Expand Up @@ -2240,6 +2260,14 @@ locals {
valid_name = length(regexall(local.az.app_configuration.regex, local.az.app_configuration.name)) > 0 && length(local.az.app_configuration.name) > local.az.app_configuration.min_length
valid_name_unique = length(regexall(local.az.app_configuration.regex, local.az.app_configuration.name_unique)) > 0
}
app_service = {
valid_name = length(regexall(local.az.app_service.regex, local.az.app_service.name)) > 0 && length(local.az.app_service.name) > local.az.app_service.min_length
valid_name_unique = length(regexall(local.az.app_service.regex, local.az.app_service.name_unique)) > 0
}
app_service_plan = {
valid_name = length(regexall(local.az.app_service_plan.regex, local.az.app_service_plan.name)) > 0 && length(local.az.app_service_plan.name) > local.az.app_service_plan.min_length
valid_name_unique = length(regexall(local.az.app_service_plan.regex, local.az.app_service_plan.name_unique)) > 0
}
application_gateway = {
valid_name = length(regexall(local.az.application_gateway.regex, local.az.application_gateway.name)) > 0 && length(local.az.application_gateway.name) > local.az.application_gateway.min_length
valid_name_unique = length(regexall(local.az.application_gateway.regex, local.az.application_gateway.name_unique)) > 0
Expand Down
8 changes: 8 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ output "app_configuration" {
value = local.az.app_configuration
}

output "app_service" {
value = local.az.app_service
}

output "app_service_plan" {
value = local.az.app_service_plan
}

output "application_gateway" {
value = local.az.application_gateway
}
Expand Down
22 changes: 22 additions & 0 deletions resourceDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@
"slug": "appcg",
"dashes": true
},
{
"name": "app_service_plan",
"length": {
"min": 1,
"max": 40
},
"regex": "^(?=.{1,40}$)[a-zA-Z0-9-]+$",
"scope": "resourceGroup",
"slug": "plan",
"dashes": true
},
{
"name": "app_service",
"length": {
"min": 2,
"max": 60
},
"regex": "^(?=.{2,60}$)[a-z0-9][a-zA-Z0-9-]+[a-z0-9]",
"scope": "global",
"slug": "app",
"dashes": true
},
{
"name": "application_gateway",
"length": {
Expand Down

0 comments on commit 64b9489

Please sign in to comment.