Commit Graph
66 Commits
Author SHA1 Message Date
Robert Fairburn ba70e93f65 Add alerting thresholds to monitoring. (#254) 2026-06-19 12:17:55 -05:00
Robert Fairburn 70e1e1b800 Examples db fix (#241) 2026-05-26 14:56:16 -05:00
Robert Fairburn b4f2ffbf98 Support custom database user and database names properly (#240) 2026-05-26 14:23:56 -05:00
Robert Fairburn 1bfc9a14be update tagged module versions to latest (#239) 2026-05-26 10:35:09 -05:00
Robert Fairburn 95ead0f16d Govcloud partition refactor (#235) 2026-05-26 05:18:51 -05:00
Robert Fairburn 2924052a86 Fix typos in monitoring module (#227) 2026-04-29 08:20:24 -05:00
Robert Fairburn ed71e24bbe documentation updates for latest tf modules (#206) 2026-04-07 17:33:30 -05:00
Robert Fairburn 0cfebf7dc9 Add an extra sanity check to migrations (#207) 2026-04-07 17:33:11 -05:00
Robert Fairburn e2681aea79 Add configurable Fleet private key delivery, optional command override, and caller-managed private key secret ARN support (#205)
## Summary

  This PR extends the Fleet ECS modules to support:

  - configurable Fleet server private key delivery via ecs or iam
  - optional fleet_config.command overrides for Fleet task definitions
- caller-managed Fleet server private key secrets via
fleet_config.private_key_secret_arn

It also updates the external vuln scans addon to follow the same
private-key delivery and command behavior, and refreshes the generated
module documentation.

  ## What changed

- Added fleet_config.private_key_delivery_method with supported values:
- ecs (default): inject the private key as FLEET_SERVER_PRIVATE_KEY
      - iam: inject the secret ARN as FLEET_SERVER_PRIVATE_KEY_ARN
  - Added validation so only ecs or iam are accepted
- Added fleet_config.command support so callers can override the Fleet
container command when needed
- Added fleet_config.private_key_secret_arn support so callers can
supply an existing Secrets Manager secret instead of having this module
create and populate one
- Updated IAM policy wiring so private-key secret access and private-key
KMS decrypt permissions are granted to the correct role based on the
selected delivery method
- Updated module outputs so fleet_server_private_key_secret_arn returns
the effective ARN whether the secret is module-managed or caller-managed
- Updated addons/external-vuln-scans to consume the same private-key
delivery mode and optional command behavior from the passed fleet_config
  - Updated byo-ecs documentation and regenerated README files

  ## Behavior

  ### Private key delivery

- ecs mode injects the secret value into the container and uses the ECS
execution role for private-key secret access
- iam mode injects the secret ARN into the container environment and
uses the Fleet task role for private-key secret access

  ### Command override

- When fleet_config.command is unset, the task definition omits command
- When fleet_config.command is set, the provided command is passed
through to the Fleet container
- This behavior now applies consistently to both the main ECS service
and external vuln scans

  ### Caller-managed private key secret

- When fleet_config.private_key_secret_arn is unset, the module creates
and populates the Fleet private key secret
- When fleet_config.private_key_secret_arn is set, the module uses the
provided secret ARN and does not create the secret, secret version, or
generated random value

  ## KMS note for external secrets

If a caller-managed private-key secret uses a CMK, the caller must also
provide the existing private-key KMS ARN input so the correct role
receives decrypt permissions for the selected delivery mode.

  ## Validation

  Validated successfully with:

  - terraform validate -no-color at repo root
  - terraform validate -no-color in byo-vpc
  - terraform validate -no-color in byo-vpc/byo-db
  - terraform validate -no-color in byo-vpc/byo-db/byo-ecs

Also verified that existing module-managed private-key resources plan as
non-destructive state-address moves when transitioning to the new
counted resources:

  - 0 to add
  - 0 to change
  - 0 to destroy
2026-04-06 19:25:17 -05:00
Robert Fairburn a30a204b44 Update required versions for cloud resources (#204) 2026-04-06 02:11:19 -05:00
Robert Fairburn bde5e8a341 KMS-CMK for some lambdas and the mdm secret (#200) 2026-03-26 09:35:12 -05:00
Robert Fairburn 5427830fea Add KMS CMK for carves (#198) 2026-03-24 06:44:00 -05:00
Robert Fairburn e7faee93de Kms cmk root to byo db (#193)
## Highlights

- Upgrades Aurora from `terraform-aws-modules/rds-aurora/aws` `7.6.0` to
`9.16.1`
- Bumps the Terraform minimum version from `>= 1.3.8` to `>= 1.5.0`
- Adds CMK support across newly exposed RDS, Redis, VPC, ECS, and Fleet
surfaces
- Adds additive per-key `extra_kms_policies` support across the root ->
`byo-vpc` -> `byo-db` -> `byo-ecs` path
- Moves software-installers KMS policy ownership out of
`addons/cloudfront-software-installers` and back into `byo-ecs`
- Extends monitoring and ECS integration to work with CMK-encrypted DB
password secrets
- Adds migration tooling and docs for Aurora storage KMS replacement and
CloudWatch Logs KMS cutovers

## Aurora module upgrade: `7.6.0` -> `9.16.1`

This PR keeps a single Aurora module path on upstream `9.16.1` and
updates the Fleet wrapper modules to preserve compatibility where
possible while exposing the new KMS and observability capabilities.

Notable changes handled in the wrapper:

- `security_group_rules`
- upstream moved from older SG rule addressing to the newer
`security_group_rules` model
- added `moved` handling for the confirmed SG rule address rename to
avoid unnecessary destroy/create churn

- `manage_master_user_password`
  - the wrapper continues to own the DB password flow
  - Aurora is kept on `manage_master_user_password = false`
- Secrets Manager integration remains wrapper-managed rather than
switching to upstream-managed password behavior

- `final_snapshot_identifier`
  - wrapper support was added so old behavior is preserved
  - if unset, the legacy generated naming pattern is still used
  - callers can now override it explicitly

- Observability / Database Insights wiring
- cluster-level Performance Insights / Database Insights configuration
was added to match Aurora's current control surface
- monitoring behavior was aligned to cluster-level management for
consistency with the Aurora module and Database Insights requirements

- `backtrack_window`
  - added optional pass-through support for Aurora MySQL backtracking
  - validated as `null` or `0..259200`

## Terraform version bump

This PR raises the Terraform minimum version from `>= 1.3.8` to `>=
1.5.0`.

Reason:
- deprecation warnings for legacy KMS `enabled` flags now use Terraform
`check` blocks
- `check` blocks require Terraform `1.5+`

This was done so published interfaces can remain backward-compatible for
existing `enabled` users while still warning during plan/apply and
preferring `cmk_enabled`.

## KMS surface expansion and pass-through

This PR adds or expands CMK support for:

- Aurora storage
- Aurora password secret
- Aurora observability / Performance Insights
- Aurora exported log groups
- Redis at-rest encryption
- Redis log groups
- VPC flow log CloudWatch log groups
- ECS cluster log groups
- Fleet private-key secret
- Fleet Fargate ephemeral storage
- Fleet application logs
- Fleet software installers

It also adds additive `extra_kms_policies` support across those
module-owned CMK surfaces so callers can append narrowly scoped
statements without replacing the inherited base policy.

During validation of the cron-monitoring integration, I found that the
root module schema was still dropping some nested KMS attributes before
they reached `byo-vpc`. This PR now carries those fields all the way
through to their final destinations, including:

- `rds_config.*.extra_kms_policies`
- `redis_config.*.extra_kms_policies`
- `ecs_cluster.cloudwatch_log_group.kms.extra_kms_policies`
- `fleet_config.private_key_secret_kms.extra_kms_policies`
- `fleet_config.fargate_ephemeral_storage_kms.extra_kms_policies`
- `fleet_config.awslogs.kms.extra_kms_policies`
- `fleet_config.software_installers.extra_kms_policies`
- `fleet_config.software_installers.cloudfront_distribution_arn`
- `vpc.flow_log_cloudwatch_log_group_kms.extra_kms_policies`

## DB password secret KMS handoff to monitoring

`byo-vpc` now exposes:

- `rds_password_secret_kms_key_arn`

The monitoring addon now accepts:

- `cron_monitoring.mysql_password_secret_kms_key_arn`

The monitoring addon also now exposes:

- `cron_monitoring_lambda_arn`
- `cron_monitoring_lambda_role_arn`

This is needed so the cron-monitoring Lambda can decrypt the Fleet DB
password secret when that secret is encrypted with a customer-managed
KMS key.

Expected wiring:

```hcl
module "monitoring" {
  # ...
  cron_monitoring = {
    # ...
    mysql_password_secret_name        = "${local.customer}-database-password"
    mysql_password_secret_kms_key_arn = module.main.byo-vpc.rds_password_secret_kms_key_arn
  }
}
```

## Software installers KMS ownership change

This PR changes the software-installers KMS contract:

- `addons/cloudfront-software-installers` no longer manages the
software-installers KMS key policy
- `byo-ecs` now owns the software-installers CMK policy, including
required service / principal statements
- `fleet_config.software_installers.cloudfront_distribution_arn` is the
static input used to add the CloudFront KMS statement without
introducing a module cycle
- `byo-ecs` also adds the explicit Fleet task-role KMS statement
required under the narrower external key-policy model
- the CloudFront addon exposes `cloudfront_distribution_arn` for
visibility, but that output should not be fed back into `byo-ecs`
because that would create a dependency cycle

Important compatibility note:

- if software installers uses KMS at all, it must use a customer-managed
key
- CloudFront requires a key-policy statement on that key
- the AWS-managed default key cannot be modified to attach that policy

## Other notable items

- Added and expanded migration docs for RDS and Redis KMS adoption
- Added `byo-vpc/scripts/rds_storage_kms_migration.sh` to automate
Aurora storage-KMS migration workflows
- Added `scripts/cloudwatch_logs_kms_migration.sh` to help identify and
optionally remove pre-cutover log streams after associating a new KMS
key with a CloudWatch Logs group
- Normalized `cmk_enabled` usage while preserving deprecated `enabled`
compatibility only for previously published interfaces
- Refactored `addons/logging-alb` KMS policy handling to support
`kms_base_policy` and align it with the structured KMS statement model
used elsewhere
- Reduced repeated KMS policy boilerplate within modules where it was
materially duplicated

## Compatibility notes

- Existing published KMS interfaces that previously used `enabled` still
accept it, but now warn and prefer `cmk_enabled`
- New KMS surfaces are `cmk_enabled`-only
- Software-installers KMS policy ownership moved from
`addons/cloudfront-software-installers` to `byo-ecs`

## Validation

Validated module stacks after the refactors:

- `root`
- `byo-vpc`
- `byo-db`
- `byo-ecs`
- `addons/monitoring`
- `addons/cloudfront-software-installers`
- `addons/logging-alb`
2026-03-20 12:07:38 -05:00
Robert Fairburn b0f06cdbb8 Update codeowneres (#197) 2026-03-19 18:01:00 -05:00
Robert Fairburn 026c23185c Ephemeral storage support plus var defaults consistency (#192)
Added nullable fleet_config.ephemeral_storage support through the root,
byo-vpc, byo-db, and byo-ecs module chain. The ECS task definition now
only sets ephemeral_storage when configured, and the new input is
documented across the affected module READMEs regenerated with
terraform-docs.

Also normalized Redis defaults in the root and byo-vpc modules so
partial redis_config input consistently resolves to Redis 7.1 / redis7,
matching the schema defaults and avoiding accidental version drift for
existing users.
2026-03-11 08:14:22 -05:00
Robert Fairburn 7ca524b96d Update module version in doc for byo-ecs (#191) 2026-03-10 10:47:39 -05:00
Robert Fairburn 8b8e283d91 Additional KMS CMK for ecs and byo-ecs scoped object. (#187) 2026-03-10 10:36:26 -05:00
Robert Fairburn d5da95f5a9 Improvements to KMS encryption stance on ALB logs (#185) 2026-03-06 08:14:15 -06:00
Robert Fairburn a62e432d2f Allow Fleet ECS target-group protocol to be configured for https support (#184) 2026-03-02 11:51:59 -06:00
Robert Fairburn 0512d6da11 Initial cross-account log sharing module (#176) 2026-02-18 07:30:11 -06:00
Robert Fairburn 2c4933346d Bump docker provider for geolite2 (#178) 2026-02-12 14:49:41 -06:00
Robert Fairburn 4e6b55b731 Update documentation and examples for latest (#165) 2026-01-16 13:53:05 -06:00
Robert Fairburn 8c61c6fa6e Okta condiitonal access subdomain (#154) 2026-01-12 09:50:33 -06:00
Robert Fairburn 56f96d216f Update examples for new tags (#152) 2025-12-11 09:05:32 -06:00
Robert Fairburn 5f47abbe01 support point-in-time recovery on RDS (#151) 2025-12-10 04:59:27 -06:00
Robert Fairburn ca8373b5f9 Initial firehost-splunk module (#150) 2025-12-05 11:03:23 -06:00
Robert Fairburn 1efd176302 Update osquery-perf example docs (#141) 2025-11-17 17:18:03 -06:00
Robert Fairburn e000ea39e2 Set better defaults and make task size and memory configurable (#140) 2025-11-14 13:59:20 -06:00
Robert Fairburn 757bd3cbae Update docs for addon/logging-destination-snowflake (#139) 2025-11-14 13:59:09 -06:00
Robert Fairburn a4278ad0f7 Allow for custom iam policy name (#138) 2025-11-14 09:33:02 -06:00
Robert Fairburn c7860450ac Update monitoring example. (#137)
Use module.fleet over module.main to reflect the reference architecture
examples.
2025-11-12 13:09:58 -06:00
Robert Fairburn ed4d3c01de Initial monitoring of cloudwatch logs (#136) 2025-11-12 12:28:23 -06:00
Robert Fairburn 91b3b1a797 Update fleet images used in gcp terraform (#131) 2025-11-06 14:00:01 -06:00
Robert Fairburn adac81defa Update example with some additional listner rule options (#103) 2025-09-03 07:15:54 -05:00
Robert Fairburn ca6428a6c2 Update readmes for new alb module (#102) 2025-09-02 11:02:13 -05:00
Robert Fairburn 762f716442 Update to alb module 9.17.0 (#98) 2025-09-02 05:27:22 -05:00
Robert Fairburn ecb3910653 Update logging-alb docs (#96) 2025-08-22 08:52:14 -05:00
Robert Fairburn 193f6495da Fix athena table creation when s3 prefix doesn't match bucket prefix (#95) 2025-08-22 08:22:37 -05:00
Robert Fairburn e1527926dc Initial support for bypassing URLs on the allowlist (#94) 2025-08-22 07:34:09 -05:00
Robert Fairburn 379e51d0dc Create athena table in logging_alb (#92) 2025-08-19 12:21:18 -05:00
Robert Fairburn 333b53caf5 Remove extra copies of geolite2 module (#91) 2025-08-19 12:14:27 -05:00
Robert Fairburn 050609fae8 Fix example in snowflake readme (#83) 2025-08-04 10:44:24 -05:00
Robert Fairburn 6cebbf2cff Initial snowflake module config (#72) 2025-07-31 10:23:24 -05:00
Robert Fairburn 22ce3187c3 Update TLS version used in load balancers (#78)
Updated per
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html
2025-07-30 14:37:06 -05:00
Robert Fairburn 043ad1aa5b Root module serverless v2 (#77) 2025-07-28 12:05:30 -05:00
Robert Fairburn 81bb303312 Firehose audit (#71) 2025-07-28 11:39:13 -05:00
Robert Fairburn b6b499063a osquery-perf module to accept an enroll secret (#69) 2025-07-10 11:16:43 -05:00
Robert Fairburn 789f192196 Add dale to codeowners (#67) 2025-07-01 14:37:44 -05:00
Robert Fairburn 62d232b330 Update examples to use latest module versions (#41) 2025-05-12 10:36:46 -05:00
Robert Fairburn ade69383aa Enable versioning for the software-installers bucket (#39) 2025-05-08 09:23:20 -05:00
Robert Fairburn ee20ed8f2e Fix typo in cloudfront.pem generation (#32) 2025-04-23 17:35:46 -05:00
Robert Fairburn f3d1a07df3 Update terraform example mdm to match current documentation (#27) 2025-04-10 12:44:08 -05:00
Robert Fairburn 7e61bfc4be tfvalidate per file change on PR and fmt example (#21) 2025-04-01 09:51:43 -05:00
Robert Fairburn 01271e17c6 Fix tfvalidate and validation errors (#20)
This also removes the broken vuln scans module that never behaved as
expected.
2025-03-27 11:38:26 -05:00
Robert Fairburn 9663f36843 Terraform validate (#19) 2025-03-27 10:00:57 -05:00
Robert Fairburn 57286bad2d Update module for preferred simpler defaults (#15) 2025-03-17 10:09:18 -05:00
Robert Fairburn 774797c5c4 Have SES module create a default dmarc record (#14) 2025-03-07 13:41:54 -06:00
Robert Fairburn e8154d7bde Cloudfront installers (#13) 2025-03-04 18:09:33 -06:00
Robert Fairburn d2ba0fec3f Fix Examples (#11) 2025-02-20 18:20:55 -06:00
Robert Fairburn e68e4851db Remove inadvertent file (#10) 2025-02-20 18:19:12 -06:00
Robert Fairburn be409b73c7 Update terraform docs for changed modules (#7) 2025-02-19 10:19:38 -06:00
Robert Fairburn 758b2a0049 Allow for final snapshot in terraform module (#5) 2025-02-10 19:09:32 -06:00
Robert Fairburn b0dcd44b2d Allow backup retention period to be configured in rds (#6) 2025-02-10 18:45:16 -06:00
Robert Fairburn 628ba367fa Fix breaking change in geolite2 module (#4) 2025-02-09 21:23:29 -06:00
Robert Fairburn e6fadb737a Update versions to be latest and work with this repo (#3) 2025-02-09 21:23:16 -06:00
Robert Fairburn f378f62db2 Initial migration (#1)
This will be needed to make the initial tags. Once merged to main, I
will tag with the same module revisions as what exists in the Fleet
repo. We can then test the example module using the new settings.

Once validated, we'll then update the main fleet repo to redirect here
for /terraform and remove everything there. Anything referring to old
tags will still work in-place. Additionally any website references will
be updated as well to reflect these changes.
2025-02-04 10:07:51 -06:00