Skip to content

PLT-1445 Service module adoption for AB2D contracts, events and worker services#1663

Merged
gfreeman-navapbc merged 15 commits intomainfrom
jscott/PLT-1445
Feb 17, 2026
Merged

PLT-1445 Service module adoption for AB2D contracts, events and worker services#1663
gfreeman-navapbc merged 15 commits intomainfrom
jscott/PLT-1445

Conversation

@jscott-nava
Copy link
Contributor

@jscott-nava jscott-nava commented Dec 18, 2025

🎫 Ticket

https://jira.cms.gov/browse/PLT-1445

🛠 Changes

This PR contains the changes required to migrate the AB2D contracts, events and worker services onto the CDAP service module.

The following two caveats should be noted:

ℹ️ Context

With the AB2D api service having already been migrated to the CDAP service module, this PR addresses service module adoption for the remaining three AB2D services.

🧪 Validation

Tofu plan output for 20-microservices (AB2D-TEST)
OpenTofu will perform the following actions:

  # module.contracts_service.aws_ecs_service.this will be updated in-place
  # (moved from aws_ecs_service.contracts)
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:service/ab2d-test-microservices/ab2d-test-contracts"
        name                               = "ab2d-test-contracts"
      ~ tags                               = {
          - "service" = "contracts" -> null
        }
      ~ tags_all                           = {
          ~ "service"        = "contracts" -> "microservices"
            # (6 unchanged elements hidden)
        }
      ~ task_definition                    = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-contracts:30" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # module.contracts_service.aws_ecs_task_definition.this must be replaced
  # (moved from aws_ecs_task_definition.contracts)
-/+ resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-contracts:30" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-contracts" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  - essential              = true
                  ~ logConfiguration       = {
                      ~ options   = {
                          ~ awslogs-group         = "/aws/ecs/fargate/ab2d-test/ab2d_contracts" -> "/aws/ecs/fargate/ab2d-test/contracts"
                            # (3 unchanged attributes hidden)
                        }
                        # (1 unchanged attribute hidden)
                    }
                  ~ name                   = "contracts-service-container" -> "contracts"
                  - systemControls         = []
                  - volumesFrom            = []
                    # (6 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ enable_fault_injection   = false -> (known after apply)
      ~ id                       = "ab2d-test-contracts" -> (known after apply)
      ~ revision                 = 30 -> (known after apply)
      - tags                     = {} -> null
        # (10 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.events_service.aws_ecs_service.this will be updated in-place
  # (moved from aws_ecs_service.events)
  ~ resource "aws_ecs_service" "this" {
      ~ force_new_deployment               = true -> false
        id                                 = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:service/ab2d-test-microservices/ab2d-test-events"
        name                               = "ab2d-test-events"
      ~ tags                               = {
          - "service" = "events" -> null
        }
      ~ tags_all                           = {
          ~ "service"        = "events" -> "microservices"
            # (6 unchanged elements hidden)
        }
      ~ task_definition                    = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-events:18" -> (known after apply)
        # (15 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.events_service.aws_ecs_task_definition.this must be replaced
  # (moved from aws_ecs_task_definition.events)
-/+ resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-events:18" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:task-definition/ab2d-test-events" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [
              ~ {
                  - essential              = true
                  ~ logConfiguration       = {
                      ~ options   = {
                          ~ awslogs-group         = "/aws/ecs/fargate/ab2d-test/ab2d_events" -> "/aws/ecs/fargate/ab2d-test/events"
                            # (3 unchanged attributes hidden)
                        }
                        # (1 unchanged attribute hidden)
                    }
                  ~ name                   = "events-service-container" -> "events"
                  - systemControls         = []
                  - volumesFrom            = []
                    # (6 unchanged attributes hidden)
                },
            ] # forces replacement
        )
      ~ enable_fault_injection   = false -> (known after apply)
      ~ id                       = "ab2d-test-events" -> (known after apply)
      ~ revision                 = 18 -> (known after apply)
      - tags                     = {} -> null
        # (10 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

