-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: DEVOPS-868 Azurerm_function_app resource replacement (#65)
* add "azurerm_service_plan" * added azurerm_service_plan * fix README.md * add test for function_app * add a working test * add variables * file rename * minor changes * working test * working test * add new resources * raw migration completed * working * app_service_plan_info/sku_tier variable removed * modify README.md * modify README.md * remove linux_fx_version variable * modify README.md * update azurerm version * fix(function_app): Always on default to null * fix: remove azurerm provider * fix: Remove azurerm provider * fix: terraform fmt * fix: Add README.md to the test folder * fix: modify README.md * fix: README.md change * add random provider to the function name * testing different functions * terraform fmt * pre-commit check * terraform docs hook * . * fix: README.md * fix: README.md * completed script * add health_check_eviction_time_in_min and sticky_settings * pre-commit test passed * remove migrate.sh script --------- Co-authored-by: Flisco <{ID}+{username}@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
380 additions
and
196 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Test for Azure the function_app module | ||
|
||
Terraform template to test the Azure function_app module | ||
|
||
|
||
## How to use it | ||
- terraform init | ||
- terraform plan | ||
- terraform apply |
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# | ||
# APP CONFIGURATION | ||
# | ||
|
||
resource "random_id" "function_id" { | ||
byte_length = 4 | ||
} | ||
|
||
resource "azurerm_application_insights" "example" { | ||
name = "${var.project}-${random_id.function_id.hex}-appinsights" | ||
location = azurerm_resource_group.example.location | ||
resource_group_name = azurerm_resource_group.example.name | ||
application_type = "web" | ||
} | ||
|
||
resource "azurerm_resource_group" "example" { | ||
name = "${var.project}-${random_id.function_id.hex}-rg" | ||
location = var.location | ||
} | ||
|
||
resource "azurerm_virtual_network" "example" { | ||
name = "${var.project}-${random_id.function_id.hex}-vn" | ||
address_space = var.address_space | ||
location = azurerm_resource_group.example.location | ||
resource_group_name = azurerm_resource_group.example.name | ||
} | ||
|
||
resource "azurerm_subnet" "example" { | ||
name = "${var.project}-${random_id.function_id.hex}-subnet" | ||
resource_group_name = azurerm_resource_group.example.name | ||
virtual_network_name = azurerm_virtual_network.example.name | ||
address_prefixes = var.address_prefixes | ||
|
||
delegation { | ||
name = "${var.project}-${random_id.function_id.hex}-delegation" | ||
|
||
service_delegation { | ||
name = "Microsoft.Web/serverFarms" | ||
actions = ["Microsoft.Network/virtualNetworks/subnets/action"] | ||
} | ||
} | ||
} | ||
|
||
locals { | ||
function_app = { | ||
app_settings_common = { | ||
FUNCTIONS_WORKER_PROCESS_COUNT = 4 | ||
} | ||
app_settings_1 = { | ||
} | ||
app_settings_2 = { | ||
} | ||
} | ||
|
||
func_python = { | ||
app_settings_common = local.function_app.app_settings_common | ||
app_settings_1 = { | ||
} | ||
app_settings_2 = { | ||
} | ||
} | ||
} | ||
|
||
# #tfsec:ignore:azure-storage-queue-services-logging-enabled:exp:2022-05-01 # already ignored, maybe a bug in tfsec | ||
module "func_python" { | ||
source = "../../function_app" | ||
|
||
resource_group_name = azurerm_resource_group.example.name | ||
name = "${var.project}-${random_id.function_id.hex}-fn-py" | ||
location = var.location | ||
health_check_path = "/api/v1/info" | ||
python_version = "3.9" | ||
runtime_version = "~4" | ||
|
||
always_on = true | ||
application_insights_instrumentation_key = azurerm_application_insights.example.instrumentation_key | ||
|
||
app_settings = merge( | ||
local.func_python.app_settings_common, {} | ||
) | ||
|
||
subnet_id = azurerm_subnet.example.id | ||
|
||
allowed_subnets = [ | ||
azurerm_subnet.example.id, | ||
] | ||
|
||
tags = merge(var.tags, | ||
{ Name = "${var.project}-${random_id.function_id.hex}_function_app" }) | ||
} |
Oops, something went wrong.