Skip to content

refactor!(forge): create submodule for github features#180

Merged
edersonbrilhante merged 4 commits intomainfrom
refactor-github-feat
Oct 27, 2025
Merged

refactor!(forge): create submodule for github features#180
edersonbrilhante merged 4 commits intomainfrom
refactor-github-feat

Conversation

@edersonbrilhante
Copy link
Member

@edersonbrilhante edersonbrilhante commented Oct 24, 2025

Description

This PR refactors the Terraform codebase by creating dedicated submodules for key components, improving code organization, readability, and maintainability.

Submodules created:

  • github_global_lock
  • github_webhook_relay
  • github_app_runner_group

All existing resources have been moved into these submodules.

State Migration

Since resources were moved into modules, the Terraform state has been updated using terragrunt state mv. A migration script has been prepared for safely moving all existing resources into their respective module addresses.

# github_app_runner_group
terragrunt state mv 'aws_cloudwatch_event_rule.register_github_app_runner_group_lambda' 'module.github_app_runner_group.aws_cloudwatch_event_rule.register_github_app_runner_group_lambda'
terragrunt state mv 'aws_cloudwatch_event_target.register_github_app_runner_group_lambda' 'module.github_app_runner_group.aws_cloudwatch_event_target.register_github_app_runner_group_lambda'
terragrunt state mv 'aws_cloudwatch_log_group.register_github_app_runner_group_lambda' 'module.github_app_runner_group.aws_cloudwatch_log_group.register_github_app_runner_group_lambda'
terragrunt state mv 'aws_lambda_permission.register_github_app_runner_group_lambda' 'module.github_app_runner_group.aws_lambda_permission.register_github_app_runner_group_lambda'
terragrunt state mv 'module.register_github_app_runner_group_lambda.aws_iam_role.lambda[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.aws_iam_role.lambda[0]'
terragrunt state mv 'module.register_github_app_runner_group_lambda.aws_iam_role_policy.additional_json[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.aws_iam_role_policy.additional_json[0]'
terragrunt state mv 'module.register_github_app_runner_group_lambda.aws_iam_role_policy.logs[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.aws_iam_role_policy.logs[0]'
terragrunt state mv 'module.register_github_app_runner_group_lambda.aws_lambda_function.this[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.aws_lambda_function.this[0]'
terragrunt state mv 'module.register_github_app_runner_group_lambda.null_resource.archive[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.null_resource.archive[0]'
terragrunt state mv 'module.register_github_app_runner_group_lambda.local_file.archive_plan[0]' 'module.github_app_runner_group.module.register_github_app_runner_group_lambda.local_file.archive_plan[0]'

# github_global_lock
terragrunt state mv 'aws_cloudwatch_event_rule.clean_global_lock_lambda' 'module.github_global_lock.aws_cloudwatch_event_rule.clean_global_lock_lambda'
terragrunt state mv 'aws_cloudwatch_event_target.clean_global_lock_lambda' 'module.github_global_lock.aws_cloudwatch_event_target.clean_global_lock_lambda'
terragrunt state mv 'aws_cloudwatch_log_group.clean_global_lock_lambda' 'module.github_global_lock.aws_cloudwatch_log_group.clean_global_lock_lambda'
terragrunt state mv 'aws_dynamodb_table.lock_table' 'module.github_global_lock.aws_dynamodb_table.lock_table'
terragrunt state mv 'aws_iam_policy.dynamodb_policy' 'module.github_global_lock.aws_iam_policy.dynamodb_policy'
terragrunt state mv 'aws_lambda_permission.clean_global_lock_lambda' 'module.github_global_lock.aws_lambda_permission.clean_global_lock_lambda'
terragrunt state mv 'module.clean_global_lock_lambda.aws_iam_role.lambda[0]' 'module.github_global_lock.module.clean_global_lock_lambda.aws_iam_role.lambda[0]'
terragrunt state mv 'module.clean_global_lock_lambda.aws_iam_role_policy.additional_json[0]' 'module.github_global_lock.module.clean_global_lock_lambda.aws_iam_role_policy.additional_json[0]'
terragrunt state mv 'module.clean_global_lock_lambda.aws_iam_role_policy.logs[0]' 'module.github_global_lock.module.clean_global_lock_lambda.aws_iam_role_policy.logs[0]'
terragrunt state mv 'module.clean_global_lock_lambda.aws_lambda_function.this[0]' 'module.github_global_lock.module.clean_global_lock_lambda.aws_lambda_function.this[0]'
terragrunt state mv 'module.clean_global_lock_lambda.null_resource.archive[0]' 'module.github_global_lock.module.clean_global_lock_lambda.null_resource.archive[0]'
terragrunt state mv 'module.clean_global_lock_lambda.local_file.archive_plan[0]' 'module.github_global_lock.module.clean_global_lock_lambda.local_file.archive_plan[0]'

