From ecbf9d9429d274ce382a6641e37dfef7349ea2fc Mon Sep 17 00:00:00 2001 From: Zachary Winnerman <98712682+zwinnerman-fleetdm@users.noreply.github.com> Date: Fri, 3 Feb 2023 13:05:57 -0500 Subject: [PATCH] Add migration code for Dogfood to module. (#9648) # Checklist for submitter Closes https://github.com/fleetdm/fleet/issues/9385 If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [ ] Documented any API changes (docs/Using-Fleet/REST-API.md or docs/Contributing/API-for-contributors.md) - [ ] Documented any permissions changes - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features. - [ ] Added/updated tests - [ ] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [ ] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)). --- terraform/.header.md | 22 ++++++++++++++++++++++ terraform/README.md | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/terraform/.header.md b/terraform/.header.md index fb57088117..84cf51824c 100644 --- a/terraform/.header.md +++ b/terraform/.header.md @@ -8,6 +8,28 @@ The following is the module layout so you can navigate to the module that you wa * BYO-database (use this if you want to use an existing database and cache node) * BYO-ECS (use this if you want to bring your own everything but Fleet ECS services) +# Migrating from existing Dogfood code +The below code describes how to migrate from existing Dogfood code + +```hcl +moved { + from = module.vpc + to = module.main.module.vpc +} + +moved { + from = module.aurora_mysql + to = module.main.module.byo-vpc.module.rds +} + +moved { + from = aws_elasticache_replication_group.default + to = module.main.module.byo-vpc.module.redis.aws_elasticache_replication_group.default +} +``` + +This focuses on the resources that are "heavy" or store data. Note that the ALB cannot be moved like this because Dogfood uses the `aws_alb` resource and the module uses the `aws_lb` resource. The resources are aliases of eachother, but Terraform can't recognize that. + # How to improve this module If this module somehow doesn't fit your needs, feel free to contact us by opening a ticket, or contacting your contact at Fleet. Our goal is to make this module diff --git a/terraform/README.md b/terraform/README.md index 374ccb4eb6..2cc8379ef6 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -8,6 +8,28 @@ The following is the module layout so you can navigate to the module that you wa * BYO-database (use this if you want to use an existing database and cache node) * BYO-ECS (use this if you want to bring your own everything but Fleet ECS services) +# Migrating from existing Dogfood code +The below code describes how to migrate from existing Dogfood code + +```hcl +moved { + from = module.vpc + to = module.main.module.vpc +} + +moved { + from = module.aurora_mysql + to = module.main.module.byo-vpc.module.rds +} + +moved { + from = aws_elasticache_replication_group.default + to = module.main.module.byo-vpc.module.redis.aws_elasticache_replication_group.default +} +``` + +This focuses on the resources that are "heavy" or store data. Note that the ALB cannot be moved like this because Dogfood uses the `aws_alb` resource and the module uses the `aws_lb` resource. The resources are aliases of eachother, but Terraform can't recognize that. + # How to improve this module If this module somehow doesn't fit your needs, feel free to contact us by opening a ticket, or contacting your contact at Fleet. Our goal is to make this module