generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create postgresql server and db with relevant resources #393
Merged
+157
−65
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
67840d0
creating database module and resources for postgresql server and db
e51d31a
removed commented out code
2f5a345
making module headers consistent
24ad5e3
remove azurerm_postgresql_flexible_server resources and using a singl…
64d5ed9
update resource notes in modules/database/main.tf
2ebf0f7
save randomly created postgres db login password in azure key vault
8875095
add client_id and object_id for vault
79f013d
fix errors
095f8d9
update database with network subnet and vault with object_id and vite…
a884392
update subnet used
9f4f1c1
update how we are consuming the vite_api_url and object_id variables
cb224ce
remove the data.tf files from the database and vault modules, use mai…
537ee13
remove duplicate variables and add descriptions
1878571
fix syntax error and put variable descriptions
0916362
create subnet for db and update tf code
b7b24e0
modify and clean up code
34025ba
refactor code to fix error
9da59a2
update db with postgresql_flexible_server since single server will be…
d082319
update note regarding retiring azurerm_postgresql_server in March 2025
11a797a
reverse postgres_flex_server changes and comment them out
196eca7
update db to postgresql flexible server and add postgresql dns zone n…
78e199c
remove azurerm_postgresql_server code
d201fa5
clean up code by removing unused and commented out code
8f4f912
remove more commented out code
6b81cc2
remove variables used when working on vault module
2d52961
add back client_id and tenant_id variables to support the azuread pro…
2423ed1
update database name
47014cd
reduce the sku_name to Standard_B1ms
e51c5b5
remove unused variables
927d60b
update database cidr block
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Azure Postgres Single Service (azurerm_postgresql_server) retires in March 2025. | ||
# As a result we are using Azure Database for PostgreSQL Flexible Server | ||
# with granular control, flexibility and better cost optimization. | ||
resource "azurerm_postgresql_flexible_server" "postgres_flexible_server" { | ||
name = "reportvisionpostgresql-flexible-server" | ||
location = var.location | ||
resource_group_name = var.resource_group_name | ||
sku_name = var.postgres_sku_name | ||
version = var.engine_version | ||
storage_mb = 32768 # 32 GB, the lowest of the valid options | ||
backup_retention_days = 7 | ||
|
||
administrator_login = var.db_username | ||
administrator_password = random_string.setup_rds_password.result | ||
delegated_subnet_id = var.subnet | ||
private_dns_zone_id = var.private_dns_zone_id | ||
|
||
# Disable Public Network Access | ||
public_network_access_enabled = false | ||
|
||
lifecycle { | ||
prevent_destroy = true | ||
} | ||
} | ||
|
||
resource "azurerm_postgresql_flexible_server_database" "postgres_db" { | ||
name = "${azurerm_postgresql_flexible_server.postgres_flexible_server.name}-db" | ||
server_id = azurerm_postgresql_flexible_server.postgres_flexible_server.id | ||
} | ||
|
||
# Random string resource for the postgres password | ||
resource "random_string" "setup_rds_password" { | ||
length = 16 # Length of the password | ||
|
||
# Character set that excludes problematic characters like quotes, backslashes, etc. | ||
override_special = "_!@#-$%^&*()[]{}" | ||
} |
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,3 @@ | ||
output "postgres_db_password" { | ||
value = azurerm_postgresql_flexible_server.postgres_flexible_server.administrator_login | ||
} |
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,37 @@ | ||
variable "db_username" { | ||
type = string | ||
description = "Username of RDS Instance." | ||
default = "reportVisionDbUser" | ||
} | ||
|
||
variable "engine_version" { | ||
description = "Postgres DB engine version." | ||
default = "11" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Location of the resource." | ||
default = "eastus2" | ||
} | ||
|
||
variable "resource_group_name" { | ||
type = string | ||
description = "The Azure Resource Group to deploy to" | ||
} | ||
|
||
variable "postgres_sku_name" { | ||
type = string | ||
description = "value" | ||
default = "Standard_B1ms" | ||
} | ||
|
||
variable "subnet" { | ||
type = string | ||
description = "The subnet ID to associate with the PostgreSQL Flexible Server" | ||
} | ||
|
||
variable "private_dns_zone_id" { | ||
type = string | ||
description = "Private DNS Zone for PostgreSQL Flexible Server" | ||
} |
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,9 +1,12 @@ | ||
variable "resource_group" {} | ||
variable "name" {} | ||
variable "location" {} | ||
variable "vnetcidr" {} | ||
variable "websubnetcidr" {} | ||
variable "lbsubnetcidr" {} | ||
# variable "dbsubnetcidr" {} | ||
variable "dbsubnetcidr" {} | ||
variable "appsubnetcidr" {} | ||
variable "env" {} | ||
variable "env" {} | ||
|
||
variable "location" { | ||
default = "eastus2" | ||
} |
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,7 +1,10 @@ | ||
variable "name" {} | ||
|
||
variable "sku_name" { | ||
type = string | ||
description = "The Azure Stock Keep Unit (SKU) version" | ||
} | ||
|
||
variable "resource_group_name" { | ||
description = "value of the Azure resource group to deploy to" | ||
} | ||
|
||
variable "name" {} | ||
|
||
variable "sku_name" {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just notice this as well. this cidr will probably need to be
10.1.4.0/24
and not10.0.4.0/24
to eliminate the chance of crossing on top of each other when both environments are running and to match the pattern of the rest of the cidr's.