Copy RDS tags to snapshot
Affected versions
All RDS clusters and databases created before this update.
Rationale
All resources created by Golden Path should have the same set of tags to ensure that we can search for anything that has been created in that stack.
The default for RDS is to not copy the original tags to any snapshots created. This update will ensure that all snapshots created from a RDS cluster will have the same tags.
Related issues
The template was updated in #1033
Manual upgrades
To apply this upgrade, follow the steps described below.
Assumption: all configuration of RDS is located in database/postgres_aurora_serverless.tf
Step 1: Update args-rds-aurora
module "args_rds" {
# https://github.com/oslokommune/golden-path-iac/tree/main/terraform/modules/args-rds-aurora
- source = "git@github.com:oslokommune/golden-path-iac//terraform/modules/args-rds-aurora?ref=args-rds-aurora-v0.6.0"
+ source = "git@github.com:oslokommune/golden-path-iac//terraform/modules/args-rds-aurora?ref=args-rds-aurora-v0.6.1"
}
Step 2: Enable copy tags
Add the configuration for copying tags to all snapshots:
deletion_protection = local.args_rds.deletion_protection
+ copy_tags_to_snapshot = local.args_rds.copy_tags_to_snapshot
Step 3: Update modules
Update args-rds-aurora
by running: terraform init
.
Step 4: Apply changes
Apply the changes by running terraform apply
, the output should look similar
to this:
# module.rds_aurora_serverless_main.aws_rds_cluster.this[0] will be updated in-place
~ resource "aws_rds_cluster" "this" {
~ copy_tags_to_snapshot = false -> true
id = "heide-dev-main"
tags = {
"CreatedBy" = "ok-golden-path"
"Database" = "heide-dev-main"
"Environment" = "heide-dev"
"Team" = "heide"
}
# (38 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# module.rds_aurora_serverless_main.aws_rds_cluster_instance.this["one"] will
# be updated in-place
~ resource "aws_rds_cluster_instance" "this" {
~ copy_tags_to_snapshot = false -> true
id = "heide-dev-main-one"
tags = {
"CreatedBy" = "ok-golden-path"
"Database" = "heide-dev-main"
"Environment" = "heide-dev"
"Team" = "heide"
}
# (29 unchanged attributes hidden)
# (1 unchanged block hidden)
}
Step 5: Verify snapshot tags
Create a snapshot from the AWS console and verify that the database tags have been copied to the snapshot.