Skip to content

Terraform Cloud #9

Closed
ajbarea wants to merge 26 commits intomainfrom
dev
Closed

Terraform Cloud #9
ajbarea wants to merge 26 commits intomainfrom
dev

Conversation

@ajbarea
Copy link
Copy Markdown
Owner

@ajbarea ajbarea commented Jul 8, 2025

Pull Request Overview

This PR updates Terraform version constraints and provider versions, and refines the AWS Cognito resource configuration to address a region-related issue in Terraform Cloud.

  • Bump Terraform required_version to >= 1.8.0 and update AWS, local, and archive provider versions.
  • Enhance aws_cognito_user_pool_client with token validity units and attribute settings.
  • Apply configuration adjustments for Terraform Cloud compatibility.

ajbarea added 2 commits July 8, 2025 07:50
…; First attemp at resolving Terraform Cloud errors
…; Second attemp at resolving Terraform Cloud errors
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
backend/app.py 100.00% <100.00%> (ø)
config.py 100.00% <100.00%> (ø)
configure_storage.py 100.00% <100.00%> (ø)
main.py 100.00% <100.00%> (ø)
setup_cognito.py 100.00% <100.00%> (ø)
src/image_processor.py 100.00% <100.00%> (ø)
src/storage_adapter.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ajbarea added 16 commits July 10, 2025 13:30
…idation

- Removed special character validation from client-side password check
- Aligned frontend validation with Cognito configuration (require_symbols = false)
- Users can now create passwords without special characters as intended
…ng (because I hit S3 free tier limit)

- Added unified storage interface supporting both AWS S3 and GCS backends
- Enabled seamless switching between storage providers via environment variables
- Added comprehensive test suite for both storage backends
- Added configuration script for easy backend management
- Added detailed documentation for storage adapter usage
- Useful for development when hitting AWS free tier limits
- Replaced direct AWS S3 calls with storage adapter functions
- Updated import statements to use storage_adapter module
- Updated tests to reflect new storage adapter integration
- Maintained backwards compatibility with existing functionality
- Added Cognito setup script for creating authentication resources
- Added FastAPI backend with health check and image processing endpoints
- Added comprehensive backend documentation for local development
- Enabled frontend/backend development without the need for Terraform deployment or S3 bucket access
- Added FastAPI and development dependencies to pyproject.toml
- Added optional GCS dependencies for storage adapter
- Added VS Code task for running FastAPI backend
- Updated configuration to support new local development workflow
…mpt 2691 at trying to fix Terraform Cloud run
@ajbarea ajbarea requested a review from Copilot July 10, 2025 21:34
@ajbarea ajbarea marked this pull request as ready for review July 10, 2025 21:34

This comment was marked as outdated.

ajbarea added 8 commits July 11, 2025 10:33
This commit refactors the storage adapter and its command-line
configuration script.

The `configure_storage.py` script has been improved with a more
structured command handling and clearer usage instructions.

The `storage_adapter.py` has been updated with better error handling
and code coverage exclusions for parts that are difficult to test
automatically.

The tests for the storage adapter have been refactored for better
clarity and isolation. New tests have been added to cover the
configuration CLI.
This commit introduces several improvements to the Terraform
configuration.

- Adds a `locals.tf` file to define common tags and file-related
  locals.
- Standardizes the use of common tags across all resources.
- Adds variables for Cognito token validity periods with validation.
- Updates the API Gateway CORS configuration to be more specific.
- Simplifies the data sources in `data.tf`.
- Updates the S3 bucket and Lambda function resources to use the
  common tags.
This commit includes several CSS changes to improve the layout and
prevent unwanted wrapping of elements, especially on smaller screens.

- The main header and user info bar are now set to `flex-direction:
  row` and `flex-wrap: nowrap` to ensure they stay on a single line.
- The header logo size has been increased.
- The header title and subtitle are now set to `white-space: nowrap`
  to prevent them from wrapping.
This commit adds a new test file for the backend API,
`tests/test_app.py`.

The new tests cover the following scenarios:
- Health check endpoint
- Full image processing pipeline
- No text detected
- Retranslation
- Retranslation with language detection
- Exception handling
@ajbarea ajbarea requested a review from Copilot July 11, 2025 20:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates Terraform configuration by bumping core and provider versions, introduces new Cognito token validity settings, and standardizes resource tagging. It also refines the AWS Cognito user pool client configuration and adjusts CORS origins.

  • Bump Terraform required_version and provider versions for AWS, local, and archive.
  • Add Cognito token validity variables with validation and configure aws_cognito_user_pool_client.
  • Consolidate common_tags in a local block and apply across resources; adjust CORS and archive settings.

Reviewed Changes

Copilot reviewed 33 out of 35 changed files in this pull request and generated no comments.

Show a summary per file
File Description
terraform/main.tf Bumped Terraform core and provider version constraints
terraform/variables.tf Added Cognito token validity variables with validation rules
terraform/cognito.tf Enhanced user pool client with token_validity_units and attributes
terraform/locals.tf Defined local.common_tags for consistent tagging
terraform/s3.tf Replaced inline tags with local.common_tags
terraform/frontend.tf Removed duplicate locals, applied local.common_tags
terraform/dynamodb.tf Replaced inline tags with local.common_tags
terraform/api.tf Updated CORS origins to CloudFront domain, applied local.common_tags
terraform/lambda.tf Changed archive to single file, applied local.common_tags
Comments suppressed due to low confidence (7)

terraform/cognito.tf:27

  • [nitpick] Most other resources use tags = local.common_tags for consistent tagging. Consider adding a tags block here to help with resource identification and cost allocation.
resource "aws_cognito_user_pool_client" "client" {

backend/README.md:10

  • The actual script is named setup_cognito.py, not setup-cognito.py. Update the README to reference the correct filename.
   python setup-cognito.py

tests/test_main.py:241

  • The failure test does not verify that the underlying upload function was called. Add mock_upload.assert_called_once_with("file.txt", "bucket", "key") to ensure the error path invokes the storage adapter.
    assert result is False

terraform/lambda.tf:6

  • Using source_file here will archive only that single file, omitting any other files or dependencies in the lambda directory. If your Lambda function has multiple modules or assets, consider reverting to source_dir or explicitly including the entire directory.
  source_file = "../lambda/image_processor.py"

frontend/js/components/UploadQueueComponent.js:307

  • If .querySelector(".image-modal-body") returns null, this will throw an exception. Add a null check before registering the event handler.
    modalBody.addEventListener("wheel", handleWheel);

frontend/js/auth.js:397

  • [nitpick] The removal of the special character requirement weakens password strength. Confirm this change aligns with your security policy or consider reintroducing a stronger validation rule.
    console.log("✅ AuthManager: Password validation passed");

frontend/css/styles.css:147

  • [nitpick] Applying flex-wrap: nowrap; on the body may cause overflow and layout issues on smaller screens. Verify responsive behavior or allow wrapping where appropriate.
  flex-wrap: nowrap;

@ajbarea ajbarea closed this Aug 6, 2025
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.

2 participants