Skip to content

Commit 3ab784e

Browse files
committed
feat(vpc-endpoint-consumer): add enable_consumer_sync variable to control service synchronization
Signed-off-by: Ghislain Cheng <[email protected]>
1 parent b089839 commit 3ab784e

File tree

3 files changed

+5
-52
lines changed

3 files changed

+5
-52
lines changed

modules/vpc-endpoint-consumer/README.md

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,56 +38,6 @@ module "vpc_endpoint_consumer" {
3838
}
3939
```
4040

41-
### Using Custom CIDR Blocks
42-
43-
```terraform
44-
module "vpc_endpoint_consumer" {
45-
source = "./modules/vpc-endpoint-consumer"
46-
47-
vpc_id = "vpc-xxxxx"
48-
subnet_ids = ["subnet-xxxxx", "subnet-yyyyy"]
49-
50-
# Create security group with custom CIDR blocks
51-
create_security_group = true
52-
security_group_name = "custom-mpc-sg"
53-
security_group_ingress_cidr_blocks = ["10.0.0.0/16"]
54-
55-
party_services = [
56-
{
57-
name = "partner-kms-core"
58-
region = "us-east-1"
59-
party_id = "partner1"
60-
vpc_endpoint_service_name = "com.amazonaws.vpce.us-east-1.vpce-svc-xxxxx"
61-
}
62-
]
63-
}
64-
```
65-
66-
### Using Source Security Group
67-
68-
```terraform
69-
module "vpc_endpoint_consumer" {
70-
source = "./modules/vpc-endpoint-consumer"
71-
72-
vpc_id = "vpc-xxxxx"
73-
subnet_ids = ["subnet-xxxxx", "subnet-yyyyy"]
74-
75-
# Allow traffic from a specific security group
76-
create_security_group = true
77-
security_group_name = "custom-mpc-sg"
78-
security_group_ingress_source_sg_id = "sg-xxxxx"
79-
80-
party_services = [
81-
{
82-
name = "partner-kms-core"
83-
region = "us-east-1"
84-
party_id = "partner1"
85-
vpc_endpoint_service_name = "com.amazonaws.vpce.us-east-1.vpce-svc-xxxxx"
86-
}
87-
]
88-
}
89-
```
90-
9141
### Using Existing Security Groups
9242

9343
```terraform
@@ -185,7 +135,7 @@ No modules.
185135
| <a name="input_endpoint_delete_timeout"></a> [endpoint\_delete\_timeout](#input\_endpoint\_delete\_timeout) | Timeout for deleting VPC interface endpoints | `string` | `"10m"` | no |
186136
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Prefix for naming VPC interface endpoint resources | `string` | `"mpc-partner"` | no |
187137
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Kubernetes namespace where partner services will be created | `string` | `"kms-decentralized"` | no |
188-
| <a name="input_party_services"></a> [party\_services](#input\_party\_services) | List of partner MPC services to connect to via VPC interface endpoints | <pre>list(object({<br/> name = string<br/> region = string<br/> party_id = string<br/> account_id = optional(string, null)<br/> partner_name = optional(string, null)<br/> vpc_endpoint_service_name = string<br/> public_bucket_url = optional(string, null)<br/> ports = optional(list(object({<br/> name = string<br/> port = number<br/> target_port = number<br/> protocol = string<br/> })), null)<br/> availability_zones = optional(list(string), null)<br/> create_kube_service = optional(bool, true)<br/> kube_service_config = optional(object({<br/> additional_annotations = optional(map(string), {})<br/> labels = optional(map(string), {})<br/> session_affinity = optional(string, "None")<br/> }), {})<br/> }))</pre> | n/a | yes |
138+
| <a name="input_party_services"></a> [party\_services](#input\_party\_services) | List of partner MPC services to connect to via VPC interface endpoints | <pre>list(object({<br/> name = string<br/> region = string<br/> party_id = string<br/> account_id = optional(string, null)<br/> partner_name = optional(string, null)<br/> vpc_endpoint_service_name = string<br/> enable_consumer_sync = optional(bool, true)<br/> public_bucket_url = optional(string, null)<br/> ports = optional(list(object({<br/> name = string<br/> port = number<br/> target_port = number<br/> protocol = string<br/> })), null)<br/> availability_zones = optional(list(string), null)<br/> create_kube_service = optional(bool, true)<br/> kube_service_config = optional(object({<br/> additional_annotations = optional(map(string), {})<br/> labels = optional(map(string), {})<br/> session_affinity = optional(string, "None")<br/> }), {})<br/> }))</pre> | n/a | yes |
189139
| <a name="input_private_dns_enabled"></a> [private\_dns\_enabled](#input\_private\_dns\_enabled) | Whether to enable private DNS for the VPC interface endpoints | `bool` | `false` | no |
190140
| <a name="input_private_zone_id"></a> [private\_zone\_id](#input\_private\_zone\_id) | Route53 private hosted zone ID for custom DNS records | `string` | `""` | no |
191141
| <a name="input_route_table_ids"></a> [route\_table\_ids](#input\_route\_table\_ids) | List of route table IDs to associate with the VPC interface endpoints | `list(string)` | `[]` | no |

modules/vpc-endpoint-consumer/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ locals {
9898
cluster_name_for_tags = var.cluster_name != null ? var.cluster_name : "mpc-cluster"
9999

100100
# Convert party_services list to map for for_each usage
101+
# VPC endpoints needed for both consumer sync and Kubernetes services
101102
party_services_map = {
102103
for service in var.party_services : service.party_id => service
104+
if service.enable_consumer_sync == true
103105
}
104106

105107
party_services_map_with_s3_bucket = {
@@ -110,7 +112,7 @@ locals {
110112
# Create separate map for services that need Kubernetes services
111113
kube_services_map = {
112114
for service in var.party_services : service.party_id => service
113-
if service.create_kube_service
115+
if service.create_kube_service && service.enable_consumer_sync == true
114116
}
115117

116118
# Build ingress rules from default_mpc_ports

modules/vpc-endpoint-consumer/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ variable "party_services" {
6262
account_id = optional(string, null)
6363
partner_name = optional(string, null)
6464
vpc_endpoint_service_name = string
65+
enable_consumer_sync = optional(bool, true)
6566
public_bucket_url = optional(string, null)
6667
ports = optional(list(object({
6768
name = string

0 commit comments

Comments
 (0)