Plan: 2 to add, 2 to change, 2 to destroy.
Tofu plan output for 30-worker (AB2D-TEST)
OpenTofu will perform the following actions:

  # module.service.aws_ecs_service.this will be updated in-place
  # (moved from aws_ecs_service.worker)
  ~ resource "aws_ecs_service" "this" {
        id                                 = "arn:aws:ecs:us-east-1:xxxxxxxxxxxx:service/ab2d-test-worker/ab2d-test-worker"
        name                               = "ab2d-test-worker"
      ~ platform_version                   = "LATEST" -> "1.4.0"
        tags                               = {}
        # (17 unchanged attributes hidden)

      ~ network_configuration {
          ~ subnets          = (sensitive value)
            # (2 unchanged attributes hidden)
        }

        # (2 unchanged blocks hidden)
    }

  # aws_ecs_task_definition.worker has moved to module.service.aws_ecs_task_definition.this
    resource "aws_ecs_task_definition" "this" {
        id                       = "ab2d-test-worker"
        tags                     = {}
        # (15 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

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

@jscott-nava jscott-nava requested a review from a team December 18, 2025 17:46
@jscott-nava jscott-nava marked this pull request as ready for review December 18, 2025 18:52
@jscott-nava jscott-nava requested a review from a team as a code owner December 18, 2025 18:52
@jscott-nava jscott-nava requested a review from gsf December 18, 2025 18:53
bennavapbc
bennavapbc previously approved these changes Dec 31, 2025
Copy link
Collaborator

@bennavapbc bennavapbc left a comment

Choose a reason for hiding this comment

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

Will likely want to merge #1666 first? cc @juliareynolds-nava

@jscott-nava jscott-nava force-pushed the jscott/PLT-1445 branch 2 times, most recently from 42ecd0e to e894326 Compare January 9, 2026 17:45
@jscott-nava
Copy link
Contributor Author

Changes have been made both to this PR and the related CDAP service module PR - see the updated Tofu plans in the description.

@jscott-nava jscott-nava requested review from bennavapbc and gsf January 9, 2026 19:57
@mjburling mjburling changed the title [PLT-1445] Service module adoption for AB2D contracts, events and worker services PLT-1445 Service module adoption for AB2D contracts, events and worker services Jan 12, 2026
@gsf
Copy link
Member

gsf commented Jan 21, 2026

Due to the use of a shared platform module the tags for the services are updated from either contracts or events to microservices. If this is not desired then microservice-specific platform modules could be passed in instead.

Apologies for not catching this earlier, but I'm fairly certain that the ab2d team will want contracts and events to have tags specific to each service. Please do create separate platform instances for each.

@bennavapbc
Copy link
Collaborator

I'm fairly certain that the ab2d team will want contracts and events to have tags specific to each service.

Correct.

@mjburling
Copy link
Member

mjburling commented Jan 21, 2026

Apologies for not catching this earlier, but I'm fairly certain that the ab2d team will want contracts and events to have tags specific to each service.

This probably ought to split 20-microservices into 20-events and 20-contracts. This is a holdover from the legacy microservices module from archived ab2d-ops repository. There's no reason for them to continue to be bundled together.

Please do create separate platform instances for each.

Re-declaring the platform module here won't help matters without modifying CDAP's service module to allow for tag overrides–tagging is controlled by the provider definitions in ../root.tofu.tf included in this root module.

secrets : [
{ name : "AB2D_BFD_KEYSTORE_PASSWORD", valueFrom : local.bfd_keystore_password_arn },
{ name : "AB2D_BFD_KEYSTORE_BASE64", valueFrom : local.bfd_keystore_base64_arn },
{ name : "AB2D_BFD_TRUSTSTORE_CERT", valueFrom : local.bfd_server_public_cert_arn },
Copy link
Contributor

Choose a reason for hiding this comment

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

AB2D is going to need this TRUSTSTORE cert value for the mtls V3 update.

@jscott-nava jscott-nava marked this pull request as draft January 22, 2026 20:01
"Action": [
"chatbot:UpdateSlackChannelConfiguration",
"chatbot:UpdateChimeWebhookConfiguration",
"chatbot:Describe*",
Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably, it was just copied over from the /20-microservices/ directory since I wasn't quite sure which service depended on it

gfreeman-navapbc added a commit that referenced this pull request Feb 5, 2026
## 🎫 Ticket

https://jira.cms.gov/browse/PLT-1569

## 🛠 Changes

Adds a flag that excludes draft PRs from the pull request workflow.

## ℹ️ Context

We don't want to be deploying _every_ change we commit to pull requests
in the repo.

## 🧪 Validation

With this added, the pull request workflow does not run, as seen in this
example: #1663
Comment on lines +196 to +197
cpu = 512
desired_count = 1
Copy link

Choose a reason for hiding this comment

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

is this the same for every environment?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's taken from the old microservices directory that included both of these. So I would assume so.

Comment on lines +134 to +145
cluster_arn = module.cluster.this.arn
cpu = local.ecs_task_def_cpu_worker
desired_count = local.worker_desired_instances
execution_role_arn = data.aws_iam_role.worker.arn
force_new_deployment = anytrue([var.force_worker_deployment, var.worker_service_image_tag != null])
health_check_grace_period_seconds = null
image = local.worker_image_uri
memory = local.ecs_task_def_memory_worker
platform = module.platform
security_groups = [data.aws_security_group.worker.id]
subnets = local.writer_adjacent_subnets
task_role_arn = data.aws_iam_role.worker.arn
Copy link

Choose a reason for hiding this comment

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

I recommend sorting these so settings like cpu, image, memory, healtcheck grace period, are together, IAM roles are together or with other relevant settings, and then very common objects like platform are at the bottom

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I'll capture any of this cleanup work in a separate ticket.

Comment on lines +215 to +218
{
name = "newrelic_logs"
},
{
Copy link

Choose a reason for hiding this comment

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

Still relevant?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm going to group these "relevancy" comments together, but this is a month old PR that has surely seen things come and go as it has been open. If this is no longer relevant I would suggest we take it out in a different ticket and get this work over the line.

@mianava mianava self-requested a review February 12, 2026 19:06
Copy link

@mianava mianava left a comment

Choose a reason for hiding this comment

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

Noting this is a lift and set of existing resources and there might be future work around terraform style.

@gfreeman-navapbc gfreeman-navapbc marked this pull request as ready for review February 17, 2026 18:49
@gfreeman-navapbc gfreeman-navapbc merged commit ae91735 into main Feb 17, 2026
21 of 23 checks passed
@gfreeman-navapbc gfreeman-navapbc deleted the jscott/PLT-1445 branch February 17, 2026 19:20
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.

8 participants