Skip to content

Commit 6022c67

Browse files
committed
set more cluster properties, remove unused outputs
1 parent d456cb3 commit 6022c67

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

terraform/aws/aws-eks-operator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ kubectl logs -n tailscale -l app.kubernetes.io/name=$(terraform output -raw oper
6565
After deployment, configure kubectl to access your cluster using Tailscale:
6666

6767
```shell
68-
tailscale configure kubeconfig ${terraform output -raw operator_name}
68+
tailscale configure kubeconfig $(terraform output -raw ha_proxy_service_name)
6969
```
7070

7171
```shell

terraform/aws/aws-eks-operator/main.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
locals {
2-
name = "example-${basename(path.cwd)}"
2+
name = "example-${basename(path.cwd)}"
3+
name_with_random_suffix = "${local.name}-${random_integer.operator_name_suffix.result}"
34

45
aws_tags = {
56
Name = local.name
@@ -10,6 +11,7 @@ locals {
1011
subnet_ids = module.vpc.private_subnets
1112

1213
# EKS cluster configuration
14+
cluster_name = local.name_with_random_suffix
1315
cluster_version = data.aws_eks_cluster_versions.latest.cluster_versions[0].cluster_version
1416
node_instance_type = "t3.medium"
1517
desired_size = 2
@@ -18,7 +20,7 @@ locals {
1820

1921
# Tailscale Operator configuration
2022
namespace_name = "tailscale"
21-
operator_name = "${local.name}-${random_integer.operator_name_suffix.result}"
23+
operator_name = local.name_with_random_suffix
2224
operator_version = "1.92.4"
2325
tailscale_oauth_client_id = var.tailscale_oauth_client_id
2426
tailscale_oauth_client_secret = var.tailscale_oauth_client_secret
@@ -45,7 +47,7 @@ module "eks" {
4547
source = "terraform-aws-modules/eks/aws"
4648
version = ">= 21.0, < 22.0"
4749

48-
name = local.name
50+
name = local.cluster_name
4951
kubernetes_version = local.cluster_version
5052

5153
tags = local.aws_tags
@@ -78,6 +80,11 @@ module "eks" {
7880
name = substr(local.name, 0, 20)
7981
instance_types = [local.node_instance_type]
8082

83+
labels = {}
84+
85+
launch_template_name = local.name
86+
launch_template_tags = local.aws_tags
87+
8188
desired_size = local.desired_size
8289
max_size = local.max_size
8390
min_size = local.min_size

terraform/aws/aws-eks-operator/outputs.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ output "operator_name" {
1818
value = helm_release.tailscale_operator.name
1919
}
2020

21-
output "cmd_kubeconfig_tailscale" {
22-
description = "Command to configure kubeconfig for Tailscale access to the EKS cluster"
23-
value = "tailscale configure kubeconfig ${helm_release.tailscale_operator.name}"
21+
output "ha_proxy_service_name" {
22+
description = "Configured name of the Tailscale operator HA Service Proxy"
23+
value = local.ha_proxy_service_name
2424
}
2525

2626
output "cmd_kubeconfig_aws" {
2727
description = "Command to configure kubeconfig for public access to the EKS cluster"
2828
value = "aws eks update-kubeconfig --region ${data.aws_region.current.region} --name ${module.eks.cluster_name}"
2929
}
3030

31-
output "cmd_kubectl_ha_proxy_apply" {
32-
description = "Command to deploy the Tailscale high availability API server proxy - https://tailscale.com/kb/1437/kubernetes-operator-api-server-proxy#configuring-a-high-availability-api-server-proxy"
33-
value = "OPERATOR_NAME=${helm_release.tailscale_operator.name} envsubst < tailscale-api-server-ha-proxy.yaml | kubectl apply -f -"
31+
output "cmd_kubeconfig_tailscale" {
32+
description = "Command to configure kubeconfig for Tailscale access to the EKS cluster"
33+
value = "tailscale configure kubeconfig ${helm_release.tailscale_operator.name}"
3434
}
3535

36-
output "cmd_kubectl_ha_proxy_delete" {
37-
description = "Command to delete the Tailscale high availability API server proxy - https://tailscale.com/kb/1437/kubernetes-operator-api-server-proxy#configuring-a-high-availability-api-server-proxy"
38-
value = "OPERATOR_NAME=${helm_release.tailscale_operator.name} envsubst < tailscale-api-server-ha-proxy.yaml | kubectl delete -f -"
36+
output "cmd_kubeconfig_tailscale_ha" {
37+
description = "Command to configure kubeconfig for Tailscale access to the EKS cluster using the HA Service Proxy"
38+
value = "tailscale configure kubeconfig ${local.ha_proxy_service_name}"
3939
}

0 commit comments

Comments
 (0)