Safe letter
* correct * making output correct Co-authored-by: Gabriel Nepomuceno <ganepomu@microsoft.com>
This commit is contained in:
Родитель
b1b06c266a
Коммит
dfbb024665
|
@ -0,0 +1,3 @@
|
|||
.terraform/
|
||||
|
||||
*.tfstate*
|
|
@ -4,8 +4,8 @@ repos:
|
|||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||
rev: v1.19.0
|
||||
hooks:
|
||||
- id: terraform_fmt
|
||||
- id: terraform_docs
|
||||
- id: terraform_fmt
|
||||
#- id: terraform_docs
|
||||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
|
||||
|
||||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
||||
Error: Failed to read module directory: Module directory /tmp/terraform-docs-KvHDzFhema.tf does not exist or cannot be read.
|
||||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
||||
|
||||
# Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
|
|
|
@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
|
|||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
|
|
31
main.tf
31
main.tf
|
@ -9,23 +9,34 @@ resource "random_string" "main" {
|
|||
number = var.unique-include-numbers
|
||||
}
|
||||
|
||||
resource "random_string" "first_letter" {
|
||||
length = 1
|
||||
special = false
|
||||
upper = false
|
||||
number = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
locals {
|
||||
random = substr(coalesce(var.unique-seed, random_string.main.result), 0, var.unique-length)
|
||||
prefix = join("-", var.prefix)
|
||||
prefix_safe = lower(join("", var.prefix))
|
||||
suffix = join("-", var.suffix)
|
||||
suffix_unique = join("-", concat(var.suffix, [local.random]))
|
||||
suffix_safe = lower(join("", var.suffix))
|
||||
suffix_unique_safe = lower(join("", concat(var.suffix, [local.random])))
|
||||
// Names based in the recomendations of
|
||||
// adding a first letter to guarantee that you always start with a letter
|
||||
random_safe_generation = join("", [random_string.first_letter.result, random_string.main.result])
|
||||
random = substr(coalesce(var.unique-seed, local.random_safe_generation), 0, var.unique-length)
|
||||
prefix = join("-", var.prefix)
|
||||
prefix_safe = lower(join("", var.prefix))
|
||||
suffix = join("-", var.suffix)
|
||||
suffix_unique = join("-", concat(var.suffix, [local.random]))
|
||||
suffix_safe = lower(join("", var.suffix))
|
||||
suffix_unique_safe = lower(join("", concat(var.suffix, [local.random])))
|
||||
// Names based in the recomendations of
|
||||
// https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/naming-and-tagging
|
||||
az = {
|
||||
// General
|
||||
// General
|
||||
resource_group = "rg"
|
||||
policy = "policy"
|
||||
api_management = "apim"
|
||||
|
||||
// Networking
|
||||
// Networking
|
||||
virtual_network = "vnet"
|
||||
subnet = "snet"
|
||||
network_interface = "nic"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
output "unique-seed" {
|
||||
value = coalesce(var.unique-seed, random_string.main.result)
|
||||
value = coalesce(var.unique-seed, local.random_safe_generation)
|
||||
}
|
||||
|
||||
// General
|
||||
|
|
Загрузка…
Ссылка в новой задаче