mdn / infra

(Deprecated) MDN Web Docs Infrastructure scripts and configuration
Mozilla Public License 2.0
53 stars 32 forks source link

[SE-2281] postgres import #505

Closed bkochendorfer closed 3 years ago

bkochendorfer commented 3 years ago

This PR imports our Postgres databases and replica which were created manually in the AWS console. This is phase 1 of this move. Phase 2 is @escattone will be shutting down mysql. I will remove those things from terraform and allow terraform to do the destroy. In Phase 3 I will change the name of this module from module.mysql to module.rds and do a terraform state mv.

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.mysql-eu-central-1-replica-prod.aws_db_instance.postgres_replica[0] will be updated in-place
  ~ resource "aws_db_instance" "postgres_replica" {
      + apply_immediately                     = true
        id                                    = "mdn-prod-postgres-replica"
      ~ multi_az                              = false -> true
        name                                  = "developer_mozilla_org"
      ~ tags                                  = {
          + "Environment" = "prod"
          + "Name"        = "mdn-prod-postgres-replica"
          + "Region"      = "eu-central-1"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
      ~ tags_all                              = {
          + "Environment" = "prod"
          + "Name"        = "mdn-prod-postgres-replica"
          + "Region"      = "eu-central-1"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
        # (44 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.mysql-us-west-2.aws_db_instance.mdn_postgres[0] will be updated in-place
  ~ resource "aws_db_instance" "mdn_postgres" {
      + allow_major_version_upgrade           = false
      + final_snapshot_identifier             = "mdn-prod-postgres-final"
        id                                    = "mdn-stage-postgres"
      ~ multi_az                              = false -> true
        name                                  = "developer_allizom_org"
      + password                              = (sensitive value)
      ~ skip_final_snapshot                   = true -> false
      ~ tags                                  = {
          + "Environment" = "stage"
          + "Name"        = "MDN-stage-postgres"
          + "Region"      = "us-west-2"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
      ~ tags_all                              = {
          + "Environment" = "stage"
          + "Name"        = "MDN-stage-postgres"
          + "Region"      = "us-west-2"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
        # (43 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.mysql-us-west-2-prod.aws_db_instance.mdn_postgres[0] will be updated in-place
  ~ resource "aws_db_instance" "mdn_postgres" {
      + allow_major_version_upgrade           = false
      - deletion_protection                   = true -> null
      + final_snapshot_identifier             = "mdn-prod-postgres-final"
        id                                    = "mdn-prod-postgres"
        name                                  = "developer_mozilla_org"
      + password                              = (sensitive value)
      ~ skip_final_snapshot                   = true -> false
      ~ tags                                  = {
          + "Environment" = "prod"
          + "Name"        = "MDN-prod-postgres"
          + "Region"      = "us-west-2"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
      ~ tags_all                              = {
          + "Environment" = "prod"
          + "Name"        = "MDN-prod-postgres"
          + "Region"      = "us-west-2"
          + "Service"     = "MDN"
          + "Terraform"   = "true"
        }
        # (43 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }
bkochendorfer commented 3 years ago

@escattone updated the delete_protection option. I'd feel more comfortable with multi-az set to true as it helps with our availability story. You are correct that it does cost a little bit more but is the same setting we have for mysql so the cost should be the same.