Skip to content
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

Configure EBS_snapshot_archive using terraform #6262

Merged

Conversation

pvisweswar
Copy link
Contributor

Ticket : https://dimagi.atlassian.net/browse/SAAS-15185

Environments Affected : Staging

@@ -22,6 +22,7 @@ backup_plan:
weekly_retention: 14
monthly_retention: 62
quarterly_retention: 180
cold_storage_after : 8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cold_storage_after : 8 indicating that recovery points created by the backup system will be moved to cold storage after 8 days from their creation, as mentioned on the console as well in staging environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dannyroberts This PR looks in good shape, before merging it, I want to ensure that you are okay with the change where we move our quarterly backups to cold storage after 8 days? Let me know if you want this value to be larger or smaller.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We chatted in the meeting today, but yeah 8 days sounds good to me!

@@ -88,6 +88,8 @@ resource "aws_backup_plan" "business_continuity_plan" {

lifecycle {
delete_after = max(var.quarterly_retention, var.monthly_retention)
cold_storage_after = var.cold_storage_after
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cold_storage_after : this determines how many days after being created a recovery point gets moved to cold storage.

We hardcoded the value of the cold_storage_after parameter as a variable. So, we specified the value in the environmental files under terraform.yml.

Ref Link : https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_plan#lifecycle-arguments

@@ -88,6 +88,8 @@ resource "aws_backup_plan" "business_continuity_plan" {

lifecycle {
delete_after = max(var.quarterly_retention, var.monthly_retention)
cold_storage_after = var.cold_storage_after
opt_in_to_archive_for_supported_resources = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt_in_to_archive_for_supported_resources : this allows backup plan to transition supported resources to archive (cold) storage based on lifecycle settings.

For the opt_in_to_archive_for_supported_resources parameter, we set the value to true because we are enabling the Cold Storage option for Amazon EBS on the console.

Ref Link : https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_plan#lifecycle-arguments


variable "cold_storage_after" {
type = number
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are defining the variable name and variable type. This variable will be used to specify the number of days after creation that a recovery point is moved to cold storage.

@@ -104,6 +104,7 @@ class BackupPlan(jsonobject.JsonObject):
weekly_retention = jsonobject.IntegerProperty()
monthly_retention = jsonobject.IntegerProperty()
quarterly_retention = jsonobject.IntegerProperty()
cold_storage_after = jsonobject.IntegerProperty()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are defining a property named cold_storage_after as an IntegerProperty.

@AmitPhulera AmitPhulera merged commit 50f9c92 into dimagi:master May 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants