Skip to content

Modernized terraform script for deployment as a module of nasa-pds/registry#765

Merged
jordanpadams merged 5 commits into
developfrom
terraform_for_dev
May 26, 2026
Merged

Modernized terraform script for deployment as a module of nasa-pds/registry#765
jordanpadams merged 5 commits into
developfrom
terraform_for_dev

Conversation

@tloubrieu-jpl
Copy link
Copy Markdown
Member

@tloubrieu-jpl tloubrieu-jpl commented May 7, 2026

🗒️ Summary

Modernize the terraform code for consistency with other repository and so to be able to call the code as a module of the umbrella repository nasa-pds/registry deployment script.

Aborted attempt to use Pull Through Cache ECR configuration instead of a manual deployment of the docker image. We will have to come back to that later since it did not work.

🤖 AI Assistance Disclosure

  • No AI assistance used
  • AI used for light assistance (e.g., suggestions, refactoring, documentation help, minor edits)
  • AI used for moderate content generation (AI generated some code or logic, but the developer authored or heavily revised the majority)
  • AI generated substantial portions of this code

Estimated % of code influenced by AI: _50 %

⚙️ Test Data and/or Report

Tested with a deployment on AWS and integration tests succesfully run on it.

♻️ Related Issues

Also fixes #767 (integration test fix)

🤓 Reviewer Checklist

Reviewers: Please verify the following before approving this pull request.

Documentation and PR Content

  • Documentation: README, Wiki, or inline documentation (Sphinx, Javadoc, Docstrings) have been updated to reflect these changes.
  • Issue Traceability: The PR is linked to a valid GitHub Issue
  • PR Title: The PR title is "user-friendly" clearly identifying what is being fixed or the new feature being added, that if you saw it in the Release Notes for a tool, you would be able to get the gist of what was done.

Security & Quality

  • SonarCloud: Confirmed no new High or Critical security findings.
  • Secrets Detection: Verified that the Secrets Detection scan passed and no sensitive information (keys, tokens, PII) is exposed.
  • Code Quality: Code follows organization style guidelines and best practices for the specific language (e.g., PEP 8, Google Java Style).

Testing & Validation

  • Test Accuracy: Verified that test data is accurate, representative of real-world PDS4 scenarios, and sufficient for the logic being tested.
  • Coverage: Automated tests cover new logic and edge cases.
  • Local Verification: (If applicable) Successfully built and ran the changes in a local or staging environment.

Maintenance

  • Backward Compatibility: Confirmed that these changes do not break existing downstream dependencies or API contracts (or that breaking changes are clearly documented).

@tloubrieu-jpl tloubrieu-jpl requested a review from a team as a code owner May 7, 2026 03:17
@tloubrieu-jpl tloubrieu-jpl requested a review from a team May 7, 2026 03:17
Comment thread terraform/main.tf
}

# Add a Pull Through Cache rule for GHCR
resource "aws_ecr_pull_through_cache_rule" "ghcr" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow this is really cool. I had no idea this resource even existed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unfortunatly I was unable to make it work with a terrafrom deployment, I'll have to come back to it later.

Copy link
Copy Markdown
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

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

Excellent modernization of the Terraform structure that should make it more maintanable and easier to use. Just a few nits (see inline comments). Thanks!

Comment thread .gitignore Outdated
.terraform/
terraform/*.tfvars
!terraform/*.tfvars.example
terraform/.terraform.lock.hcl
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe the .terraform.lock.hcl has the same purpose as the package-lock.json in Node projects and exists to pin provider versions, avoiding the "works on my machine" issue. AI agrees and says .terraform.lock.hcl should be commited and the .gitingore line should be

!.terraform.lock.hcl

Comment thread terraform/main.tf

# Look up the secret when it is not created by this script
data "aws_secretsmanager_secret" "github_ecr_credentials" {
count = 1 - var.create_github_secret_credentials
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be safer to to do

type = bool
default = true

and do

count = var.create_github_secret_credentials ? 1 : 0

on the off chance that someone sets create_github_secret_credentials = 2, for example.

Comment thread terraform/main.tf
count = var.create_github_secret_credentials

secret_id = aws_secretsmanager_secret.github_ecr_credentials[count.index].id
secret_string = jsonencode({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might want to add a warning note to the README that the GitHub username and token become part of the Terraform state.

Comment thread terraform/output.tf
@@ -0,0 +1,19 @@
locals {

module_relative_path = replace(abspath(path.module), "/^.*\\/terraform(\\/|$)/", "")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this work? I didn't think Terraform's replace uses /.../ delimiters for regexes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

claude code came up with that syntax and it works.

@jordanpadams
Copy link
Copy Markdown
Member

@tloubrieu-jpl when you have a chance can you respond to all of @nutjob4life comments and triage the sonarcloud issues?

@tloubrieu-jpl tloubrieu-jpl requested a review from nutjob4life May 26, 2026 21:02
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @tloubrieu-jpl 👍

@jordanpadams
Copy link
Copy Markdown
Member

Numerous things called out by sonarcloud but will merge for now. Need to move this forward.

@jordanpadams jordanpadams merged commit a766359 into develop May 26, 2026
1 of 2 checks passed
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.

When a request /classes/{product class} does not match an existing product class, I want a 404 error.

3 participants