-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Postgresql flexible server support (#14)
* Added terraform HCL integration tests and integrated test execution into CI pipeline. * Added end to end test framework and integrated with CI pipeline. * Updated README with e2e test details. * Updated full deployment test to query and assert on each resource. * Removed parellism from e2e tests to avoid collisions of tfstate and resources. * Completed full deployment end to end test. * Johnc/end to end tests parallel (#10) * Added tfstate and backend to end to end tests. * Added TF state storage container variable to tests and workflow. * Added copy of terraform to temp folder to avoid clashes during parellel execution. * Updated README. * Added environment variable null checks. * Updated README. * Refactored backup policies and instances into modules and added variables that can be used to configure the backups. * Update docs. * Fix basic deployment end to end test. * Updated docs with usage info. * Made vault name variable mandatory. * Made test teardown deferred so it runs in all cases. * Added test helper for end to end environment config. * Updated info on end to end test debugging. * Added end to end test for blob storage backups. * Added managed disk end to end test. * wip * Fix issue with managed disk role assignment at resource group level. * Fix bug in e2e managed disk backup test. * Updated test logging to use the go log package. * Added postgresql flexible server support. * Removed duplication from README, introduced in error. * Removed more duplicated content added in erroneous merge. * Removed files left in error.
- Loading branch information
1 parent
c403c12
commit 20a6a93
Showing
15 changed files
with
527 additions
and
6 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
25 changes: 25 additions & 0 deletions
25
infrastructure/modules/backup/postgresql_flexible_server/backup_instance.tf
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,25 @@ | ||
resource "azurerm_role_assignment" "role_assignment_reader" { | ||
count = var.assign_resource_group_level_roles == true ? 1 : 0 | ||
scope = var.server_resource_group_id | ||
role_definition_name = "Reader" | ||
principal_id = var.vault_principal_id | ||
} | ||
|
||
resource "azurerm_role_assignment" "role_assignment_long_term_retention_backup_role" { | ||
scope = var.server_id | ||
role_definition_name = "PostgreSQL Flexible Server Long Term Retention Backup Role" | ||
principal_id = var.vault_principal_id | ||
} | ||
|
||
resource "azurerm_data_protection_backup_instance_postgresql_flexible_server" "backup_instance" { | ||
name = "bkinst-${var.vault_name}-pgflexserver-${var.backup_name}" | ||
vault_id = var.vault_id | ||
location = var.vault_location | ||
server_id = var.server_id | ||
backup_policy_id = azurerm_data_protection_backup_policy_postgresql_flexible_server.backup_policy.id | ||
|
||
depends_on = [ | ||
azurerm_role_assignment.role_assignment_reader, | ||
azurerm_role_assignment.role_assignment_long_term_retention_backup_role | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
infrastructure/modules/backup/postgresql_flexible_server/backup_policy.tf
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 @@ | ||
resource "azurerm_data_protection_backup_policy_postgresql_flexible_server" "backup_policy" { | ||
name = "bkpol-${var.vault_name}-pgflexserver-${var.backup_name}" | ||
vault_id = var.vault_id | ||
backup_repeating_time_intervals = var.backup_intervals | ||
|
||
default_retention_rule { | ||
life_cycle { | ||
duration = var.retention_period | ||
data_store_type = "VaultStore" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
infrastructure/modules/backup/postgresql_flexible_server/output.tf
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,7 @@ | ||
output "backup_policy" { | ||
value = azurerm_data_protection_backup_policy_postgresql_flexible_server.backup_policy | ||
} | ||
|
||
output "backup_instance" { | ||
value = azurerm_data_protection_backup_instance_postgresql_flexible_server.backup_instance | ||
} |
39 changes: 39 additions & 0 deletions
39
infrastructure/modules/backup/postgresql_flexible_server/variables.tf
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,39 @@ | ||
variable "vault_id" { | ||
type = string | ||
} | ||
|
||
variable "vault_name" { | ||
type = string | ||
} | ||
|
||
variable "vault_location" { | ||
type = string | ||
} | ||
|
||
variable "vault_principal_id" { | ||
type = string | ||
} | ||
|
||
variable "backup_name" { | ||
type = string | ||
} | ||
|
||
variable "retention_period" { | ||
type = string | ||
} | ||
|
||
variable "backup_intervals" { | ||
type = list(string) | ||
} | ||
|
||
variable "server_id" { | ||
type = string | ||
} | ||
|
||
variable "server_resource_group_id" { | ||
type = string | ||
} | ||
|
||
variable "assign_resource_group_level_roles" { | ||
type = bool | ||
} |
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
Oops, something went wrong.