Skip to content

fix: Move database configuration to its own module. #7

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

Merged
merged 3 commits into from
Jun 16, 2025
Merged

Conversation

jamesiarmes
Copy link
Member

No description provided.

Copy link

github-actions bot commented Jun 16, 2025

Plan output

module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.data.aws_iam_policy_document.enhanced_monitoring: Reading...
module.app["dc-sebt-portal"].module.database.data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_region.current: Reading...
module.logging.data.aws_region.current: Reading...
module.logging.module.s3.data.aws_partition.current: Reading...
module.logging.module.s3.data.aws_region.current: Reading...
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_caller_identity.current: Reading...
module.vpc.data.aws_availability_zones.available: Reading...
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.ecs_insights: Reading...
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.rds: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_region.current: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.database.data.aws_partition.current: Read complete after 0s [id=aws]
module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.data.aws_iam_policy_document.enhanced_monitoring: Read complete after 0s [id=76086537]
module.logging.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.logging.module.s3.data.aws_partition.current: Read complete after 0s [id=aws]
module.logging.module.s3.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.service["web"].data.aws_caller_identity.identity: Reading...
module.logging.module.s3.data.aws_caller_identity.current: Reading...
module.app["dc-sebt-portal"].data.aws_lambda_functions.all: Reading...
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_caller_identity.current: Read complete after 0s [id=816069131564]
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_partition.current: Read complete after 0s [id=aws]
module.logging.data.aws_lambda_functions.all: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_caller_identity.identity: Read complete after 0s [id=816069131564]
module.logging.module.s3.data.aws_caller_identity.current: Read complete after 0s [id=816069131564]
module.logging.data.aws_caller_identity.identity: Reading...
module.logging.data.aws_caller_identity.identity: Read complete after 0s [id=816069131564]
module.logging.data.aws_lambda_functions.all: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.ecs_insights: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.database.data.aws_caller_identity.identity: Reading...
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.rds: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.data.aws_partition.current: Read complete after 0s [id=aws]
module.vpc.module.vpc.data.aws_partition.current[0]: Reading...
module.vpc.module.vpc.data.aws_partition.current[0]: Read complete after 0s [id=aws]
module.logging.module.s3.data.aws_organizations_organization.current: Reading...
module.app["dc-sebt-portal"].data.aws_lambda_functions.all: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_availability_zones.available: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.database.data.aws_caller_identity.identity: Read complete after 0s [id=816069131564]
module.vpc.data.aws_vpc_endpoint_service.services["ssm-contacts"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ssm-contacts"]: Read complete after 1s [id=3701104373]
module.app["dc-sebt-portal"].module.service["web"].data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_partition.current: Read complete after 0s [id=aws]
module.vpc.data.aws_vpc_endpoint_service.services["ssm-incidents"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ecr.dkr"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ssm"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ssm-incidents"]: Read complete after 0s [id=3798321550]
module.vpc.data.aws_vpc_endpoint_service.services["ssmmessages"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["guardduty-data"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ec2"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ecr.dkr"]: Read complete after 0s [id=1314884315]
module.vpc.data.aws_vpc_endpoint_service.services["ecr.api"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ec2messages"]: Reading...
module.vpc.module.vpc.data.aws_region.current[0]: Reading...
module.vpc.module.vpc.data.aws_region.current[0]: Read complete after 0s [id=us-east-1]
module.vpc.module.vpc.data.aws_caller_identity.current[0]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ssm"]: Read complete after 0s [id=874300523]
module.app["dc-sebt-portal"].module.secrets.data.aws_region.current: Reading...
module.app["dc-sebt-portal"].module.secrets.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.vpc.module.vpc.data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0]: Reading...
module.vpc.module.vpc.data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0]: Read complete after 0s [id=1021377347]
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.ecs: Reading...
module.vpc.module.vpc.data.aws_caller_identity.current[0]: Read complete after 0s [id=816069131564]
module.vpc.data.aws_vpc_endpoint_service.services["ssmmessages"]: Read complete after 0s [id=1315226949]
module.app["dc-sebt-portal"].module.database.data.aws_region.current: Reading...
module.app["dc-sebt-portal"].module.database.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.secrets.data.aws_caller_identity.identity: Reading...
module.logging.module.s3.data.aws_organizations_organization.current: Read complete after 1s [id=o-f5mr0gq6lc]
module.app["dc-sebt-portal"].module.service["web"].module.alb["this"].data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.service["web"].module.alb["this"].data.aws_partition.current: Read complete after 0s [id=aws]
module.app["dc-sebt-portal"].module.database.data.aws_rds_engine_version.this: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["guardduty-data"]: Read complete after 0s [id=3795168285]
module.logging.data.aws_elb_service_account.current: Reading...
module.logging.data.aws_elb_service_account.current: Read complete after 0s [id=127311923021]
module.logging.data.aws_partition.current: Reading...
module.logging.data.aws_partition.current: Read complete after 0s [id=aws]
module.app["dc-sebt-portal"].module.secrets.data.aws_partition.current: Reading...
module.app["dc-sebt-portal"].module.secrets.data.aws_partition.current: Read complete after 0s [id=aws]
module.app["dc-sebt-portal"].data.aws_cloudwatch_log_groups.ecs: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_iam_policy_document.repository[0]: Reading...
module.app["dc-sebt-portal"].module.service["web"].module.ecr["this"].data.aws_iam_policy_document.repository[0]: Read complete after 0s [id=77330188]
module.app["dc-sebt-portal"].module.secrets.data.aws_caller_identity.identity: Read complete after 0s [id=816069131564]
module.vpc.data.aws_vpc_endpoint_service.services["ec2"]: Read complete after 0s [id=2644592029]
module.vpc.data.aws_vpc_endpoint_service.services["ec2messages"]: Read complete after 0s [id=2187510914]
module.logging.data.aws_lambda_function.datadog["this"]: Reading...
module.vpc.data.aws_vpc_endpoint_service.services["ecr.api"]: Read complete after 0s [id=1808222790]
module.app["dc-sebt-portal"].data.aws_lambda_function.datadog["this"]: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_ssm_parameter.version["/sebt-portal/development/web/version"]: Reading...
module.app["dc-sebt-portal"].module.service["web"].data.aws_ssm_parameter.version["/sebt-portal/development/web/version"]: Read complete after 0s [id=/sebt-portal/development/web/version]
module.app["dc-sebt-portal"].module.service["web"].data.aws_route53_zone.domain["this"]: Reading...
module.logging.data.aws_lambda_function.datadog["this"]: Read complete after 0s [id=DatadogIntegration-ForwarderStack-W7KLT9-Forwarder-VufEAiofNX9f]
module.app["dc-sebt-portal"].data.aws_lambda_function.datadog["this"]: Read complete after 0s [id=DatadogIntegration-ForwarderStack-W7KLT9-Forwarder-VufEAiofNX9f]
module.app["dc-sebt-portal"].module.service["web"].data.aws_route53_zone.domain["this"]: Read complete after 1s [id=Z0097236342AE196VY5TV]
module.logging.module.s3.data.aws_iam_policy_document.default: Reading...
module.logging.module.s3.data.aws_iam_policy_document.default: Read complete after 0s [id=3580588753]
module.vpc.data.aws_subnets.endpoints["ecr.dkr"]: Reading...
module.vpc.data.aws_subnets.endpoints["ssm-contacts"]: Reading...
module.vpc.data.aws_subnets.endpoints["ec2messages"]: Reading...
module.vpc.data.aws_subnets.endpoints["guardduty-data"]: Reading...
module.vpc.data.aws_subnets.endpoints["ec2"]: Reading...
module.vpc.data.aws_subnets.endpoints["ssm"]: Reading...
module.vpc.data.aws_subnets.endpoints["ssmmessages"]: Reading...
module.vpc.data.aws_subnets.endpoints["ecr.dkr"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["ssm-contacts"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["ssm-incidents"]: Reading...
module.vpc.data.aws_subnets.endpoints["ec2"]: Read complete after 0s [id=us-east-1]
module.logging.module.s3.data.aws_iam_policy_document.combined: Reading...
module.vpc.data.aws_subnets.endpoints["ecr.api"]: Reading...
module.logging.module.s3.data.aws_iam_policy_document.combined: Read complete after 0s [id=199516603]
module.app["dc-sebt-portal"].module.service["web"].data.aws_vpc.current: Reading...
module.vpc.data.aws_subnets.endpoints["ec2messages"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["guardduty-data"]: Read complete after 0s [id=us-east-1]
module.app["dc-sebt-portal"].module.database.data.aws_rds_engine_version.this: Read complete after 1s [id=16.00.4185.3.v1]
module.vpc.data.aws_subnets.endpoints["ssm"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["ssmmessages"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["ssm-incidents"]: Read complete after 0s [id=us-east-1]
module.vpc.data.aws_subnets.endpoints["ecr.api"]: Read complete after 0s [id=us-east-1]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ecr.dkr"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ec2messages"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm-contacts"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ec2"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm-incidents"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ecr.dkr"]: Read complete after 0s [id=1314884315]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ec2messages"]: Read complete after 0s [id=2187510914]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ecr.api"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["s3"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm"]: Read complete after 0s [id=874300523]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["guardduty-data"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssmmessages"]: Reading...
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm-contacts"]: Read complete after 0s [id=3701104373]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ec2"]: Read complete after 0s [id=2644592029]
module.app["dc-sebt-portal"].module.service["web"].data.aws_vpc.current: Read complete after 1s [id=vpc-024d66fcc4f521d0a]
module.vpc.module.vpc.data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0]: Reading...
module.vpc.module.vpc.data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0]: Read complete after 0s [id=2856726747]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssm-incidents"]: Read complete after 0s [id=3798321550]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ecr.api"]: Read complete after 0s [id=1808222790]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["s3"]: Read complete after 0s [id=195798706]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["guardduty-data"]: Read complete after 0s [id=3795168285]
module.vpc.module.endpoints.data.aws_vpc_endpoint_service.this["ssmmessages"]: Read complete after 0s [id=1315226949]

OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
+/- create replacement and then destroy

OpenTofu will perform the following actions:

  # module.app["dc-sebt-portal"].aws_kms_alias.database has moved to module.app["dc-sebt-portal"].module.database.aws_kms_alias.database
    resource "aws_kms_alias" "database" {
        id             = "alias/sebt-portal/development/database"
        name           = "alias/sebt-portal/development/database"
        # (3 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].aws_kms_key.database has moved to module.app["dc-sebt-portal"].module.database.aws_kms_key.database
    resource "aws_kms_key" "database" {
        id                                 = "685dec83-ce64-422e-b69e-1ebddb298a4d"
        tags                               = {
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (13 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.database_security_group.aws_security_group.this_name_prefix[0] has moved to module.app["dc-sebt-portal"].module.database.module.database_security_group.aws_security_group.this_name_prefix[0]
    resource "aws_security_group" "this_name_prefix" {
        id                     = "sg-052c720f2d7d35631"
        name                   = "sebt-portal-development-database-20250613191726526800000001"
        tags                   = {
            "Name"        = "sebt-portal-development-database"
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (9 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_instance.aws_db_instance.this[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.aws_db_instance.this[0]
    resource "aws_db_instance" "this" {
        id                                    = "db-AQO5FR4MFE4QXEK44UMOZ5DUYE"
        tags                                  = {
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (59 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_instance.aws_iam_role.enhanced_monitoring[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.aws_iam_role.enhanced_monitoring[0]
    resource "aws_iam_role" "enhanced_monitoring" {
        id                    = "rds-monitoring-role"
        name                  = "rds-monitoring-role"
        tags                  = {
            "Name"        = "rds-monitoring-role"
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (9 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_instance.aws_iam_role_policy_attachment.enhanced_monitoring[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.aws_iam_role_policy_attachment.enhanced_monitoring[0]
    resource "aws_iam_role_policy_attachment" "enhanced_monitoring" {
        id         = "rds-monitoring-role-20250613184932227900000001"
        # (2 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_instance.random_id.snapshot_identifier[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_instance.random_id.snapshot_identifier[0]
    resource "random_id" "snapshot_identifier" {
        id          = "_4MFgg"
        # (6 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_parameter_group.aws_db_parameter_group.this[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_parameter_group.aws_db_parameter_group.this[0]
    resource "aws_db_parameter_group" "this" {
        id           = "sebt-portal-development-20250613181046817500000001"
        name         = "sebt-portal-development-20250613181046817500000001"
        tags         = {
            "Name"        = "sebt-portal-development"
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (6 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.mssql.module.db_subnet_group.aws_db_subnet_group.this[0] has moved to module.app["dc-sebt-portal"].module.database.module.mssql["this"].module.db_subnet_group.aws_db_subnet_group.this[0]
    resource "aws_db_subnet_group" "this" {
        id                      = "sebt-portal-development-20250613164153054600000001"
        name                    = "sebt-portal-development-20250613164153054600000001"
        tags                    = {
            "Name"        = "sebt-portal-development"
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (7 unchanged attributes hidden)
    }

  # module.app["dc-sebt-portal"].module.service["web"].module.ecs_service.module.fargate.aws_ecs_service.main[0] will be updated in-place
  ~ resource "aws_ecs_service" "main" {
      ~ desired_count                      = 0 -> 1
        id                                 = "arn:aws:ecs:us-east-1:816069131564:service/sebt-portal-development-web/sebt-portal-development-web"
        name                               = "sebt-portal-development-web"
        tags                               = {
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
      ~ task_definition                    = "arn:aws:ecs:us-east-1:816069131564:task-definition/sebt-portal-development-web:11" -> (known after apply)
        # (15 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # module.app["dc-sebt-portal"].module.service["web"].module.ecs_service.module.fargate.module.task.aws_ecs_task_definition.main[0] must be replaced
+/- resource "aws_ecs_task_definition" "main" {
      ~ arn                      = "arn:aws:ecs:us-east-1:816069131564:task-definition/sebt-portal-development-web:11" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:us-east-1:816069131564:task-definition/sebt-portal-development-web" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  - mountPoints      = []
                    name             = "otel-collector"
                  - portMappings     = []
                  - systemControls   = []
                  - volumesFrom      = []
                    # (8 unchanged attributes hidden)
                },
              ~ {
                  ~ environment       = [
                      ~ {
                            name  = "DATABASE_HOST"
                          ~ value = "sebt-portal-development-20250613171717133500000001.cxcgye2iuxai.us-east-1.rds.amazonaws.com:1433" -> "sebt-portal-development-20250613171717133500000001.cxcgye2iuxai.us-east-1.rds.amazonaws.com"
                        },
                      + {
                          + name  = "DATABASE_PORT"
                          + value = "1433"
                        },
                    ]
                  - mountPoints       = []
                    name              = "sebt-portal-development-web"
                  ~ portMappings      = [
                      ~ {
                          - hostPort      = 8080
                          - protocol      = "tcp"
                            # (1 unchanged attribute hidden)
                        },
                    ]
                  - systemControls    = []
                  - volumesFrom       = []
                    # (8 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ enable_fault_injection   = false -> (known after apply)
      ~ id                       = "sebt-portal-development-web" -> (known after apply)
      ~ revision                 = 11 -> (known after apply)
        tags                     = {
            "application" = "sebt-portal-development"
            "environment" = "development"
            "program"     = "safety-net"
            "project"     = "sebt-portal"
        }
        # (10 unchanged attributes hidden)
    }

Plan: 1 to add, 1 to change, 1 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so OpenTofu can't
guarantee to take exactly these actions if you run "tofu apply" now.

@jamesiarmes jamesiarmes merged commit 9b17644 into main Jun 16, 2025
8 checks passed
@jamesiarmes jamesiarmes deleted the db-module branch June 16, 2025 20:02
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.

1 participant