# # github_webhook_relay
terragrunt state mv 'aws_iam_role.secret_reader[0]' 'module.github_webhook_relay[0].aws_iam_role.secret_reader'
terragrunt state mv 'aws_iam_role_policy.secret_reader_inline[0]' 'module.github_webhook_relay[0].aws_iam_role_policy.secret_reader_inline'
terragrunt state mv 'aws_kms_alias.github_webhook_relay[0]' 'module.github_webhook_relay[0].aws_kms_alias.github_webhook_relay'
terragrunt state mv 'aws_kms_key.github_webhook_relay[0]' 'module.github_webhook_relay[0].aws_kms_key.github_webhook_relay'
terragrunt state mv 'aws_secretsmanager_secret.github_webhook_relay[0]' 'module.github_webhook_relay[0].aws_secretsmanager_secret.github_webhook_relay'
terragrunt state mv 'aws_secretsmanager_secret_version.github_webhook_relay[0]' 'module.github_webhook_relay[0].aws_secretsmanager_secret_version.github_webhook_relay'
terragrunt state mv 'random_id.github_webhook_relay_source_secret[0]' 'module.github_webhook_relay[0].random_id.github_webhook_relay_source_secret'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_apigatewayv2_api.webhook' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_apigatewayv2_api.webhook'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_apigatewayv2_integration.lambda' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_apigatewayv2_integration.lambda'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_apigatewayv2_route.post_hook' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_apigatewayv2_route.post_hook'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_apigatewayv2_stage.default' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_apigatewayv2_stage.default'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_event_bus.source' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_event_bus.source'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_event_rule.forward' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_event_rule.forward'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_event_target.dest' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_event_target.dest'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_delivery.cwlogs_error_logs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_delivery.cwlogs_error_logs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_delivery.cwlogs_info_logs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_delivery.cwlogs_info_logs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_delivery_destination.cwlogs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_delivery_destination.cwlogs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_delivery_source.error_logs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_delivery_source.error_logs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_delivery_source.info_logs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_delivery_source.info_logs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_group.event_bus_logs' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_group.event_bus_logs'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_group.validate_signature_lambda' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_group.validate_signature_lambda'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_cloudwatch_log_resource_policy.source' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_cloudwatch_log_resource_policy.source'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_iam_role.events_forward' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_iam_role.events_forward'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_iam_role_policy.events_forward_put' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_iam_role_policy.events_forward_put'
terragrunt state mv 'module.github_webhook_relay_source[0].aws_lambda_permission.apigw_invoke' 'module.github_webhook_relay[0].module.github_webhook_relay_source.aws_lambda_permission.apigw_invoke'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.aws_iam_role.lambda[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.aws_iam_role.lambda[0]'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.aws_iam_role_policy.additional_json[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.aws_iam_role_policy.additional_json[0]'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.aws_iam_role_policy.logs[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.aws_iam_role_policy.logs[0]'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.aws_lambda_function.this[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.aws_lambda_function.this[0]'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.null_resource.archive[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.null_resource.archive[0]'
terragrunt state mv 'module.github_webhook_relay_source[0].module.validate_signature_lambda.local_file.archive_plan[0]' 'module.github_webhook_relay[0].module.github_webhook_relay_source.module.validate_signature_lambda.local_file.archive_plan[0]'

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@edersonbrilhante edersonbrilhante changed the title refactor(forge): create submodule for github features refactor!(forge): create submodule for github features Oct 24, 2025
@edersonbrilhante edersonbrilhante enabled auto-merge (squash) October 24, 2025 22:57
Copy link
Contributor

@Rostislavz Rostislavz left a comment

Choose a reason for hiding this comment

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

LGTM

@edersonbrilhante edersonbrilhante merged commit 9b790bd into main Oct 27, 2025
4 checks passed
@edersonbrilhante edersonbrilhante deleted the refactor-github-feat branch October 27, 2025 11:22
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