-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19fb9b1
commit a75d5d0
Showing
3 changed files
with
76 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,44 @@ | ||
resource "azurerm_resource_group" "az_rg" { | ||
name = var.az_rg_name | ||
location = var.location | ||
resource "random_pet" "rg_name" { | ||
prefix = var.resource_group_name_prefix | ||
} | ||
|
||
resource "azurerm_storage_account" "az_sa" { | ||
name = var.az_sa_name | ||
resource_group_name = azurerm_resource_group.az_rg.name | ||
location = azurerm_resource_group.az_rg.location | ||
account_tier = var.az_sa_account_tier | ||
account_replication_type = var.az_sa_account_replication_type | ||
resource "azurerm_resource_group" "rg" { | ||
location = var.resource_group_location | ||
name = coalesce(var.resource_group_name, random_pet.rg_name.id) | ||
} | ||
|
||
resource "azurerm_app_service_plan" "az_asp" { | ||
name = var.az_asp_name | ||
location = azurerm_resource_group.az_rg.location | ||
resource_group_name = azurerm_resource_group.az_rg.name | ||
resource "random_string" "name" { | ||
length = 13 | ||
lower = true | ||
numeric = false | ||
special = false | ||
upper = false | ||
} | ||
|
||
resource "azurerm_storage_account" "example" { | ||
name = coalesce(var.sa_name, "sa${random_string.name.result}") | ||
resource_group_name = azurerm_resource_group.rg.name | ||
location = azurerm_resource_group.rg.location | ||
account_tier = var.sa_account_tier | ||
account_replication_type = var.sa_account_replication_type | ||
} | ||
|
||
resource "azurerm_app_service_plan" "example" { | ||
name = coalesce(var.asp_name, "sp${random_string.name.result}") | ||
location = azurerm_resource_group.rg.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
|
||
sku { | ||
tier = var.az_asp_sku_tier | ||
tier = var.asp_sku_tier | ||
size = "S1" | ||
} | ||
} | ||
|
||
resource "azurerm_function_app" "az_fa" { | ||
name = var.az_fa_name | ||
location = azurerm_resource_group.az_rg.location | ||
resource_group_name = azurerm_resource_group.az_rg.name | ||
app_service_plan_id = azurerm_app_service_plan.az_asp.id | ||
storage_account_name = azurerm_storage_account.az_sa.name | ||
storage_account_access_key = azurerm_storage_account.az_sa.primary_access_key | ||
resource "azurerm_function_app" "example" { | ||
name = coalesce(var.fa_name, "fa${random_string.name.result}") | ||
location = azurerm_resource_group.rg.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
app_service_plan_id = azurerm_app_service_plan.example.id | ||
storage_account_name = azurerm_storage_account.example.name | ||
storage_account_access_key = azurerm_storage_account.example.primary_access_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,53 @@ | ||
variable "az_rg_name" { | ||
type = string | ||
default = "azure-functions-example-rg" | ||
variable "resource_group_name" { | ||
type = string | ||
default = "" | ||
description = "The name of the Azure resource group. If blank, a random name will be generated." | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
default = "East US" | ||
variable "resource_group_name_prefix" { | ||
type = string | ||
default = "rg" | ||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription." | ||
} | ||
|
||
variable "az_sa_account_tier" { | ||
type = string | ||
default = "Standard" | ||
variable "resource_group_location" { | ||
type = string | ||
default = "eastus" | ||
description = "Location of the resource group." | ||
} | ||
|
||
variable "az_sa_account_replication_type" { | ||
type = string | ||
default = "LRS" | ||
variable "sa_account_tier" { | ||
description = "The tier of the storage account. Possible values are Standard and Premium." | ||
type = string | ||
default = "Standard" | ||
} | ||
|
||
variable "az_sa_name" { | ||
type = string | ||
default = "examplefunctionssa" | ||
variable "sa_account_replication_type" { | ||
description = "The replication type of the storage account. Possible values are LRS, GRS, RAGRS, and ZRS." | ||
type = string | ||
default = "LRS" | ||
} | ||
|
||
variable "az_asp_name" { | ||
type = string | ||
default = "example-functions-service-plan" | ||
variable "sa_name" { | ||
description = "The name of the storage account. If blank, a random name will be generated." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "az_asp_sku_tier" { | ||
type = string | ||
default = "Standard" | ||
variable "asp_name" { | ||
description = "The name of the App Service Plan. If blank, a random name will be generated." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "az_fa_name" { | ||
type = string | ||
default = "example-functions-app" | ||
variable "asp_sku_tier" { | ||
description = "The SKU tier of the App Service Plan. Possible values are Free, Shared, Basic, Standard, Premium, PremiumV2, and PremiumV3." | ||
type = string | ||
default = "Standard" | ||
} | ||
|
||
variable "fa_name" { | ||
description = "The name of the Function App. If blank, a random name will be generated." | ||
type = string | ||
default = "" | ||
} |