Skip to content

Commit

Permalink
Merge pull request #44 from DFE-Digital/feature/sathish
Browse files Browse the repository at this point in the history
terraform update
  • Loading branch information
SathishMani219 authored Feb 22, 2024
2 parents 5df55fd + 71a6201 commit 2ed0f98
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ jobs:
# issue-body: "Review the terraform plan, then approve."
# exclude-workflow-initiator-as-approver: false

- name: Apply Terraform changes
id: apply
run: terraform apply -auto-approve
#- name: Apply Terraform changes
# id: apply
# run: terraform apply -auto-approve

- name: Remove Runner to KV whitelist
uses: azure/CLI@v1
Expand Down
17 changes: 8 additions & 9 deletions terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ locals {
azure_location = var.azure_location
resource_prefix = "${local.environment}${local.project_name}"
azure_resource_group_name = var.resource_group_name
#registry_server = var.registry_server
#registry_username = var.registry_username
#registry_password = var.registry_password
#registry_custom_image_url = var.registry_custom_image_url
#resource_group_name = var.resource_group_name

registry_server = var.registry_server
registry_username = var.registry_username
registry_password = var.registry_password
registry_custom_image_url = var.registry_custom_image_url
resource_group_name = module.main_hosting.azurerm_resource_group_default.name

tags = {
"Environment" = var.az_tag_environment,
Expand All @@ -27,11 +26,11 @@ locals {
########################
### Container App ###
########################
/*

container_app_image_name = var.container_app_image_name
container_port = var.az_container_port
kestrel_endpoint = var.az_app_kestrel_endpoint
*/

##################
# Azure KeyVault #
##################
Expand All @@ -47,5 +46,5 @@ locals {
####################
# Managed Identity #
####################
# user_identity_name = var.serviceprinciple_identity
user_identity_name = var.serviceprinciple_identity
}
46 changes: 46 additions & 0 deletions terraform/main-hosting.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,49 @@
}



module "main_hosting" {
source = "github.com/DFE-Digital/terraform-azurerm-container-apps-hosting?ref=v1.2.0"

###########
# General #
###########
environment = local.environment
project_name = local.project_name
azure_location = local.azure_location
tags = local.tags



#################
# Container App #
#################
enable_container_registry = true
use_external_container_registry_url = true
image_name = local.container_app_image_name
container_port = local.container_port
container_secret_environment_variables = {
"AZURE_CLIENT_ID" = azurerm_user_assigned_identity.user_assigned_identity.client_id,
"KeyVaultName" = local.kv_name
}

container_environment_variables = {
"Kestrel__Endpoints__Http__Url" = local.kestrel_endpoint,
"ASPNETCORE_FORWARDEDHEADERS_ENABLED" = "true"
}

container_app_identities = {
type = "UserAssigned",
identity_ids = [azurerm_user_assigned_identity.user_assigned_identity.id]
}


#############################
# Github Container Registry #
#############################
registry_server = local.registry_server
registry_username = local.registry_username
registry_password = local.registry_password
registry_custom_image_url = local.registry_custom_image_url

}
4 changes: 2 additions & 2 deletions terraform/user-assigned-identity.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*resource "azurerm_user_assigned_identity" "user_assigned_identity" {
resource "azurerm_user_assigned_identity" "user_assigned_identity" {
name = local.user_identity_name
location = local.azure_location
resource_group_name = local.azure_resource_group_name
}
*/


3 changes: 1 addition & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ variable "msi_id" {
}


/*

################
# Container App#
################
Expand Down Expand Up @@ -141,4 +141,3 @@ variable "serviceprinciple_identity"{
description = "Variable to define the service principle"
type = string
}
*/

0 comments on commit 2ed0f98

Please sign in to comment.