fix 101-cosmos-db-azure-container-instance example (#159)
This commit is contained in:
parent
2705688717
commit
c5185847d9
@ -1,27 +0,0 @@
|
|||||||
resource "azurerm_container_group" "vote_aci" {
|
|
||||||
name = "vote-aci"
|
|
||||||
location = azurerm_resource_group.rg.location
|
|
||||||
resource_group_name = azurerm_resource_group.rg.name
|
|
||||||
ip_address_type = "public"
|
|
||||||
dns_name_label = "vote-aci-${random_integer.ri.result}"
|
|
||||||
os_type = "linux"
|
|
||||||
|
|
||||||
container {
|
|
||||||
name = "vote-aci"
|
|
||||||
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
|
|
||||||
cpu = "0.5"
|
|
||||||
memory = "1.5"
|
|
||||||
ports {
|
|
||||||
port = 80
|
|
||||||
protocol = "TCP"
|
|
||||||
}
|
|
||||||
|
|
||||||
secure_environment_variables = {
|
|
||||||
"COSMOS_DB_ENDPOINT" = azurerm_cosmosdb_account.vote_cosmos_db.endpoint
|
|
||||||
"COSMOS_DB_MASTERKEY" = azurerm_cosmosdb_account.vote_cosmos_db.primary_key
|
|
||||||
"TITLE" = "Azure Voting App"
|
|
||||||
"VOTE1VALUE" = "Cats"
|
|
||||||
"VOTE2VALUE" = "Dogs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +1,10 @@
|
|||||||
resource "random_pet" "rg_name" {
|
|
||||||
prefix = var.resource_group_name_prefix
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_resource_group" "rg" {
|
resource "azurerm_resource_group" "rg" {
|
||||||
|
name = "${random_pet.rg_name.id}-rg"
|
||||||
location = var.resource_group_location
|
location = var.resource_group_location
|
||||||
name = random_pet.rg_name.id
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "random_integer" "ri" {
|
|
||||||
min = 10000
|
|
||||||
max = 99999
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_cosmosdb_account" "vote_cosmos_db" {
|
resource "azurerm_cosmosdb_account" "vote_cosmos_db" {
|
||||||
name = "tfex-cosmos-db-${random_integer.ri.result}"
|
name = "${random_pet.rg_name.id}-${random_integer.ri.result}"
|
||||||
location = azurerm_resource_group.rg.location
|
location = azurerm_resource_group.rg.location
|
||||||
resource_group_name = azurerm_resource_group.rg.name
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
offer_type = "Standard"
|
offer_type = "Standard"
|
||||||
@ -29,4 +20,41 @@ resource "azurerm_cosmosdb_account" "vote_cosmos_db" {
|
|||||||
location = azurerm_resource_group.rg.location
|
location = azurerm_resource_group.rg.location
|
||||||
failover_priority = 0
|
failover_priority = 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_container_group" "main" {
|
||||||
|
name = "${random_pet.rg_name.id}-vote-aci"
|
||||||
|
location = azurerm_resource_group.rg.location
|
||||||
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
|
ip_address_type = "Public"
|
||||||
|
dns_name_label = "vote-aci-${random_integer.ri.result}"
|
||||||
|
os_type = "Linux"
|
||||||
|
|
||||||
|
container {
|
||||||
|
name = "vote-aci"
|
||||||
|
image = "mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb"
|
||||||
|
cpu = "0.5"
|
||||||
|
memory = "1.5"
|
||||||
|
ports {
|
||||||
|
port = 80
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
|
||||||
|
secure_environment_variables = {
|
||||||
|
"COSMOS_DB_ENDPOINT" = azurerm_cosmosdb_account.vote_cosmos_db.endpoint
|
||||||
|
"COSMOS_DB_MASTERKEY" = azurerm_cosmosdb_account.vote_cosmos_db.primary_key
|
||||||
|
"TITLE" = "Azure Voting App"
|
||||||
|
"VOTE1VALUE" = "Cats"
|
||||||
|
"VOTE2VALUE" = "Dogs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_integer" "ri" {
|
||||||
|
min = 10000
|
||||||
|
max = 99999
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_pet" "rg_name" {
|
||||||
|
prefix = var.prefix
|
||||||
}
|
}
|
@ -7,5 +7,5 @@ output "cosmosdb_account_name" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output "dns" {
|
output "dns" {
|
||||||
value = azurerm_container_group.vote_aci.fqdn
|
value = azurerm_container_group.main.fqdn
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
terraform {
|
terraform {
|
||||||
required_version = ">=0.12"
|
required_version = ">=1.0"
|
||||||
|
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
|
@ -3,7 +3,8 @@ variable "resource_group_location" {
|
|||||||
description = "Location of the resource group."
|
description = "Location of the resource group."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "resource_group_name_prefix" {
|
variable "prefix" {
|
||||||
default = "rg"
|
type = string
|
||||||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
|
default = "cosmos-db-aci"
|
||||||
|
description = "Prefix of the resource name"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user