Родитель
232465899b
Коммит
cf68cd626d
|
@ -127,10 +127,10 @@ You can find a list bellow of all the resources that are currently implemented.
|
|||
| data\_lake\_store\_firewall\_rule | n/a |
|
||||
| database\_migration\_project | n/a |
|
||||
| database\_migration\_service | n/a |
|
||||
| databricks\_workspace | n/a |
|
||||
| databricks\_cluster | n/a |
|
||||
| databricks\_standard\_cluster | n/a |
|
||||
| databricks\_high\_concurrency\_cluster | n/a |
|
||||
| databricks\_standard\_cluster | n/a |
|
||||
| databricks\_workspace | n/a |
|
||||
| dev\_test\_lab | n/a |
|
||||
| dev\_test\_linux\_virtual\_machine | n/a |
|
||||
| dev\_test\_windows\_virtual\_machine | n/a |
|
||||
|
@ -230,11 +230,15 @@ You can find a list bellow of all the resources that are currently implemented.
|
|||
| private\_dns\_zone | n/a |
|
||||
| private\_dns\_zone\_group | n/a |
|
||||
| private\_endpoint | n/a |
|
||||
| private\_link\_service | n/a |
|
||||
| private\_service\_connection | n/a |
|
||||
| proximity\_placement\_group | n/a |
|
||||
| public\_ip | n/a |
|
||||
| public\_ip\_prefix | n/a |
|
||||
| redis\_cache | n/a |
|
||||
| redis\_firewall\_rule | n/a |
|
||||
| relay\_hybrid\_connection | n/a |
|
||||
| relay\_namespace | n/a |
|
||||
| resource\_group | n/a |
|
||||
| role\_assignment | n/a |
|
||||
| role\_definition | n/a |
|
||||
|
@ -280,6 +284,7 @@ You can find a list bellow of all the resources that are currently implemented.
|
|||
| template\_deployment | n/a |
|
||||
| traffic\_manager\_profile | n/a |
|
||||
| unique-seed | n/a |
|
||||
| validation | n/a |
|
||||
| virtual\_machine | n/a |
|
||||
| virtual\_machine\_extension | n/a |
|
||||
| virtual\_machine\_scale\_set | n/a |
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
- managed_application_definition
|
||||
- managed_application
|
||||
- proximity_placement_group
|
||||
- shared_image_version
|
||||
- orchestrated_virtual_machine_scale_set / preview
|
||||
- sql_virtual_network_rule
|
||||
|
@ -23,15 +22,12 @@
|
|||
- management_group
|
||||
- media_services_account
|
||||
- spatial_anchors_account
|
||||
- relay_hybrid_connection
|
||||
- relay_namespace
|
||||
- scheduled_query_rule_log
|
||||
- express_route_circuit_authorization
|
||||
- nat_gateway
|
||||
- network_packet_capture
|
||||
- network_profile
|
||||
- packet_capture //deprecated
|
||||
- private_link_service
|
||||
- web_application_firewall_policy
|
||||
- netapp_account
|
||||
- netapp_pool
|
||||
|
|
|
@ -46,3 +46,7 @@ module "everything" {
|
|||
output "everything" {
|
||||
value = module.everything.storage_account.name_unique
|
||||
}
|
||||
|
||||
output "validation_everything" {
|
||||
value = module.everything.validation
|
||||
}
|
||||
|
|
9
main.go
9
main.go
|
@ -5,6 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
|
@ -33,7 +34,13 @@ func main() {
|
|||
for i, file := range files {
|
||||
fileNames[i] = "templates/" + file.Name()
|
||||
}
|
||||
parsedTemplate, err := template.ParseFiles(fileNames...)
|
||||
parsedTemplate, err := template.New("templates").Funcs(template.FuncMap{
|
||||
// Terraform not yet support lookahead in their regex function
|
||||
"cleanRegex": func(dirtyString string) string {
|
||||
var re = regexp.MustCompile(`(?m)\(\?=.{\d+,\d+}\$\)|\(\?!\.\*--\)`)
|
||||
return re.ReplaceAllString(dirtyString, "")
|
||||
},
|
||||
}).ParseFiles(fileNames...)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
1404
main.tf
1404
main.tf
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
44
outputs.tf
44
outputs.tf
|
@ -2,6 +2,10 @@
|
|||
output "unique-seed" {
|
||||
value = coalesce(var.unique-seed, local.random_safe_generation)
|
||||
}
|
||||
|
||||
output "validation" {
|
||||
value = local.validation
|
||||
}
|
||||
output "analysis_services_server" {
|
||||
value = local.az.analysis_services_server
|
||||
}
|
||||
|
@ -234,18 +238,6 @@ output "databricks_workspace" {
|
|||
value = local.az.databricks_workspace
|
||||
}
|
||||
|
||||
output "databricks_cluster" {
|
||||
value = local.az.databricks_cluster
|
||||
}
|
||||
|
||||
output "databricks_standard_cluster" {
|
||||
value = local.az.databricks_standard_cluster
|
||||
}
|
||||
|
||||
output "databricks_high_concurrency_cluster" {
|
||||
value = local.az.databricks_high_concurrency_cluster
|
||||
}
|
||||
|
||||
output "kusto_cluster" {
|
||||
value = local.az.kusto_cluster
|
||||
}
|
||||
|
@ -754,6 +746,14 @@ output "eventgrid_topic" {
|
|||
value = local.az.eventgrid_topic
|
||||
}
|
||||
|
||||
output "relay_namespace" {
|
||||
value = local.az.relay_namespace
|
||||
}
|
||||
|
||||
output "relay_hybrid_connection" {
|
||||
value = local.az.relay_hybrid_connection
|
||||
}
|
||||
|
||||
output "private_endpoint" {
|
||||
value = local.az.private_endpoint
|
||||
}
|
||||
|
@ -854,4 +854,24 @@ output "private_dns_zone_group" {
|
|||
value = local.az.private_dns_zone_group
|
||||
}
|
||||
|
||||
output "proximity_placement_group" {
|
||||
value = local.az.proximity_placement_group
|
||||
}
|
||||
|
||||
output "private_link_service" {
|
||||
value = local.az.private_link_service
|
||||
}
|
||||
|
||||
output "databricks_cluster" {
|
||||
value = local.az.databricks_cluster
|
||||
}
|
||||
|
||||
output "databricks_standard_cluster" {
|
||||
value = local.az.databricks_standard_cluster
|
||||
}
|
||||
|
||||
output "databricks_high_concurrency_cluster" {
|
||||
value = local.az.databricks_high_concurrency_cluster
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "global",
|
||||
"slug": "bot",
|
||||
"dashes": true
|
||||
|
@ -181,7 +181,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botmail",
|
||||
"dashes": true
|
||||
|
@ -192,7 +192,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botteams",
|
||||
"dashes": true
|
||||
|
@ -203,7 +203,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botslack",
|
||||
"dashes": true
|
||||
|
@ -214,7 +214,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botline",
|
||||
"dashes": true
|
||||
|
@ -225,7 +225,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botchan",
|
||||
"dashes": true
|
||||
|
@ -236,7 +236,7 @@
|
|||
"min": 2,
|
||||
"max": 64
|
||||
},
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9_-.]+$",
|
||||
"regex": "^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$",
|
||||
"scope": "parent",
|
||||
"slug": "botcon",
|
||||
"dashes": true
|
||||
|
@ -316,7 +316,7 @@
|
|||
"regex": "^(?=.{1,80}$)[a-zA-Z0-9_]+$",
|
||||
"scope": "resourceGroup",
|
||||
"slug": "des",
|
||||
"dashes": true
|
||||
"dashes": false
|
||||
},
|
||||
{
|
||||
"name": "image",
|
||||
|
@ -360,7 +360,7 @@
|
|||
"regex": "^(?=.{1,80}$)[a-zA-Z0-9_]+$",
|
||||
"scope": "resourceGroup",
|
||||
"slug": "dsk",
|
||||
"dashes": true
|
||||
"dashes": false
|
||||
},
|
||||
{
|
||||
"name": "virtual_machine",
|
||||
|
@ -637,39 +637,6 @@
|
|||
"slug": "dbw",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "databricks_cluster",
|
||||
"length": {
|
||||
"min": 3,
|
||||
"max": 30
|
||||
},
|
||||
"regex": "^(?=.{3,30}$)[a-zA-Z0-9-_]+$",
|
||||
"scope": "parent",
|
||||
"slug": "dbc",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "databricks_standard_cluster",
|
||||
"length": {
|
||||
"min": 3,
|
||||
"max": 30
|
||||
},
|
||||
"regex": "^(?=.{3,30}$)[a-zA-Z0-9-_]+$",
|
||||
"scope": "parent",
|
||||
"slug": "dbsc",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "databricks_high_concurrency_cluster",
|
||||
"length": {
|
||||
"min": 3,
|
||||
"max": 30
|
||||
},
|
||||
"regex": "^(?=.{3,30}$)[a-zA-Z0-9-_]+$",
|
||||
"scope": "parent",
|
||||
"slug": "dbhcc",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "kusto_cluster",
|
||||
"length": {
|
||||
|
@ -1930,7 +1897,7 @@
|
|||
"min": 1,
|
||||
"max": 260
|
||||
},
|
||||
"regex": "^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-._\\\\/\\\\]+[a-zA-Z0-9_]$",
|
||||
"regex": "^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-._]+[a-zA-Z0-9_]$",
|
||||
"scope": "parent",
|
||||
"slug": "sbq",
|
||||
"dashes": true
|
||||
|
@ -1974,7 +1941,7 @@
|
|||
"min": 1,
|
||||
"max": 260
|
||||
},
|
||||
"regex": "^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-._\\\\/\\\\]+[a-zA-Z0-9]$",
|
||||
"regex": "^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-._]+[a-zA-Z0-9]$",
|
||||
"scope": "parent",
|
||||
"slug": "sbt",
|
||||
"dashes": true
|
||||
|
@ -2018,8 +1985,8 @@
|
|||
"min": 3,
|
||||
"max": 63
|
||||
},
|
||||
"regex": "^(?=.{3,63$)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$",
|
||||
"scope": "parent",
|
||||
"regex": "^(?=.{3,63}$)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$",
|
||||
"scope": "global",
|
||||
"slug": "sgnlr",
|
||||
"dashes": true
|
||||
},
|
||||
|
@ -2066,5 +2033,27 @@
|
|||
"scope": "resourceGroup",
|
||||
"slug": "egt",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "relay_namespace",
|
||||
"length": {
|
||||
"min": 6,
|
||||
"max": 50
|
||||
},
|
||||
"regex": "^(?=.{6,50}$)[a-zA-Z][a-zA-Z0-9-]+[a-zA-Z0-9]$",
|
||||
"scope": "global",
|
||||
"slug": "rln",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "relay_hybrid_connection",
|
||||
"length": {
|
||||
"min": 1,
|
||||
"max": 260
|
||||
},
|
||||
"regex": "^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-._]+[a-zA-Z0-9]$",
|
||||
"scope": "parent",
|
||||
"slug": "rlhc",
|
||||
"dashes": true
|
||||
}
|
||||
]
|
||||
]
|
|
@ -274,6 +274,28 @@
|
|||
"slug": "pdnszg",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "proximity_placement_group",
|
||||
"length": {
|
||||
"min": 1,
|
||||
"max": 80
|
||||
},
|
||||
"regex": "^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-._]+[a-zA-Z0-9_]$",
|
||||
"scope": "resourceGroup",
|
||||
"slug": "ppg",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "private_link_service",
|
||||
"length": {
|
||||
"min": 1,
|
||||
"max": 80
|
||||
},
|
||||
"regex": "^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-._]+[a-zA-Z0-9_]$",
|
||||
"scope": "resourceGroup",
|
||||
"slug": "pls",
|
||||
"dashes": true
|
||||
},
|
||||
{
|
||||
"name": "databricks_cluster",
|
||||
"length": {
|
||||
|
@ -307,4 +329,4 @@
|
|||
"slug": "dbhcc",
|
||||
"dashes": true
|
||||
}
|
||||
]
|
||||
]
|
|
@ -1,16 +1,24 @@
|
|||
{{- define "resources" -}}
|
||||
{{- .Name }} = {
|
||||
name = substr(join("{{if .Dashes}}-{{ end }}", compact([local.prefix{{if not .Dashes}}_safe{{ end }}, "{{ .Slug }}", local.suffix{{if not .Dashes}}_safe{{ end }}])), 0, {{ .Length.Max }})
|
||||
name_unique = substr(join("{{if .Dashes}}-{{ end }}", compact([local.prefix{{if not .Dashes}}_safe{{ end }}, "{{ .Slug }}", local.suffix_unique{{if not .Dashes}}_safe{{ end }}])), 0, {{ .Length.Max }})
|
||||
dashes = {{ .Dashes }}
|
||||
slug = "{{ .Slug }}"
|
||||
min_length = {{ .Length.Min }}
|
||||
max_length = {{ .Length.Max }}
|
||||
scope = "{{ .Scope }}"
|
||||
regex = "/{{ .Regex }}/"
|
||||
name = substr(join("{{if .Dashes}}-{{ end }}", compact([local.prefix{{if not .Dashes}}_safe{{ end }}, "{{ .Slug }}", local.suffix{{if not .Dashes}}_safe{{ end }}])), 0, {{ .Length.Max }})
|
||||
name_unique = substr(join("{{if .Dashes}}-{{ end }}", compact([local.prefix{{if not .Dashes}}_safe{{ end }}, "{{ .Slug }}", local.suffix_unique{{if not .Dashes}}_safe{{ end }}])), 0, {{ .Length.Max }})
|
||||
dashes = {{ .Dashes }}
|
||||
slug = "{{ .Slug }}"
|
||||
min_length = {{ .Length.Min }}
|
||||
max_length = {{ .Length.Max }}
|
||||
scope = "{{ .Scope }}"
|
||||
regex = "{{ cleanRegex .Regex }}"
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "validation" -}}
|
||||
{{- .Name }} = {
|
||||
valid_name = length(regexall(local.az.{{- .Name }}.regex, local.az.{{- .Name }}.name)) > 0 && length(local.az.{{- .Name }}.name) > local.az.{{- .Name }}.min_length
|
||||
valid_name_unique = length(regexall(local.az.{{- .Name }}.regex, local.az.{{- .Name }}.name_unique)) > 0
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
|
||||
{{- define "main" -}}
|
||||
provider "random" {
|
||||
|
@ -50,5 +58,10 @@ locals {
|
|||
{{ template "resources" .}}
|
||||
{{- end }}
|
||||
}
|
||||
validation = {
|
||||
{{- range . }}
|
||||
{{ template "validation" .}}
|
||||
{{- end }}
|
||||
}
|
||||
}
|
||||
{{ end }}
|
|
@ -9,6 +9,10 @@ output "unique-seed" {
|
|||
value = coalesce(var.unique-seed, local.random_safe_generation)
|
||||
}
|
||||
|
||||
output "validation" {
|
||||
value = local.validation
|
||||
}
|
||||
|
||||
{{- range . }}
|
||||
{{- template "output" .}}
|
||||
{{- end }}
|
||||
|
|
Загрузка…
Ссылка в новой задаче