generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
56 lines (46 loc) · 1.07 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
terraform {
required_version = "~> 1.5"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.71"
}
random = {
source = "hashicorp/random"
version = "~> 3.6"
}
}
}
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
locals {
prefix = "default"
}
module "regions" {
source = "Azure/regions/azurerm"
version = ">= 0.3.0"
recommended_regions_only = true
}
resource "random_integer" "region_index" {
max = length(module.regions.regions) - 1
min = 0
}
module "naming" {
source = "Azure/naming/azurerm"
version = ">= 0.3.0"
}
resource "azurerm_resource_group" "example" {
location = "spaincentral"
name = "${module.naming.resource_group.name_unique}-${local.prefix}"
}
module "cosmos" {
source = "../../"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
name = "${module.naming.cosmosdb_account.name_unique}-${local.prefix}"
}