generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
secure database secrets and ensure middleware access (#423)
* updates to deploy-dev.yml to save all workflow artifacts including dockerbuild * draft vault module changes * rebased branch due to conflicts and push changes * finally getting the random_password to save to key vault - yippeee * revert changes to the app_service/main.tf file * update workflows to include object_id * add object_id to workflows * update database outputs and dev-env.yaml file * push dev-env.yaml changes * update the backend with the database variable * update variable values in backend application.yaml file --------- Co-authored-by: marycrawford <[email protected]>
- Loading branch information
1 parent
e504858
commit 4b7c5ae
Showing
18 changed files
with
133 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ resource "azurerm_linux_web_app" "linux_webapp" { | |
action = "Allow" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
output "postgres_db_password" { | ||
value = azurerm_postgresql_flexible_server.postgres_flexible_server.administrator_login | ||
output "postgres_server_id" { | ||
value = azurerm_postgresql_flexible_server.postgres_flexible_server | ||
} | ||
|
||
output "postgres_fqdn" { | ||
value = azurerm_postgresql_flexible_server.postgres_flexible_server | ||
description = "The fully qualified domain name (FQDN) of the PostgreSQL flexible server" | ||
} | ||
|
||
output "postgres_user" { | ||
value = var.db_username | ||
description = "User name for the Application's PostgreSQL flexible server database" | ||
} | ||
|
||
output "postgres_db_name" { | ||
value = var.db_username | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data "azurerm_client_config" "current" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
resource "azurerm_key_vault" "this" { | ||
name = "reportvisionvault" | ||
location = var.location | ||
resource_group_name = var.resource_group_name | ||
sku_name = "standard" | ||
tenant_id = data.azurerm_client_config.current.tenant_id | ||
purge_protection_enabled = true | ||
|
||
access_policy { | ||
tenant_id = data.azurerm_client_config.current.tenant_id | ||
object_id = data.azurerm_client_config.current.object_id | ||
|
||
key_permissions = [ | ||
"Create", | ||
"Get", | ||
"List", | ||
] | ||
|
||
secret_permissions = [ | ||
"Set", | ||
"Get", | ||
"Recover", | ||
"List", | ||
] | ||
} | ||
} | ||
|
||
# Random string resource for the postgres password | ||
resource "random_string" "postgres_password" { | ||
length = 16 | ||
override_special = "_!@#-$%^&*()[]{}" # excluded characters | ||
} | ||
|
||
resource "azurerm_key_vault_secret" "postgres_db_secret" { | ||
name = "reportvision-postgres-db-password" | ||
value = random_string.postgres_password.result | ||
key_vault_id = azurerm_key_vault.this.id | ||
|
||
depends_on = [azurerm_key_vault.this] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "postgres_password" { | ||
value = random_string.postgres_password.result | ||
sensitive = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
variable "client_id" {} | ||
variable "location" {} | ||
variable "object_id" { | ||
type = string | ||
} | ||
variable "postgres_server_id" { | ||
type = string | ||
} | ||
variable "resource_group_name" {} | ||
variable "subscription_id" {} | ||
variable "service_plan_id" {} | ||
variable "tenant_id" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
variable "client_id" {} | ||
variable "name" {} | ||
|
||
variable "object_id" {} | ||
variable "tenant_id" {} | ||
variable "sku_name" { | ||
type = string | ||
description = "The Azure Stock Keep Unit (SKU) version" | ||
} | ||
|
||
variable "subscription_id" {} | ||
variable "resource_group_name" { | ||
description = "value of the Azure resource group to deploy to" | ||
} |