Skip to content

Commit

Permalink
Merge branch 'bob/que-33-build-out-query-building-write-functionality…
Browse files Browse the repository at this point in the history
…-pt-3' of https://github.com/CDCgov/dibbs-query-connector into bob/que-33-build-out-query-building-write-functionality-pt-3
  • Loading branch information
fzhao99 committed Jan 10, 2025
2 parents c5b1619 + 912f8e2 commit 9302d82
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ecs_terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
merge_group:
types:
- checks_requested
push:
branches:
- main
workflow_dispatch:
inputs:
workspace:
description: "The workspace to terraform against"
description: "Choose terraform workspace for deployment"
required: true
type: string
default: "dev"
type: choice
options:
- dev
- demo
default: dev

concurrency:
group: ${{ github.event.inputs.workspace }}-terraform
Expand All @@ -25,7 +25,7 @@ permissions:
contents: read

env:
workspace: dev
workspace: ${{ github.event.inputs.workspace }}

jobs:
terraform:
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/terraform_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ name: Ad-hoc Terraform Plan
run-name: Terraform plan ${{ inputs.workspace }} by @${{ github.actor }}

on:
pull_request:
branches:
- shanice/deploy_demo_ecs
merge_group:
types:
- checks_requested
workflow_dispatch:
inputs:
workspace:
description: "The workspace to terraform against"
description: "Choose terraform workspace for deployment"
required: true
type: string
default: "dev"
type: choice
options:
- dev
- demo
default: dev

concurrency:
group: ${{ github.event.inputs.workspace }}-terraform
Expand All @@ -19,7 +28,7 @@ permissions:
contents: read

env:
workspace: dev
workspace: ${{ github.event.inputs.workspace }}

jobs:
terraform:
Expand Down Expand Up @@ -49,7 +58,6 @@ jobs:

- name: Terraform
env:
# ACTION: ${{ env.terraform_action }}
BUCKET: ${{ secrets.TFSTATE_BUCKET }}
DYNAMODB_TABLE: ${{ secrets.TFSTATE_DYNAMODB_TABLE }}
REGION: ${{ vars.region }}
Expand All @@ -60,6 +68,7 @@ jobs:
TLS_KEY: ${{ secrets.TLS_KEY}}
shell: bash
run: |
echo "Deploying to ${{ github.event.inputs.workspace }}..."
rm -rf .terraform .terraform.lock.hcl
terraform init \
-var-file="$WORKSPACE.tfvars" \
Expand All @@ -68,6 +77,12 @@ jobs:
-backend-config "region=$REGION" \
|| (echo "terraform init failed, exiting..." && exit 1)
terraform workspace select "$WORKSPACE"
terraform apply -auto-approve -target=aws_acm_certificate.cloudflare_cert \
-var-file="$WORKSPACE.tfvars" \
-var "umls_api_key=${UMLS_API_KEY}" \
-var "ersd_api_key=${ERSD_API_KEY}" \
-var "qc_tls_key=${TLS_KEY}" \
-var "qc_tls_cert=${TLS_CERT}"
terraform plan \
-var-file="$WORKSPACE.tfvars" \
-var "umls_api_key=${UMLS_API_KEY}" \
Expand Down
3 changes: 3 additions & 0 deletions terraform/implementation/ecs/demo.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
owner = "skylight"
project = "qc"
region = "us-east-1"
8 changes: 4 additions & 4 deletions terraform/implementation/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ module "ecs" {

resource "aws_db_instance" "qc_db" {
allocated_storage = "10"
db_name = var.qc_db_name
identifier = var.db_identifier
db_name = "${var.qc_db_name}_${terraform.workspace}"
identifier = "${var.db_identifier}-${terraform.workspace}"
engine = var.db_engine_type
engine_version = var.db_engine_version
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
Expand All @@ -152,14 +152,14 @@ resource "aws_db_instance" "qc_db" {

# Create a DB subnet group
resource "aws_db_subnet_group" "this" {
name = "${var.db_identifier}-subnet-group"
name = "${var.db_identifier}-subnet-group-${terraform.workspace}"
subnet_ids = module.vpc.private_subnets

}

# Create a parameter group to configure Postgres RDS parameters
resource "aws_db_parameter_group" "this" {
name = "${var.db_identifier}-pg"
name = "${var.db_identifier}-pg-${terraform.workspace}"
family = var.db_family

parameter {
Expand Down

0 comments on commit 9302d82

Please sign in to comment.