-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-691 Apply api rds service to ab2d test (#134)
## 🎫 Ticket https://jira.cms.gov/browse/PLT-691 ## 🛠 Changes Added management of AB2D Test environment to api-rds service in Platform repository Imported existing resources to state file to track managed components ## ℹ️ Context Changes were made to centralize database management under PLT-691 and PLT-563 <!-- If any of the following security implications apply, this PR must not be merged without Stephen Walter's approval. Explain in this section and add @SJWalter11 as a reviewer. - Adds a new software dependency or dependencies. - Modifies or invalidates one or more of our security controls. - Stores or transmits data that was not stored or transmitted before. - Requires additional review of security implications for other reasons. --> ## 🧪 Validation Clean terraform plans will resolve locally and will be shown in GHA tasks --------- Co-authored-by: HK <hunkeelin@navapbc.com> Co-authored-by: Sean Fern <seanfern@navapbc.com>
- Loading branch information
1 parent
e165cdb
commit e34d9c8
Showing
5 changed files
with
231 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: api-rds apply terraform | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/api-rds-apply.yml | ||
- terraform/services/api-rds/** | ||
workflow_dispatch: # Allow manual trigger | ||
|
||
jobs: | ||
terraform-apply: | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./terraform/services/api-rds | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
app: [ab2d] | ||
env: [test] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./actions/setup-tfenv-terraform | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ matrix.app == 'ab2d' && secrets[format('{0}_{1}_ACCOUNT', matrix.app, matrix.env)] || secrets.BCDA_ACCOUNT }}:role/delegatedadmin/developer/${{ matrix.app }}-${{ matrix.env }}-github-actions | ||
aws-region: ${{ vars.AWS_REGION }} | ||
- run: terraform init -backend-config=../../backends/${{ matrix.app }}-${{ matrix.env }}.s3.tfbackend | ||
- uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main | ||
env: | ||
AWS_REGION: ${{ vars.AWS_REGION }} | ||
with: | ||
params: | | ||
TF_VAR_jenkins_security_group_id=/jenkins/security-group | ||
- run: terraform apply -auto-approve | ||
env: | ||
TF_VAR_app: ${{ matrix.app }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
locals { | ||
secret_date = "2020-01-02-09-15-01" | ||
} | ||
|
||
data "aws_default_tags" "data_tags" {} | ||
|
||
data "aws_secretsmanager_secret" "secret_database_password" { | ||
name = "ab2d/${local.db_name}/module/db/database_password/${local.secret_date}" | ||
} | ||
data "aws_secretsmanager_secret_version" "database_password" { | ||
secret_id = data.aws_secretsmanager_secret.secret_database_password.id | ||
} | ||
|
||
data "aws_secretsmanager_secret" "secret_database_user" { | ||
name = "ab2d/${local.db_name}/module/db/database_user/${local.secret_date}" | ||
} | ||
data "aws_secretsmanager_secret_version" "database_user" { | ||
secret_id = data.aws_secretsmanager_secret.secret_database_user.id | ||
} | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
data "aws_region" "current" {} | ||
|
||
data "aws_vpc" "target_vpc" { | ||
filter { | ||
name = "tag:Name" | ||
values = ["${local.db_name}"] | ||
} | ||
} | ||
|
||
data "aws_subnet" "private_subnet_a" { | ||
filter { | ||
name = "tag:Name" | ||
values = ["${local.db_name}-private-a"] | ||
} | ||
} | ||
|
||
data "aws_subnet" "private_subnet_b" { | ||
filter { | ||
name = "tag:Name" | ||
values = ["${local.db_name}-private-b"] | ||
} | ||
} | ||
|
||
data "aws_security_group" "controller_security_group_id" { | ||
tags = { | ||
Name = "${local.db_name}-deployment-controller-sg" | ||
} | ||
} | ||
|
||
data "aws_kms_alias" "main_kms" { | ||
name = "alias/${local.db_name}-main-kms" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters