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

Commit

Permalink
[#153676720] WIP functionapp tf resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Feroldi committed Jan 12, 2018
1 parent 237478d commit dc573b4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
54 changes: 53 additions & 1 deletion infrastructure/azure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Set up environment variables before running this script (see README.md)

provider "azurerm" {
version = "~> 0.3"
version = "~> 1.0"
}

provider "random" {
Expand Down Expand Up @@ -54,6 +54,16 @@ variable "azurerm_storage_container" {
type = "string"
}

variable "message_blob_container" {
type = "string"
description = "Name of the message container blob"
}

variable "azurerm_functionapp" {
type = "string"
description = "Name of the main Functions application"
}

# Name of the storage account for functions
variable "azurerm_functionapp_storage_account" {
type = "string"
Expand Down Expand Up @@ -192,6 +202,8 @@ resource "azurerm_storage_account" "azurerm_storage_account" {
# see https://docs.microsoft.com/en-us/azure/storage/common/storage-service-encryption
enable_blob_encryption = true

enable_https_traffic_only = true

tags {
environment = "${var.environment}"
}
Expand All @@ -210,6 +222,8 @@ resource "azurerm_storage_account" "azurerm_functionapp_storage_account" {
# see https://docs.microsoft.com/en-us/azure/storage/common/storage-service-encryption
enable_blob_encryption = true

enable_https_traffic_only = true

tags {
environment = "${var.environment}"
}
Expand Down Expand Up @@ -238,6 +252,18 @@ resource "azurerm_storage_queue" "azurerm_storage_queue_createdmessages" {
storage_account_name = "${azurerm_storage_account.azurerm_storage_account.name}"
}

## BLOBS

resource "azurerm_storage_blob" "azurerm_message_blob" {
name = "${var.message_blob_container}"

resource_group_name = "${azurerm_resource_group.azurerm_resource_group.name}"
storage_account_name = "${azurerm_storage_account.azurerm_storage_account.name}"
storage_container_name = "${azurerm_storage_container.azurerm_storage_container.name}"

type = "block"
}

## DATABASE

resource "azurerm_cosmosdb_account" "azurerm_cosmosdb" {
Expand Down Expand Up @@ -328,6 +354,32 @@ resource "azurerm_app_service_plan" "azurerm_app_service_plan" {
# }
}

## FUNCTIONS

resource "azurerm_function_app" "azurerm_function_app" {
name = "${var.azurerm_functionapp}"
location = "${azurerm_resource_group.azurerm_resource_group.location}"
resource_group_name = "${azurerm_resource_group.azurerm_resource_group.name}"
app_service_plan_id = "${azurerm_app_service_plan.azurerm_app_service_plan.id}"
storage_connection_string = "${azurerm_storage_account.azurerm_functionapp_storage_account.primary_connection_string}"
version = "~1"

app_settings = {
# "AzureWebJobsStorage" = "${azurerm_storage_account.azurerm_functionapp_storage_account.primary_connection_string}"
# "AzureWebJobsDashboard" = "${azurerm_storage_account.azurerm_functionapp_storage_account.primary_connection_string}"
"COSMOSDB_NAME" = "${var.azurerm_cosmosdb_documentdb}"
"QueueStorageConnection" = "${azurerm_storage_account.azurerm_storage_account.primary_connection_string}"
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.azurerm_application_insights.instrumentation_key}"
"FUNCTION_APP_EDIT_MODE" = "readonly"
"AzureWebJobsSecretStorageType" = "disabled"
"WEBSITE_HTTPLOGGING_RETENTION_DAYS" = "3"
"DIAGNOSTICS_AZUREBLOBRETENTIONINDAYS" = "1"
"WEBSITE_NODE_DEFAULT_VERSION" = "6.11.2"
"SCM_USE_FUNCPACK_BUILD" = "1"
"MESSAGE_CONTAINER_NAME" = "${azurerm_storage_blob.azurerm_message_blob.name}"
}
}

### DEVELOPER PORTAL TASKS

resource "azurerm_app_service_plan" "azurerm_app_service_plan_portal" {
Expand Down
1 change: 0 additions & 1 deletion infrastructure/env/common/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"policyFile": "admin.xml"
}
],
"message_blob_container": "message-content",
"azure_portal_ips": [
"104.42.195.92",
"40.76.54.131",
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/env/common/tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"notifications": "messageId",
"services": "serviceId"
},
"app_service_portal_git_repo": "https://github.com/teamdigitale/digital-citizenship-onboarding"
"app_service_portal_git_repo": "https://github.com/teamdigitale/digital-citizenship-onboarding",
"message_blob_container": "message-content"
}

0 comments on commit dc573b4

Please sign in to comment.