Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions terraform/aws/modules/composition/envoy-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
| <a name="input_target_group_protocol"></a> [target\_group\_protocol](#input\_target\_group\_protocol) | Protocol for target group (HTTP or HTTPS) | `string` | `"HTTP"` | no |
| <a name="input_termination_policies"></a> [termination\_policies](#input\_termination\_policies) | List of policies to use when selecting instances to terminate (OldestLaunchTemplate, OldestInstance, Default, etc.) | `list(string)` | <pre>[<br/> "OldestLaunchTemplate",<br/> "OldestInstance",<br/> "Default"<br/>]</pre> | no |
| <a name="input_upload_config_to_s3"></a> [upload\_config\_to\_s3](#input\_upload\_config\_to\_s3) | Whether to upload config files from local directory to S3 | `bool` | `false` | no |
| <a name="input_virtual_hosts_domains"></a> [virtual\_hosts\_domains](#input\_virtual\_hosts\_domains) | List of domain names for the Envoy virtual host (for envoy.yaml templating) | `list(string)` | `[]` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where resources will be created | `string` | n/a | yes |
| <a name="input_waf_web_acl_arn"></a> [waf\_web\_acl\_arn](#input\_waf\_web\_acl\_arn) | ARN of AWS WAFv2 WebACL to associate with ALB (required if enable\_waf = true) | `string` | `null` | no |

Expand Down
17 changes: 11 additions & 6 deletions terraform/aws/modules/composition/envoy-proxy/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,24 @@ locals {
)

default_eks_cluster_name = "${var.environment}-${var.project_name}-cluster"
eks_cluster_name = var.eks_cluster_name != "" ? var.eks_cluster_name : local.default_eks_cluster_name
eks_cluster_name = var.eks_cluster_name != "" ? var.eks_cluster_name : local.default_eks_cluster_name

# Envoy configuration templating - replace placeholders with actual values
# Supports: {{hyperswitch_cloudfront_dns}}, {{internal_loadbalancer_dns}}, {{eks_cluster_name}}
# Supports: {{hyperswitch_cloudfront_dns}}, {{internal_loadbalancer_dns}}, {{eks_cluster_name}}, {{virtual_hosts_domains}}
virtual_hosts_domains_json = jsonencode(var.virtual_hosts_domains)

envoy_config_content = replace(
replace(
replace(
var.envoy_config_template,
"{{hyperswitch_cloudfront_dns}}", var.hyperswitch_cloudfront_dns
replace(
var.envoy_config_template,
"{{hyperswitch_cloudfront_dns}}", var.hyperswitch_cloudfront_dns
),
"{{internal_loadbalancer_dns}}", var.internal_loadbalancer_dns
),
"{{internal_loadbalancer_dns}}", var.internal_loadbalancer_dns
"{{eks_cluster_name}}", local.eks_cluster_name
),
"{{eks_cluster_name}}", local.eks_cluster_name
"{{virtual_hosts_domains}}", local.virtual_hosts_domains_json
)

# Logs bucket selection - use created or existing
Expand Down
2 changes: 1 addition & 1 deletion terraform/aws/modules/composition/envoy-proxy/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ output "ssh_key_pair_id" {

output "ssh_key_retrieval_command" {
description = "Command to retrieve the private SSH key from Parameter Store (only if auto-generated)"
value = var.generate_ssh_key ? "aws ssm get-parameter --name \"${aws_ssm_parameter.envoy_private_key[0].name}\" --with-decryption --query 'Parameter.Value' --output text > ${module.key_pair[0].key_pair_name}.pem && chmod 400 ${module.key_pair[0].key_pair_name}.pem" : null
value = var.generate_ssh_key ? "aws ssm get-parameter --name \"${aws_ssm_parameter.envoy_private_key[0].name}\" --with-decryption --query 'Parameter.Value' --output text > ${module.key_pair[0].key_pair_name}.pem && chmod 400 ${module.key_pair[0].key_pair_name}.pem" : null
}

output "config_version" {
Expand Down
8 changes: 7 additions & 1 deletion terraform/aws/modules/composition/envoy-proxy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ variable "deployments" {

default = {
"stable" = {
weight = 100
weight = 100
launch_template_version = "$Latest"
}
}
Expand Down Expand Up @@ -551,6 +551,12 @@ variable "internal_loadbalancer_dns" {
default = ""
}

variable "virtual_hosts_domains" {
description = "List of domain names for the Envoy virtual host (for envoy.yaml templating)"
type = list(string)
default = []
}

variable "eks_cluster_name" {
description = "EKS cluster name (for envoy.yaml templating)"
type = string
Expand Down