From 6be6c794f8ffd923228b9008708148a47199bcda Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Wed, 5 Mar 2025 18:27:19 -0500 Subject: [PATCH] pass in vpc --- README.md | 1 + karpenter-resources/values.yaml.tpl | 1 + main.tf | 1 + variables.tf | 5 +++++ 4 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 061a258..31d8199 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | [region](#input\_region) | AWS region | `string` | n/a | yes | | [subnets\_name](#input\_subnets\_name) | Define the name of the subnets to be used by this cluster | `string` | `"*-container-*"` | no | | [tags](#input\_tags) | AWS Tags to apply to appropriate resources | `map(string)` | `{}` | no | +| [vpc\_id](#input\_vpc\_id) | The ID of the VPC where the resources will be deployed | `string` | n/a | yes | ## Outputs diff --git a/karpenter-resources/values.yaml.tpl b/karpenter-resources/values.yaml.tpl index c4004b1..747ba17 100644 --- a/karpenter-resources/values.yaml.tpl +++ b/karpenter-resources/values.yaml.tpl @@ -8,6 +8,7 @@ ec2NodeClass: amiFamily: ${amd_ami_family} amiSelectorTerms: - alias: ${amd_ami_alias} + vpcId: ${vpc_id} subnetSelectorTerms: - tags: Name: "${subnets_name}" diff --git a/main.tf b/main.tf index 6f43c9e..bca2130 100644 --- a/main.tf +++ b/main.tf @@ -84,6 +84,7 @@ resource "helm_release" "nodepool_resources" { karpenter_node_profile = module.karpenter_resources.instance_profile_name subnets_name = var.subnets_name tags = var.tags + vpc_id = var.vpc_id }) ] } diff --git a/variables.tf b/variables.tf index 98c54a8..1f30170 100644 --- a/variables.tf +++ b/variables.tf @@ -71,3 +71,8 @@ variable "namespace" { type = string default = "namespace" } + +variable "vpc_id" { + description = "The ID of the VPC where the resources will be deployed" + type = string +}