Skip to content

BFD-4155: Refactor EFT service into Greenfield Terraform - #2780

Merged
malessi merged 52 commits into
masterfrom
alessio/BFD-4155__eft-greenfield-v2
Aug 25, 2025
Merged

BFD-4155: Refactor EFT service into Greenfield Terraform#2780
malessi merged 52 commits into
masterfrom
alessio/BFD-4155__eft-greenfield-v2

Conversation

@malessi

@malessi malessi commented Aug 20, 2025

Copy link
Copy Markdown
Collaborator

JIRA Ticket:
BFD-4155

What Does This PR Do?

This PR refactors the legacy eft Terraservice into the new ops/services Greenfield OpenTofu hierarchy using the new patterns and style. It has been split into 02-eft and 03-eft-o11y (this Terraservice being the child module of the legacy eft Terraservice—now independent). Largely, the BFD EFT service itself is the same.

In more detail, this PR:

  • Introduces 02-eft to the Greenfield Terraform adapted from the legacy eft Terraservice
    • Resources have been refactored and re-organized to follow more modern BFD OpenTofu patterns and code style
    • Unnecessary resources (CIDR Reservations, CloudTamer-specific Roles, etc.) have been removed
    • sftp-outbound-transfer Lambda is now invoked by an SQS Queue associated with the existing Dead Letter Queue such that it is possible to easily redrive failing events
    • All SNS Topics now have logging enabled via the new logging-sns-topic OpenTofu Module (see below)
    • Introduces a new pattern for exporting automatic Terraservice outputs via SSM, see outputs.tf
  • Introduces 03-eft-o11y to the Greenfield Terraform adapted from the bfd_eft_outbound_o11y child module of the legacy eft Terraservice
    • Resources have been refactored and re-organized to follow more modern BFD OpenTofu patterns and code style
    • outbound-slack-notifier now uses uv
    • Consumes the new SSM outputs from eft (see inputs.tf) for values that were originally provided via variables
  • Introduces a new "general" OpenTofu Module for creating SNS Topics that log to CloudWatch Logs: logging-sns-topic
    • Creates all the necessary IAM resources, Log Groups, and SNS Topic
    • Exports the aws_sns_topic via outputs
    • Follow-up work will expand its usage to platform Terraservices and more

This PR seems quite large, and that is unfortunately due to copying the existing legacy Terraservice instead of moving it as we need to keep it around for the Greenfield transition of BFD EFT. Most additions are actually lines unchanged from the original Terraservice.

What Should Reviewers Watch For?

If you're reviewing this PR, please check for these things in particular:

  • See above

What Security Implications Does This PR Have?

Please indicate if this PR does any of the following:

  • Adds any new software dependencies

  • Modifies any security controls

  • Adds new transmission or storage of data

  • Any other changes that could possibly affect security?

  • I have considered the above security implications as it relates to this PR. (If one or more of the above apply, it cannot be merged without the ISSO or team security engineer's (@sb-benohe) approval.)

  • I have created tests to sufficiently ensure the reliability of my code, if applicable. If this is a modification to an existing piece of code, I have audited the associated tests to ensure everything works as expected.

Validation

Have you fully verified and tested these changes? Is the acceptance criteria met? Please provide reproducible testing instructions, code snippets, or screenshots as applicable.

  • tofu applying eft and eft-o11y to test Greenfield, verifying that:
    • Both applys are successful with no unexpected changes
  • sftping into the Transfer Family SFTP Server via the NLB created by eft, verifying that:
    • I am able to SFTP into it successfully and run commands
    • I am able to put a file to the bfd-test-eft... Bucket
  • Monitoring the sftp-outbound-transfer Lambda after uploading a file to dpc/out, verifying that:
    • It is invoked automatically
    • The Lambda attempts to upload the file, but is unable to due to CMS EFT's external firewall
    • The failing event is, eventually, put into the DLQ and it is possible to redrive the event from the AWS Console
    • The outbound-slack-notifier sends a Slack message indicating failure, as expected

malessi added 30 commits August 19, 2025 16:56
Enables easy redrive. This commit does not include the changes to support SQS event invocation in the Lambda itself

@malessi malessi left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left comments on all relevant files that are entirely additions to help guide reviews towards code that actually should be looked at.

If a file—that is marked as totally new—was left uncommented, that file can be safely ignored as it was copied directly from the legacy eft code or is just altogether unimportant. Anything marked as having changes should be reviewed like normal.

For some files I explicitly mark the lines that were changed with respect to the legacy Terraservice/code. Others have more substantial changes where enumerating each block and what it corresponds to in the legacy code would be too onerous, so I just commented that there were relevant changes and where to find the original code.

Comment thread ops/services/02-eft/lambda_src/sftp_outbound_transfer/Dockerfile
Comment thread ops/services/02-eft/lambda_src/sftp_outbound_transfer/uv.lock
Comment thread ops/services/02-eft/data-sources.tf
Comment thread ops/services/03-eft-o11y/notifier-lambda-iam.tf
Comment thread ops/services/03-eft-o11y/notifier-lambda.tf
Comment thread ops/services/03-eft-o11y/README.md
Comment thread ops/services/.opentofu-version
Comment thread ops/terraform-modules/general/logging-sns-topic/iam.tf
Comment thread ops/services/02-eft/lambda_src/sftp_outbound_transfer/sftp_outbound_transfer.py Outdated
Comment thread .github/workflows/build_container_images_matrix.json
@malessi
malessi enabled auto-merge August 25, 2025 16:07
@malessi
malessi added this pull request to the merge queue Aug 25, 2025
Merged via the queue into master with commit 790bb93 Aug 25, 2025
10 checks passed
@malessi
malessi deleted the alessio/BFD-4155__eft-greenfield-v2 branch August 25, 2025 16:08
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.

3 participants