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

Instantiate dev DB #12

Merged
merged 26 commits into from
Nov 13, 2023
Merged

Instantiate dev DB #12

merged 26 commits into from
Nov 13, 2023

Conversation

duynguyen158
Copy link
Contributor

@duynguyen158 duynguyen158 commented Nov 13, 2023

Description

Instantiates a dev DB with roles, extensions, etc. as defined in terraform/stages/dev. AWS CodePipeline will take care of deploying these changes.

Also updates the article-rec-db PyPI package with new models. Alembic upgrade to dev database will be handled by next PR.

> poe terraform dev plan    
Poe => terraform -chdir=terraform/stages/dev plan
data.aws_ssm_parameter.credentials_admin: Reading...
data.aws_ssm_parameter.credentials_admin: Read complete after 0s [id=/dev/article-rec/admin/all/database-credentials]

Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.db.aws_ssm_parameter.training_job_site_credentials["afro-la"] will be created
  + resource "aws_ssm_parameter" "training_job_site_credentials" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "/dev/article-rec/afro-la/training-job/database-credentials"
      + tags_all       = (known after apply)
      + tier           = (known after apply)
      + type           = "String"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

  # module.db.aws_ssm_parameter.training_job_site_credentials["dallas-free-press"] will be created
  + resource "aws_ssm_parameter" "training_job_site_credentials" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "/dev/article-rec/dallas-free-press/training-job/database-credentials"
      + tags_all       = (known after apply)
      + tier           = (known after apply)
      + type           = "String"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

  # module.db.postgresql_database.db will be created
  + resource "postgresql_database" "db" {
      + allow_connections = true
      + connection_limit  = -1
      + encoding          = (known after apply)
      + id                = (known after apply)
      + is_template       = (known after apply)
      + lc_collate        = (known after apply)
      + lc_ctype          = (known after apply)
      + name              = "dev"
      + owner             = (known after apply)
      + tablespace_name   = (known after apply)
      + template          = (known after apply)
    }

  # module.db.postgresql_extension.pgvector will be created
  + resource "postgresql_extension" "pgvector" {
      + create_cascade = false
      + database       = "dev"
      + drop_cascade   = false
      + id             = (known after apply)
      + name           = "vector"
      + schema         = (known after apply)
      + version        = "0.4.1"
    }

  # module.db.postgresql_role.training_job will be created
  + resource "postgresql_role" "training_job" {
      + bypass_row_level_security = false
      + connection_limit          = -1
      + create_database           = false
      + create_role               = false
      + encrypted_password        = true
      + id                        = (known after apply)
      + inherit                   = true
      + login                     = false
      + name                      = "dev_training_job"
      + replication               = false
      + skip_drop_role            = false
      + skip_reassign_owned       = false
      + superuser                 = false
      + valid_until               = "infinity"
    }

  # module.db.postgresql_role.training_job_site["afro-la"] will be created
  + resource "postgresql_role" "training_job_site" {
      + bypass_row_level_security = false
      + connection_limit          = -1
      + create_database           = false
      + create_role               = false
      + encrypted_password        = true
      + id                        = (known after apply)
      + inherit                   = true
      + login                     = true
      + name                      = "dev_training_job_afro_la"
      + password                  = (sensitive value)
      + replication               = false
      + roles                     = [
          + "dev_training_job",
        ]
      + skip_drop_role            = false
      + skip_reassign_owned       = false
      + superuser                 = false
      + valid_until               = "infinity"
    }

  # module.db.postgresql_role.training_job_site["dallas-free-press"] will be created
  + resource "postgresql_role" "training_job_site" {
      + bypass_row_level_security = false
      + connection_limit          = -1
      + create_database           = false
      + create_role               = false
      + encrypted_password        = true
      + id                        = (known after apply)
      + inherit                   = true
      + login                     = true
      + name                      = "dev_training_job_dallas_free_press"
      + password                  = (sensitive value)
      + replication               = false
      + roles                     = [
          + "dev_training_job",
        ]
      + skip_drop_role            = false
      + skip_reassign_owned       = false
      + superuser                 = false
      + valid_until               = "infinity"
    }

  # module.db.random_password.training_job_site_password["afro-la"] will be created
  + resource "random_password" "training_job_site_password" {
      + bcrypt_hash      = (sensitive value)
      + id               = (known after apply)
      + length           = 20
      + lower            = true
      + min_lower        = 0
      + min_numeric      = 0
      + min_special      = 0
      + min_upper        = 0
      + number           = true
      + numeric          = true
      + override_special = "!@$"
      + result           = (sensitive value)
      + special          = true
      + upper            = true
    }

  # module.db.random_password.training_job_site_password["dallas-free-press"] will be created
  + resource "random_password" "training_job_site_password" {
      + bcrypt_hash      = (sensitive value)
      + id               = (known after apply)
      + length           = 20
      + lower            = true
      + min_lower        = 0
      + min_numeric      = 0
      + min_special      = 0
      + min_upper        = 0
      + number           = true
      + numeric          = true
      + override_special = "!@$"
      + result           = (sensitive value)
      + special          = true
      + upper            = true
    }

Plan: 9 to add, 0 to change, 0 to destroy.

Testing

Init tests are removed now that Terraform is used. All tests passed.

@duynguyen158 duynguyen158 merged commit a85a391 into dev Nov 13, 2023
1 check passed
@duynguyen158 duynguyen158 deleted the orm-install-terraform branch November 13, 2023 18:54
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.

1 participant