Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
resource names and readme file modified
Browse files Browse the repository at this point in the history
  • Loading branch information
polatengin authored and brandonh-msft committed Nov 5, 2020
1 parent 9949eab commit 875d89a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ from the `terraform/` directory you're in after running `terraform apply`.

#### The Azure Function

In your portal, go to the newly-created Azure Function. Its name will be the `<prefix>` value you put in during the Terraform deployment.
In your portal, go to the newly-created Azure Function. Its name will be the `<prefix>-serverless-functionapp` value you put in during the Terraform deployment.

There are a few things to notice:

Expand Down Expand Up @@ -178,7 +178,7 @@ which ensures that even if somebody were to submit Function code that attempted

#### The Logic App

In your portal, go to the newly-created Logic App. Its name will be `<prefix>-LA` where `<prefix>` is the value you put in during the Terraform deployment.
In your portal, go to the newly-created Logic App. Its name will be `<prefix>-serverless-la` where `<prefix>` is the value you put in during the Terraform deployment.

##### Execution Logic

Expand Down Expand Up @@ -208,7 +208,7 @@ The important part of the Logic App's configuration is that our Terraform deploy

#### Key Vault

In your portal, go to the newly-created Key Vault. Its name will be the `<prefix>` value you put in during the Terraform deployment.
In your portal, go to the newly-created Key Vault. Its name will be the `<prefix>-serverless-kv` value you put in during the Terraform deployment.

The important bits of the Key Vault for this sample are the `Events` and `Access Policies` area

Expand All @@ -228,11 +228,11 @@ In order for the Function App to be able to read the values of Key Vault secrets

## Bringing it all together

If you open the Live Stream for the first Application Insights instance (without the `-2` suffix) you'll see the Function happily logging messages every 5 seconds or so:
If you open the Live Stream for the first Application Insights instance (with the `-first` suffix) you'll see the Function happily logging messages every 5 seconds or so:

![](doc/appinsightslivestream1.png)

Moving over to the secondary Application Insights, you'll probably see a screen like this:
Moving over to the secondary Application Insights (with the `-second` suffix), you'll probably see a screen like this:

![](doc/appinsights2dead.png)

Expand Down
22 changes: 11 additions & 11 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variable "sp_client_secret" {
}

resource "azurerm_resource_group" "rg" {
name = "serverless-sample-${var.prefix}"
name = "${var.prefix}-serverless-sample"
location = var.location
tags = {
sample = "serverless-keyvault-secret-rotation-handling"
Expand All @@ -49,7 +49,7 @@ resource "azurerm_resource_group" "rg" {
##################################################################################

resource "azurerm_application_insights" "logging" {
name = var.prefix
name = "${var.prefix}-serverless-ai-first"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
application_type = "web"
Expand All @@ -59,7 +59,7 @@ resource "azurerm_application_insights" "logging" {
}

resource "azurerm_application_insights" "logging2" {
name = "${var.prefix}-2"
name = "${var.prefix}-serverless-ai-second"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
application_type = "web"
Expand All @@ -85,7 +85,7 @@ resource "azurerm_storage_account" "fxnstor" {
}

resource "azurerm_app_service_plan" "fxnapp" {
name = var.prefix
name = "${var.prefix}-serverless-serviceplan"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
kind = "functionapp"
Expand All @@ -99,7 +99,7 @@ resource "azurerm_app_service_plan" "fxnapp" {
}

resource "azurerm_function_app" "fxn" {
name = var.prefix
name = "${var.prefix}-serverless-functionapp"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
app_service_plan_id = azurerm_app_service_plan.fxnapp.id
Expand All @@ -124,7 +124,7 @@ resource "azurerm_function_app" "fxn" {
##################################################################################

resource "azurerm_key_vault" "shared_key_vault" {
name = var.prefix
name = "${var.prefix}-serverless-kv"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
tenant_id = data.azurerm_client_config.current.tenant_id
Expand Down Expand Up @@ -183,7 +183,7 @@ resource "azurerm_key_vault_secret" "logging_app_insights_key" {
##################################################################################

resource "azurerm_log_analytics_workspace" "loganalytics" {
name = "${var.prefix}-law"
name = "${var.prefix}-serverless-law"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = "PerGB2018"
Expand All @@ -196,7 +196,7 @@ resource "azurerm_log_analytics_workspace" "loganalytics" {
locals {
parameters_body = {
logicapp_keyvaulthandler_name = {
value = "${var.prefix}-LA"
value = "${var.prefix}-serverless-la"
},
vaults_rollingvault_externalid = {
value = azurerm_key_vault.shared_key_vault.id
Expand Down Expand Up @@ -226,7 +226,7 @@ locals {
}

resource "azurerm_template_deployment" "logicapp" {
name = "${var.prefix}-LA-deployment"
name = "${var.prefix}-serverless-la-deployment"
resource_group_name = azurerm_resource_group.rg.name
deployment_mode = "Incremental"
parameters_body = jsonencode(local.parameters_body)
Expand Down Expand Up @@ -473,11 +473,11 @@ resource "azurerm_role_assignment" "laToFunction" {
# Outputs
##################################################################################

output "AppInsightsKey1" {
output "AppInsightsKey-First" {
value = azurerm_application_insights.logging.instrumentation_key
}

output "AppInsightsKey2" {
output "AppInsightsKey-Second" {
value = azurerm_application_insights.logging2.instrumentation_key
}

Expand Down

0 comments on commit 875d89a

Please sign in to comment.