|
| 1 | +/** |
| 2 | + * Copyright 2018 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +locals { |
| 18 | + cluster_type = "simple-regional-asm2" |
| 19 | +} |
| 20 | + |
| 21 | +provider "google-beta" { |
| 22 | + version = "~> 3.23.0" |
| 23 | + region = var.region |
| 24 | +} |
| 25 | + |
| 26 | +data "google_project" "project" { |
| 27 | + project_id = var.project_id |
| 28 | +} |
| 29 | + |
| 30 | +module "gke" { |
| 31 | + source = "../../modules/beta-public-cluster/" |
| 32 | + project_id = var.project_id |
| 33 | + name = "${local.cluster_type}-cluster${var.cluster_name_suffix}" |
| 34 | + regional = true |
| 35 | + release_channel = "REGULAR" |
| 36 | + region = var.region |
| 37 | + network = var.network |
| 38 | + subnetwork = var.subnetwork |
| 39 | + ip_range_pods = var.ip_range_pods |
| 40 | + ip_range_services = var.ip_range_services |
| 41 | + network_policy = false |
| 42 | + cluster_resource_labels = { "mesh_id" : "proj-${data.google_project.project.number}" } |
| 43 | + node_pools = [ |
| 44 | + { |
| 45 | + name = "asm-node-pool" |
| 46 | + autoscaling = false |
| 47 | + # ASM requires minimum 4 nodes and e2-standard-4 |
| 48 | + # As this is a regional cluster we have node_count * 3 = 6 nodes |
| 49 | + node_count = 2 |
| 50 | + machine_type = "e2-standard-4" |
| 51 | + }, |
| 52 | + ] |
| 53 | +} |
| 54 | + |
| 55 | +module "asm" { |
| 56 | + source = "../../modules/asm" |
| 57 | + cluster_name = module.gke.name |
| 58 | + cluster_endpoint = module.gke.endpoint |
| 59 | + project_id = var.project_id |
| 60 | + location = module.gke.location |
| 61 | + use_tf_google_credentials_env_var = true |
| 62 | +} |
| 63 | + |
| 64 | +data "google_client_config" "default" { |
| 65 | +} |
0 commit comments