Skip to content

Commit

Permalink
Moved tf settings to locals.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGHippo committed Jun 13, 2024
1 parent 2556d66 commit e225706
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
12 changes: 11 additions & 1 deletion terraform/local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ locals {
"KeyVault__Endpoint" = "https://${var.resource_name_prefix}-kv.vault.azure.net/"
"ContentfulOptions__UsePreviewApi" = var.contentful_use_preview_api
"WEBSITES_PORT" = "8080"
"ServiceAccess__IsPublic" = var.webapp_access_is_public
"ServiceAccess__Keys__0" = var.webapp_e2e_access_key
"ServiceAccess__Keys__1" = var.webapp_team_access_key
"ServiceAccess__Keys__2" = var.webapp_access_key_1
"ServiceAccess__Keys__3" = var.webapp_access_key_2
}

webapp_slot_app_settings = {
Expand All @@ -26,5 +31,10 @@ locals {
"KeyVault__Endpoint" = "https://${var.resource_name_prefix}-kv.vault.azure.net/"
"ContentfulOptions__UsePreviewApi" = var.contentful_use_preview_api
"WEBSITES_PORT" = "8080"
"ServiceAccess__IsPublic" = var.webapp_access_is_public
"ServiceAccess__Keys__0" = var.webapp_e2e_access_key
"ServiceAccess__Keys__1" = var.webapp_team_access_key
"ServiceAccess__Keys__2" = var.webapp_access_key_1
"ServiceAccess__Keys__3" = var.webapp_access_key_2
}
}
}
5 changes: 0 additions & 5 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ module "webapp" {
webapp_custom_domain_cert_secret_label = var.kv_certificate_label
webapp_health_check_path = "/health"
webapp_health_check_eviction_time_in_min = 10
webapp_access_is_public = false
webapp_e2e_access_key = ""
webapp_team_access_key = ""
webapp_access_key_1 = ""
webapp_access_key_2 = ""
agw_subnet_id = module.network.agw_subnet_id
agw_pip_id = module.network.agw_pip_id
kv_id = module.network.kv_id
Expand Down
26 changes: 0 additions & 26 deletions terraform/modules/azure-web/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,6 @@ variable "webapp_name" {
type = string
}

variable "webapp_access_is_public" {
description = "Web app service is public, and access is unchallenged"
default = false
type = bool
}

variable "webapp_e2e_access_key" {
description = "Web app access key for automated end-to-end tests"
type = string
}

variable "webapp_team_access_key" {
description = "Web app access key for the service team"
type = string
}

variable "webapp_access_key_1" {
description = "Web app access key for invited access 1"
type = string
}

variable "webapp_access_key_2" {
description = "Web app access key for invited access 2"
type = string
}

variable "webapp_slot_name" {
description = "Name for the slot for the Web Application"
type = string
Expand Down
5 changes: 0 additions & 5 deletions terraform/modules/azure-web/web-app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ resource "azurerm_linux_web_app_slot" "webapp_slot" {
"APPINSIGHTS_INSTRUMENTATIONKEY" = azurerm_application_insights.web.instrumentation_key
"APPLICATIONINSIGHTS_CONNECTION_STRING" = azurerm_application_insights.web.connection_string
"ApplicationInsightsAgent_EXTENSION_VERSION" = "~3"
"ServiceAccess__IsPublic" = var.webapp_access_is_public
"ServiceAccess__Keys__0" = var.webapp_e2e_access_key
"ServiceAccess__Keys__1" = var.webapp_team_access_key
"ServiceAccess__Keys__2" = var.webapp_access_key_1
"ServiceAccess__Keys__3" = var.webapp_access_key_2
}, var.webapp_slot_app_settings)

site_config {
Expand Down
28 changes: 27 additions & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,32 @@ variable "webapp_slot_name" {
type = string
}

variable "webapp_access_is_public" {
description = "Web app service is public, and access is unchallenged"
default = false
type = bool
}

variable "webapp_e2e_access_key" {
description = "Web app access key for automated end-to-end tests"
type = string
}

variable "webapp_team_access_key" {
description = "Web app access key for the service team"
type = string
}

variable "webapp_access_key_1" {
description = "Web app access key for invited access 1"
type = string
}

variable "webapp_access_key_2" {
description = "Web app access key for invited access 2"
type = string
}

variable "webapp_docker_registry_url" {
description = "URL to the Docker Registry"
type = string
Expand Down Expand Up @@ -134,4 +160,4 @@ variable "contentful_space_id" {
variable "contentful_use_preview_api" {
description = "Boolean used to set whether content is preview or published"
type = bool
}
}

0 comments on commit e225706

Please sign in to comment.