Skip to content

[install/infra] Fixup k3s database unique IDs, GKE unique ID syntax, EKS long branch name IAM role errors #12321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2022
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
10 changes: 10 additions & 0 deletions install/infra/modules/eks/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ resource "aws_security_group" "nodes" {
}
}

resource "random_string" "ng_role_suffix" {
upper = false
lower = true
special = false
length = 4
}

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "18.8.1"
Expand Down Expand Up @@ -91,6 +98,7 @@ module "eks" {
eks_managed_node_group_defaults = {
ami_type = "CUSTOM"
iam_role_attach_cni_policy = true
iam_role_use_name_prefix = false
ami_id = var.image_id
enable_bootstrap_user_data = true
vpc_security_group_ids = [aws_security_group.nodes.id]
Expand All @@ -102,6 +110,7 @@ module "eks" {
enable_bootstrap_user_data = true
instance_types = [var.service_machine_type]
name = "service-${var.cluster_name}"
iam_role_name = format("%s-%s", substr("${var.cluster_name}-svc-ng", 0, 58), random_string.ng_role_suffix.result)
subnet_ids = module.vpc.public_subnets
min_size = 1
max_size = 4
Expand Down Expand Up @@ -142,6 +151,7 @@ module "eks" {
Workspaces = {
instance_types = [var.workspace_machine_type]
name = "ws-${var.cluster_name}"
iam_role_name = format("%s-%s", substr("${var.cluster_name}-ws-ng", 0, 58), random_string.ng_role_suffix.result)
subnet_ids = module.vpc.public_subnets
min_size = 1
max_size = 50
Expand Down
1 change: 1 addition & 0 deletions install/infra/modules/gke/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ resource "google_container_node_pool" "workspaces" {

resource "random_string" "random" {
length = 4
upper = false
special = false
}

Expand Down
8 changes: 7 additions & 1 deletion install/infra/modules/k3s/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ resource "google_dns_record_set" "gitpod-dns-3" {
rrdatas = [google_compute_instance.k3s_master_instance.network_interface[0].access_config[0].nat_ip]
}

resource "random_string" "random" {
length = 4
upper = false
special = false
}

resource "google_sql_database_instance" "gitpod" {
name = "sql-${var.name}"
name = "sql-${var.name}-${random_string.random.result}"
database_version = "MYSQL_5_7"
region = var.gcp_region
settings {
Expand Down