Skip to content

Commit

Permalink
chore: output vpc id
Browse files Browse the repository at this point in the history
Signed-off-by: ankitm123 <[email protected]>
  • Loading branch information
ankitm123 authored and rawlingsj committed Jun 10, 2021
1 parent fdee274 commit 02745c0
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ The following sections provide a full list of configuration in- and output varia
| vault\_unseal\_bucket | The Vault storage bucket |
| vault\_user\_id | The Vault IAM user id |
| vault\_user\_secret | The Vault IAM user secret |
| vpc\_id | The ID of the VPC |

### Cluster Autoscaling

Expand Down
5 changes: 5 additions & 0 deletions examples/jx3/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// VPC
output "vpc_id" {
value = module.eks-jx.vpc_id
}

// Vault
output "vault_user_id" {
value = module.eks-jx.vault_user_id
Expand Down
4 changes: 2 additions & 2 deletions modules/cluster/local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ locals {
k8s_labels = merge(
local.node_group_defaults["k8s_labels"],
v["k8s_labels"],
)
)
} : {},
)}
) }
}
2 changes: 1 addition & 1 deletion modules/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module "eks" {
enable_irsa = true

worker_groups_launch_template = var.enable_worker_group && var.enable_worker_groups_launch_template ? [
for subnet in (var.create_vpc ? module.vpc.public_subnets : var.subnets) :
for subnet in(var.create_vpc ? module.vpc.public_subnets : var.subnets) :
{
subnets = [subnet]
asg_desired_capacity = var.lt_desired_nodes_per_subnet
Expand Down
4 changes: 4 additions & 0 deletions modules/cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
output "vpc_id" {
value = var.create_vpc ? module.vpc.vpc_id : var.vpc_id
description = "The ID of the VPC"
}

output "jx_namespace" {
value = kubernetes_namespace.jx
Expand Down
16 changes: 8 additions & 8 deletions modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ variable "spot_price" {

variable "node_groups" {
description = "List of node groups to be created"
type = any
default = {}
type = any
default = {}
}

variable "node_group_ami" {
Expand Down Expand Up @@ -294,15 +294,15 @@ variable "create_vpc" {
}

variable "vpc_id" {
description = "The VPC to create EKS cluster in if create_vpc is false"
type = string
default = ""
description = "The VPC to create EKS cluster in if create_vpc is false"
type = string
default = ""
}

variable "subnets" {
description = "The subnet ids to create EKS cluster in if create_vpc is false"
type = list(string)
default = []
description = "The subnet ids to create EKS cluster in if create_vpc is false"
type = list(string)
default = []
}

variable "encrypt_volume_self" {
Expand Down
7 changes: 7 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ output "lts_repository_bucket" {
description = "The bucket that will serve as artifacts repository"
}

// VPC

output "vpc_id" {
value = module.cluster.vpc_id
description = "The ID of the VPC"
}

// ----------------------------------------------------------------------------
// Cluster
// ----------------------------------------------------------------------------
Expand Down
16 changes: 8 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ variable "node_group_disk_size" {

variable "node_groups_managed" {
description = "List of managed node groups to be created and their respective settings"
type = any
default = {eks-jx-node-group = {}}
type = any
default = { eks-jx-node-group = {} }
}

variable "key_name" {
Expand Down Expand Up @@ -431,15 +431,15 @@ variable "create_vpc" {
}

variable "vpc_id" {
description = "The VPC to create EKS cluster in if create_vpc is false"
type = string
default = ""
description = "The VPC to create EKS cluster in if create_vpc is false"
type = string
default = ""
}

variable "subnets" {
description = "The subnet ids to create EKS cluster in if create_vpc is false"
type = list(string)
default = []
description = "The subnet ids to create EKS cluster in if create_vpc is false"
type = list(string)
default = []
}

variable "use_vault" {
Expand Down

0 comments on commit 02745c0

Please sign in to comment.