Skip to content

Commit

Permalink
add redis, staticwebapp to terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschonti committed May 4, 2024
1 parent ce6276d commit 8846b45
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 62 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/azure-static-web-apps-gray-bay-051673403.yml

This file was deleted.

48 changes: 27 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,30 @@ jobs:
package: packages/functions
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}

# deploy_aswa:
# needs: terraform
# runs-on: ubuntu-latest
# name: Build and Deploy client to Azure Static Web Apps
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: false
# lfs: false
# - name: Build And Deploy
# id: builddeploy
# uses: Azure/static-web-apps-deploy@v1
# with:
# azure_static_web_apps_api_token: ${{secrets.SWA_API_KEY}}
# repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
# action: "upload"
# ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
# app_location: "." # App source code path
# output_location: "/dist" # Built app content directory - optional
# ###### End of Repository/Build Configurations ######
deploy_aswa:
needs: terraform
runs-on: ubuntu-latest
name: Build and Deploy client to Azure Static Web Apps
env:
VITE_FUNC_HOST: ${{ secrets.FUNC_HOST }}
VITE_APIM_HOST: ${{ secrets.APIM_HOST }}
VITE_APIM_KEY: ${{ secrets.APIM_KEY }}
VITE_CLIENT_ID: ${{ secrets.CLIENT_ID }}
VITE_APP_INSIGHTS_CONN_STR: ${{ secrets.APP_INSIGHTS_CONN_STR}}
steps:
- uses: actions/checkout@v4
with:
submodules: false
lfs: false
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{secrets.SWA_API_KEY}}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: '.' # App source code path
output_location: '/dist' # Built app content directory - optional
###### End of Repository/Build Configurations ######
19 changes: 12 additions & 7 deletions infra/functionapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ variable "DB_PWD" {
sensitive = true
}

variable "DB_USER" {
type = string
sensitive = true
}

variable "FA_JWT_SECRET" {
type = string
sensitive = true
Expand Down Expand Up @@ -51,22 +56,22 @@ resource "azurerm_windows_function_app" "function-app" {
app_settings = {
"ADMINS" = var.FA_ADMINS
"APIM_HOST" = azurerm_api_management.apim.gateway_url
"APIM_KEY" = ""
"APIM_KEY" = "TODO"
"CLIENT_ID" = var.MTFSZ_CLIENT_ID
"CLIENT_SECRET" = var.MTFSZ_CLIENT_SECRET
"DB_NAME" = azurerm_mssql_database.sqldatabase.name
"DB_PWD" = var.DB_PWD
"DB_SERVER" = azurerm_mssql_server.sqlserver.fully_qualified_domain_name
"DB_USER" = var.DB_PWD
"DB_USER" = var.DB_USER
"ENCRYPT" = true
"ENV" = "production"
"FRONTEND_URL" = "TODO"
"FUNCTION_HOST" = var.FA_FUNCTIONS_URL
"FRONTEND_URL" = azurerm_static_web_app.swa.default_host_name
"FUNCTION_HOST" = "https://pontozo-api-tf.azurewebsites.net"
"FUNCTIONS_WORKER_RUNTIME" = "node"
"JWT_SECRET" = var.FA_JWT_SECRET
"REDIS_HOST" = "TODO"
"REDIS_PORT" = 0
"REDIS_PWD" = "TODO"
"REDIS_HOST" = azurerm_redis_cache.redis-cache.hostname
"REDIS_PORT" = azurerm_redis_cache.redis-cache.ssl_port
"REDIS_PWD" = azurerm_redis_cache.redis-cache.primary_access_key
"WEBSITE_RUN_FROM_PACKAGE" = 1
"WEBSITE_TIME_ZONE" = "Central Europe Standard Time"
}
Expand Down
10 changes: 10 additions & 0 deletions infra/redis.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "azurerm_redis_cache" "redis-cache" {
name = "pontozo-cache-tf"
location = azurerm_resource_group.tf-rg.location
resource_group_name = azurerm_resource_group.tf-rg.name
capacity = 0
family = "C"
sku_name = "Basic"
enable_non_ssl_port = false
minimum_tls_version = "1.2"
}
10 changes: 10 additions & 0 deletions infra/staticwebapp.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "azurerm_static_web_app" "swa" {
name = "pontozo-fe-tf"
location = "West Europe"
resource_group_name = azurerm_resource_group.tf-rg.name
}

output "swa_api_key" {
value = azurerm_static_web_app.swa.api_key
sensitive = true
}

0 comments on commit 8846b45

Please sign in to comment.