-
Notifications
You must be signed in to change notification settings - Fork 0
[PLT-1358] Add SOPS to cdap to manage SSM parameter store #324
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
Draft
juliareynolds-nava
wants to merge
13
commits into
main
Choose a base branch
from
plt-1358_sops
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
07d938f
initial configuration
juliareynolds-nava 9dc2565
created test and prod yaml files, generated readme
juliareynolds-nava b2be03c
add usage to readme
juliareynolds-nava 92f0df9
PR feedback
juliareynolds-nava 4bb8ee4
[PLT-1108] Updating web module README sample usage commit hashes refs…
jscott-nava 0532b39
[PLT-1299]. Cluster changes for ecs service module (#316)
juliareynolds-nava 152d2b8
[PLT-1371] added workflows to dependabot (#323)
juliareynolds-nava e58fd49
BCDA-9395: use full service name for execution role (#325)
michaeljvaldes f80877b
added github workflow
juliareynolds-nava 012b65f
corrected service name
juliareynolds-nava f5e1308
include cdap mgmt
juliareynolds-nava c8924de
Adopting variable for env.
juliareynolds-nava 91e9822
dupe variable for app
juliareynolds-nava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,62 @@ | ||
name: tf-sops | ||
run-name: tf-sops ${{ (inputs.apply || (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule') && 'apply' || 'plan' }} | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/tf-sops.yml | ||
- terraform/services/config/** | ||
schedule: | ||
- cron: "12 14 * * 1-5" | ||
workflow_dispatch: | ||
inputs: | ||
apply: | ||
required: false | ||
type: boolean | ||
description: "Apply the terraform?" | ||
|
||
env: | ||
TENV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
defaults: | ||
run: | ||
working-directory: ./terraform/services/config | ||
|
||
jobs: | ||
check-fmt: | ||
runs-on: codebuild-cdap-${{github.run_id}}-${{github.run_attempt}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 | ||
- uses: cmsgov/cdap/actions/setup-tenv@8343fb96563ce4b74c4dececee9b268f42bd4a40 | ||
- run: tofu fmt -check -diff -recursive . | ||
|
||
plan-apply: | ||
needs: check-fmt | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: codebuild-cdap-${{github.run_id}}-${{github.run_attempt}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
app: [cdap] | ||
env: [test, prod] | ||
include: | ||
- app: cdap | ||
env: mgmt | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 | ||
- uses: cmsgov/cdap/actions/setup-tenv@8343fb96563ce4b74c4dececee9b268f42bd4a40 | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ contains(fromJSON('["test", "prod"]'), matrix.env) && secrets.NON_PROD_ACCOUNT || secrets.PROD_ACCOUNT }}:role/delegatedadmin/developer/${{ matrix.app }}-${{ matrix.env }}-github-actions | ||
aws-region: ${{ vars.AWS_REGION }} | ||
- run: tofu init -backend-config=../../backends/${{ matrix.app }}-${{ matrix.env }}.s3.tfbackend | ||
- run: tofu plan -out=tf.plan | ||
env: | ||
TF_VAR_app: ${{ matrix.app }} | ||
TF_VAR_env: ${{ matrix.env }} | ||
- if: inputs.apply || (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' | ||
run: tofu apply -auto-approve tf.plan |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,63 @@ | ||
# CDAP Config Root Module | ||
|
||
This root module is responsible for configuring the sops-enabled strategy for storing sensitive and nonsensitive configuration in AWS SSM Parameter Store. | ||
The _parent environment_ specific configuration values are located in the `values` directory. | ||
|
||
Usage: | ||
```hcl | ||
# declare the `db` module, defining the desired input variables | ||
module "db" { | ||
source = "github.com/CMSgov/cdap//terraform/modules/aurora" | ||
|
||
backup_retention_period = module.platform.is_ephemeral_env ? 1 : 7 | ||
deletion_protection = !module.platform.is_ephemeral_env | ||
password = module.platform.ssm.core.database_password.value | ||
username = module.platform.ssm.core.database_user.value | ||
platform = module.platform | ||
|
||
} | ||
|
||
# use the `db` module's output to write parameter to SSM parameter store: | ||
resource "aws_ssm_parameter" "writer_endpoint" { | ||
name = "/cdap/writer_endpoint" | ||
value = "${module.db.aurora_cluster.endpoint}:${module.db.aurora_cluster.port}" | ||
type = "String" | ||
} | ||
``` | ||
|
||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5 | | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_platform"></a> [platform](#module\_platform) | github.com/CMSgov/cdap//terraform/modules/platform | ff2ef539fb06f2c98f0e3ce0c8f922bdacb96d66 | | ||
| <a name="module_sops"></a> [sops](#module\_sops) | github.com/CMSgov/cdap//terraform/modules/sops | ff2ef539fb06f2c98f0e3ce0c8f922bdacb96d66 | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_region"></a> [region](#input\_region) | n/a | `string` | `"us-east-1"` | no | | ||
| <a name="input_secondary_region"></a> [secondary\_region](#input\_secondary\_region) | n/a | `string` | `"us-west-2"` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_edit"></a> [edit](#output\_edit) | n/a | | ||
<!-- END_TF_DOCS --> |
This file contains hidden or 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,33 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
module "platform" { | ||
source = "github.com/CMSgov/cdap//terraform/modules/platform?ref=ff2ef539fb06f2c98f0e3ce0c8f922bdacb96d66" | ||
providers = { aws = aws, aws.secondary = aws.secondary } | ||
|
||
app = local.app | ||
env = var.env | ||
root_module = "https://github.com/CMSgov/cdap/tree/terraform/services/config" | ||
service = local.service | ||
} | ||
|
||
locals { | ||
default_tags = module.platform.default_tags | ||
app = local.app | ||
service = "config" | ||
} | ||
|
||
module "sops" { | ||
source = "github.com/CMSgov/cdap//terraform/modules/sops?ref=ff2ef539fb06f2c98f0e3ce0c8f922bdacb96d66" | ||
platform = module.platform | ||
} | ||
|
||
output "edit" { | ||
value = module.sops.sopsw | ||
} |
This file contains hidden or 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,43 @@ | ||
locals { | ||
app = "cdap" | ||
state_bucket = "cdap-mgmt-s3.tfbackend" | ||
} | ||
|
||
variable "region" { | ||
default = "us-east-1" | ||
nullable = false | ||
type = string | ||
} | ||
|
||
variable "secondary_region" { | ||
default = "us-west-2" | ||
nullable = false | ||
type = string | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
default_tags { | ||
tags = local.default_tags | ||
} | ||
} | ||
|
||
provider "aws" { | ||
alias = "secondary" | ||
|
||
region = var.secondary_region | ||
default_tags { | ||
tags = local.default_tags | ||
} | ||
} | ||
|
||
terraform { | ||
backend "s3" { | ||
bucket = local.state_bucket | ||
key = "config/terraform.tfstate" | ||
region = var.region | ||
encrypt = true | ||
kms_key_id = "alias/cdap-mgmt" | ||
use_lockfile = true | ||
} | ||
} |
This file contains hidden or 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,17 @@ | ||
/cdap/account/security_events_slack_renotify_after_days: 30 | ||
/cdap/account/security_events_slack_severity_list: CRITICAL,HIGH,MEDIUM | ||
/cdap/sensitive/account/security_events_slack_webhook_url: ENC[AES256_GCM,data:z9MLEAlb76u6MZ+GWcWcfnRtax1J677k47tabDmwCqAGN7H2BrmTnkIs1fAhl9dShaL5qZrq78s0sY9b2hCAGIWWaUenVbGGpWBuZvh7rw==,iv:kbgCH76ryIbnU40SWd/Wgg+hULSgGsTO4LLWIPoDE68=,tag:NmwrTB/oVI0WEhL9R5eV2g==,type:str] | ||
/cdap/sensitive/bucket-access-logs-bucket: ENC[AES256_GCM,data:TjwtktvWlh7Gt7JrTuxZganUT3AotzmEAeYKkpn5GutLcIT1/KSpTV1kjMxV,iv:fSMld0pXjqKabcq+8CK7kG018tspwVAS30ngYFepJKw=,tag:dMsUtxHVSpiHb9U+ebUbNg==,type:str] | ||
/cdap/sensitive/mgmt-vpc/cidr: ENC[AES256_GCM,data:uNKE6Nckt24ZWHDHEWjU,iv:yVvl1HbK7ljy6lgZdGUkfi0CeIHPnd2uof9tVB1z008=,tag:9tQ1atj1Vwkgw6j1FQ8p5w==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-a: ENC[AES256_GCM,data:FlVrW4HMpGxShfezY7k=,iv:5pZNFGbdfyrGCti7cL/7pfm4S3i5VpnESEO5Rglqw7E=,tag:NZIPNuaSZD/NSD6Q2sE2PQ==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-b: ENC[AES256_GCM,data:N1zEW1bym0cRrT5b,iv:+i6TbqeQLVdZRGUb/O0FUDSEXHsuxxW8hEJbQJYy8gU=,tag:dypP4NS1W0h0c+SeMmuI+g==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-c: ENC[AES256_GCM,data:dE2gJAAstO0VcCol,iv:C5g6vtQbu6AQUmtobCrnZmFcBc4Pn6EZmex1YhQqXA8=,tag:gsAznB9ygxhNdpK73HbAwQ==,type:str] | ||
sops: | ||
kms: | ||
- arn: arn:aws:kms:us-east-1:${ACCOUNT_ID}:key/e32dffdb-97e7-4b64-b5cb-f6dc4e6fabca | ||
created_at: "2025-10-03T17:27:53Z" | ||
enc: AQICAHiXhc+HhELIyRKOpc5vBWQJB9/2XFW+CxWFIfUyci0r/wGkXSt3AG0b8bCJ0pVuEmyuAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM+S5DlWnhTDkMvmOxAgEQgDvMXlly/I5Vb2ah1KX2fSbY3mMOxA92rK4MU/rsyUN2oR8WXebzzW+ooNY1pEdGE4FMUmLUrU5qbcUoPg== | ||
aws_profile: "" | ||
encrypted_regex: sensitive | ||
mac_only_encrypted: true | ||
version: 3.11.0 |
This file contains hidden or 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,16 @@ | ||
/cdap/account/security_events_slack_renotify_after_days: 30 | ||
/cdap/account/security_events_slack_severity_list: CRITICAL,HIGH,MEDIUM | ||
/cdap/sensitive/account/security_events_slack_webhook_url: ENC[AES256_GCM,data:J70QSI23I0d1OnvD+n2ncd/ii0XiZ3NRcQqVwCLCBd7UxRIKgJ1YWqCZ9xV2Y8s/4fy+hi8iVvIkd0WdnC1Q9Adwh2rvRKKWM6lS59EYlA==,iv:/ZIY4WGOsxo2pR/t2FYADYcUeEq5eutP43KkNeTa3q0=,tag:HYuxPAStpJZ0t39j/xHLYg==,type:str] | ||
/cdap/sensitive/bucket-access-logs-bucket: ENC[AES256_GCM,data:I8m2zMO44IB1FnAuK08G99390eF5NjLcKTVvY4T5oD2O6/Apt3oSV3GAUldn,iv:DQUyoHG1Gplx4YuogWcG9kZnK3XTZXC+N5Ayzyb6LDM=,tag:wQpSTHVaItOGb3PC6tHw/w==,type:str] | ||
/cdap/sensitive/mgmt-vpc/cidr: ENC[AES256_GCM,data:bKqvpJcIqTqG9DkzO1/T,iv:ul/XIzIZ3BnERohYmuM7fWXWTYI0b45T4F2lUFHkvIw=,tag:LEpy1QiHUoGlTg+mKUaQtg==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-a: ENC[AES256_GCM,data:dAMCs1t1aqfpzibaswE=,iv:g6q2MfSpDZeaSSkpkdwZhGD0ZCdlvrJpHoGVTD1+FfU=,tag:7Z5gSQuDlI0wjBiafCJmDA==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-b: ENC[AES256_GCM,data:tfr8BWh6eKGNsUkx,iv:oAHGGbq9ttxnJ99I70Z7IXIgKRSPkvqIkAmVOyBzWus=,tag:iZ1A8L7mUQLJvJ6uWsoF6A==,type:str] | ||
/cdap/mgmt/public_nat_ipv4/sensitive/cdap-east-mgmt-c: ENC[AES256_GCM,data:nIVBfKDdYIzOObjj,iv:5E2wwUCOtBtmjpAnWOBZxUJVIqci3o2ncBNQmzEOEPM=,tag:bygAmJUYfbP4tLcFRu94XQ==,type:str] | ||
sops: | ||
kms: | ||
- arn: arn:aws:kms:us-east-1:${ACCOUNT_ID}:key/e32dffdb-97e7-4b64-b5cb-f6dc4e6fabca | ||
created_at: "2025-10-03T17:38:55Z" | ||
enc: AQICAHiXhc+HhELIyRKOpc5vBWQJB9/2XFW+CxWFIfUyci0r/wGgF/ZOMV/LMrvJSRhtedM1AAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM8xXrZN9mTFGkvKjtAgEQgDsOpxt5mGlXEpdiTlnAjnt/AcOMpA8coSH4NHWfC2Tsw/VES55XVAaWQYXuOOdKnIJznMlUqzqBVrfvTw== | ||
aws_profile: "" | ||
encrypted_regex: sensitive | ||
version: 3.11.0 |
This file contains hidden or 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,8 @@ | ||
variable "env" { | ||
description = "The application environment (test, prod)" | ||
type = string | ||
validation { | ||
condition = contains(["test", "prod"], var.env) | ||
error_message = "Valid value for env is test or prod." | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only attribute that needs to be set here is
key = "config/terraform.tfstate"