Skip to content

Commit

Permalink
added Static Web App (Azure#96)
Browse files Browse the repository at this point in the history
* added stapp to resourceDefinition.json

Added Static Web App to resourceDefinition.json based on abbreviation from https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations

* added static web app resource
  • Loading branch information
TechnicallyJoe authored Nov 13, 2023
1 parent 4ca9561 commit 3c61c96
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ No modules.
| <a name="output_virtual_wan"></a> [virtual\_wan](#output\_virtual\_wan) | Virtual Wan |
| <a name="output_windows_virtual_machine"></a> [windows\_virtual\_machine](#output\_windows\_virtual\_machine) | Windows Virtual Machine |
| <a name="output_windows_virtual_machine_scale_set"></a> [windows\_virtual\_machine\_scale\_set](#output\_windows\_virtual\_machine\_scale\_set) | Windows Virtual Machine Scale Set |
| <a name="static_web_app"></a> [static\_web\_app](#output\_static_\_web\_app) | Static Web App |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

# Contributing
Expand Down
30 changes: 24 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ locals {
regex = "^[a-z0-9][a-zA-Z0-9-]+[a-z0-9]"
}
app_service_environment = {
name = substr(join("-", compact([local.prefix, "ase", local.suffix])), 0, 60)
name_unique = substr(join("-", compact([local.prefix, "ase", local.suffix_unique])), 0, 60)
name = substr(join("-", compact([local.prefix, "ase", local.suffix])), 0, 40)
name_unique = substr(join("-", compact([local.prefix, "ase", local.suffix_unique])), 0, 40)
dashes = true
slug = "ase"
min_length = 2
max_length = 60
scope = "resouceGroup"
regex = "^[a-z0-9][a-zA-Z0-9-]+[a-z0-9]"
min_length = 1
max_length = 40
scope = "resourceGroup"
regex = "^[a-zA-Z0-9-]+$"
}
app_service_plan = {
name = substr(join("-", compact([local.prefix, "plan", local.suffix])), 0, 40)
Expand Down Expand Up @@ -2086,6 +2086,16 @@ locals {
scope = "global"
regex = "^[a-z0-9][a-z0-9-]+[a-z0-9]$"
}
static_web_app = {
name = substr(join("-", compact([local.prefix, "stapp", local.suffix])), 0, 40)
name_unique = substr(join("-", compact([local.prefix, "stapp", local.suffix_unique])), 0, 40)
dashes = true
slug = "stapp"
min_length = 1
max_length = 40
scope = "resourceGroup"
regex = "^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$"
}
storage_account = {
name = substr(join("", compact([local.prefix_safe, "st", local.suffix_safe])), 0, 24)
name_unique = substr(join("", compact([local.prefix_safe, "st", local.suffix_unique_safe])), 0, 24)
Expand Down Expand Up @@ -2444,6 +2454,10 @@ locals {
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_environment = {
valid_name = length(regexall(local.az.app_service_environment.regex, local.az.app_service_environment.name)) > 0 && length(local.az.app_service_environment.name) > local.az.app_service_environment.min_length
valid_name_unique = length(regexall(local.az.app_service_environment.regex, local.az.app_service_environment.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
Expand Down Expand Up @@ -3244,6 +3258,10 @@ locals {
valid_name = length(regexall(local.az.sql_server.regex, local.az.sql_server.name)) > 0 && length(local.az.sql_server.name) > local.az.sql_server.min_length
valid_name_unique = length(regexall(local.az.sql_server.regex, local.az.sql_server.name_unique)) > 0
}
static_web_app = {
valid_name = length(regexall(local.az.static_web_app.regex, local.az.static_web_app.name)) > 0 && length(local.az.static_web_app.name) > local.az.static_web_app.min_length
valid_name_unique = length(regexall(local.az.static_web_app.regex, local.az.static_web_app.name_unique)) > 0
}
storage_account = {
valid_name = length(regexall(local.az.storage_account.regex, local.az.storage_account.name)) > 0 && length(local.az.storage_account.name) > local.az.storage_account.min_length
valid_name_unique = length(regexall(local.az.storage_account.regex, local.az.storage_account.name_unique)) > 0
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@ output "sql_server" {
description = "Sql Server"
}

output "static_web_app" {
value = local.az.static_web_app
description = "Static Web App"
}

output "storage_account" {
value = local.az.storage_account
description = "Storage Account"
Expand Down
11 changes: 11 additions & 0 deletions resourceDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -2264,5 +2264,16 @@
"scope": "resourceGroup",
"slug": "vmss",
"dashes": true
},
{
"name": "static_web_app",
"length": {
"min": 1,
"max": 40
},
"regex": "^(?=.{2,60}$)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$",
"scope": "resourceGroup",
"slug": "stapp",
"dashes": true
}
]

0 comments on commit 3c61c96

Please sign in to comment.