Skip to content

Commit

Permalink
Moving resource
Browse files Browse the repository at this point in the history
  • Loading branch information
frasermolyneux committed Sep 19, 2024
1 parent 8a8d9ff commit d19c3a8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion terraform/api_management_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "azurerm_api_management_backend" "api_management_backend" {
protocol = "http"
title = local.function_app_name
description = local.function_app_name
url = format("https://%s/api", azurerm_linux_function_app.app.default_hostname)
url = format("https://%s/api", azurerm_linux_function_app.legacy_app.default_hostname)

tls {
validate_certificate_chain = true
Expand Down
11 changes: 8 additions & 3 deletions terraform/function_app.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
resource "azurerm_linux_function_app" "app" {
moved {
from = azurerm_linux_function_app.app
to = azurerm_linux_function_app.legacy_app
}

resource "azurerm_linux_function_app" "legacy_app" {
name = local.function_app_name
tags = var.tags

resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location

service_plan_id = azurerm_service_plan.sp.id
service_plan_id = data.azurerm_service_plan.core.id

storage_account_name = azurerm_storage_account.function_app_storage.name
storage_account_access_key = azurerm_storage_account.function_app_storage.primary_access_key
Expand Down Expand Up @@ -64,6 +69,6 @@ resource "azurerm_linux_function_app" "app" {
}

data "azurerm_function_app_host_keys" "app" {
name = azurerm_linux_function_app.app.name
name = azurerm_linux_function_app.legacy_app.name
resource_group_name = azurerm_resource_group.rg.name
}
2 changes: 1 addition & 1 deletion terraform/function_app_key_vault_secrets.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_key_vault_secret" "functionapp_host_key_secret" {
name = format("%s-hostkey", azurerm_linux_function_app.app.name)
name = format("%s-hostkey", azurerm_linux_function_app.legacy_app.name)
value = data.azurerm_function_app_host_keys.app.primary_key
key_vault_id = azurerm_key_vault.kv.id
}
2 changes: 1 addition & 1 deletion terraform/function_app_role_assignments.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azuread_app_role_assignment" "repository_api" {
app_role_id = data.azuread_service_principal.repository_api.app_roles[index(data.azuread_service_principal.repository_api.app_roles.*.display_name, "ServiceAccount")].id
principal_object_id = azurerm_linux_function_app.app.identity.0.principal_id
principal_object_id = azurerm_linux_function_app.legacy_app.identity.0.principal_id
resource_object_id = data.azuread_service_principal.repository_api.object_id
}
2 changes: 1 addition & 1 deletion terraform/key_vault_role_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ resource "azurerm_role_assignment" "apim_kv_role_assignment" {
resource "azurerm_role_assignment" "web_app_kv_role_assignment" {
scope = azurerm_key_vault.kv.id
role_definition_name = "Key Vault Secrets User"
principal_id = azurerm_linux_function_app.app.identity.0.principal_id
principal_id = azurerm_linux_function_app.legacy_app.identity.0.principal_id
}
2 changes: 1 addition & 1 deletion terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
output "function_app_name" {
value = azurerm_linux_function_app.app.name
value = azurerm_linux_function_app.legacy_app.name
}

output "resource_group_name" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/portal_dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {
"subscription_id" = var.subscription_id
"resource_group_name" = azurerm_resource_group.rg.name
"key_vault_name" = azurerm_key_vault.kv.name
"function_app_name" = azurerm_linux_function_app.app.name
"function_app_name" = azurerm_linux_function_app.legacy_app.name
"core_resource_group_name" = data.azurerm_resource_group.core.name
"app_insights_name" = data.azurerm_application_insights.core.name
"service_bus_name" = azurerm_servicebus_namespace.ingest.name
Expand Down

0 comments on commit d19c3a8

Please sign in to comment.