-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terraform): allow traffic routing to be controlled by boolean (#241
) * feat(terraform): allow traffic routing to be controlled by boolean * docs: update Terraform docs * docs: add links to references --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
758c5d1
commit 74f3af5
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
docs/infrastructure/terraform/vol-terraform-relationship.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
# Repositories | ||
|
||
The VOL infrastructure is divided into two repositories: [`vol-app`](https://github.com/dvsa/vol-app) and [`vol-terraform`](https://github.com/dvsa/vol-terraform). | ||
|
||
The rationale for this split is explained in [RFC-005](../../rfc/rfc-005-add-terraform-to-mono-repository.md). At a high level, this approach was the only identified feasible option for implementing the migration the VOL application to ECS and establishing CI/CD workflows. | ||
|
||
:::danger | ||
|
||
The `vol-app` repository depends on the `vol-terraform` repository. This relationship _must_ remain unidirectional to prevent circular dependencies. Circular dependencies can disrupt disaster recovery processes and complicate infrastructure re-creation. | ||
|
||
::: | ||
|
||
### Controlling Traffic Flow | ||
|
||
ECS-related resources created by `vol-app` were intentionally designed to coexist with the existing EC2 infrastructure provisioned by the `vol-terraform` repository. This approach ensures a smooth transition to the new infrastructure. Traffic flow can be managed by setting a listener rule with a higher priority (`0` being the highest priority). | ||
|
||
```mermaid | ||
sequenceDiagram | ||
actor User | ||
participant Load Balancer | ||
participant EC2 | ||
participant ECS | ||
User->>Load Balancer: Request | ||
Load Balancer->>EC2: Route | ||
EC2-->>User: Response | ||
alt ECS listener rule added with higher priority | ||
User->>Load Balancer: Request | ||
Load Balancer->>ECS: Route | ||
ECS-->>User: Response | ||
end | ||
``` | ||
|
||
:::tip | ||
|
||
The listener rule is controlled by the variable: `service.listener_rule_enable` variable. | ||
|
||
To push traffic to the ECS service, set `service.listener_rule_enable = true`. This can be controlled per environment _and_ service. | ||
|
||
```hcl showLineNumbers | ||
# vol-app/infra/terraform/environments/[env]/main.tf | ||
module "service" { | ||
source = "../../modules/service" | ||
# ... | ||
services = { | ||
"service" = { | ||
# ... | ||
// highlight-next-line | ||
listener_rule_enable = true # default is `true`. | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters