Skip to content

Commit

Permalink
Mw/fix pipeline 1 1 6 (#2282)
Browse files Browse the repository at this point in the history
* update eks and aks to use latest kubernetes version

* updated the terraform provider as some fields were deprecated
  • Loading branch information
wilkermichael committed Jun 27, 2023
1 parent 7b70bb5 commit 4c05f59
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
16 changes: 13 additions & 3 deletions charts/consul/test/terraform/aks/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
azurerm = {
version = "3.40.0"
}
}
}

provider "azurerm" {
version = "3.40.0"
features {}
}

Expand Down Expand Up @@ -45,7 +55,7 @@ resource "azurerm_kubernetes_cluster" "default" {
location = azurerm_resource_group.default[count.index].location
resource_group_name = azurerm_resource_group.default[count.index].name
dns_prefix = "consul-k8s-${random_id.suffix[count.index].dec}"
kubernetes_version = "1.24.6"
kubernetes_version = "1.25"
role_based_access_control_enabled = true

// We're setting the network plugin and other network properties explicitly
Expand All @@ -68,7 +78,7 @@ resource "azurerm_kubernetes_cluster" "default" {
default_node_pool {
name = "default"
node_count = 3
vm_size = "Standard_D2_v2"
vm_size = "Standard_D3_v2"
os_disk_size_gb = 30
vnet_subnet_id = azurerm_virtual_network.default[count.index].subnet.*.id[0]
}
Expand Down
20 changes: 15 additions & 5 deletions charts/consul/test/terraform/eks/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
aws = {
version = ">= 4.0.0"
}
}
}

provider "aws" {
version = ">= 2.28.1"
region = var.region
region = var.region

assume_role {
role_arn = var.role_arn
Expand All @@ -25,7 +35,7 @@ resource "random_string" "suffix" {
module "vpc" {
count = var.cluster_count
source = "terraform-aws-modules/vpc/aws"
version = "3.11.0"
version = "4.0.0"

name = "consul-k8s-${random_id.suffix[count.index].dec}"
# The cidr range needs to be unique in each VPC to allow setting up a peering connection.
Expand Down Expand Up @@ -58,7 +68,7 @@ module "eks" {
kubeconfig_api_version = "client.authentication.k8s.io/v1beta1"

cluster_name = "consul-k8s-${random_id.suffix[count.index].dec}"
cluster_version = "1.23"
cluster_version = "1.25"
subnets = module.vpc[count.index].private_subnets
enable_irsa = true

Expand All @@ -70,7 +80,7 @@ module "eks" {
max_capacity = 3
min_capacity = 3

instance_type = "m5.large"
instance_type = "m5.xlarge"
}
}

Expand Down
21 changes: 19 additions & 2 deletions charts/consul/test/terraform/gke/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
google = {
version = "~> 4.58.0"
}
}
}

provider "google" {
project = var.project
version = "~> 3.49.0"
zone = var.zone
}

resource "random_id" "suffix" {
Expand All @@ -13,6 +24,11 @@ data "google_container_engine_versions" "main" {
version_prefix = "1.25."
}

# We assume that the subnets are already created to save time.
data "google_compute_subnetwork" "subnet" {
name = var.subnet
}

resource "google_container_cluster" "cluster" {
provider = "google"
count = var.cluster_count
Expand All @@ -25,8 +41,9 @@ resource "google_container_cluster" "cluster" {
node_version = data.google_container_engine_versions.main.latest_master_version
node_config {
tags = ["consul-k8s-${random_id.suffix[count.index].dec}"]
machine_type = "e2-standard-4"
machine_type = "e2-standard-8"
}
subnetwork = data.google_compute_subnetwork.subnet.name
resource_labels = var.labels
}

Expand Down

0 comments on commit 4c05f59

Please sign in to comment.