|
| 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 = "workload-metadata-private" |
| 19 | +} |
| 20 | + |
| 21 | +provider "google-beta" { |
| 22 | + version = "~> 2.9.0" |
| 23 | + region = "${var.region}" |
| 24 | +} |
| 25 | + |
| 26 | +data "google_compute_subnetwork" "subnetwork" { |
| 27 | + name = "${var.subnetwork}" |
| 28 | + project = "${var.project_id}" |
| 29 | + region = "${var.region}" |
| 30 | +} |
| 31 | + |
| 32 | +module "gke" { |
| 33 | + source = "../../modules/beta-private-cluster/" |
| 34 | + project_id = "${var.project_id}" |
| 35 | + name = "${local.cluster_type}-cluster${var.cluster_name_suffix}" |
| 36 | + regional = false |
| 37 | + region = "${var.region}" |
| 38 | + zones = "${var.zones}" |
| 39 | + network = "${var.network}" |
| 40 | + subnetwork = "${var.subnetwork}" |
| 41 | + ip_range_pods = "${var.ip_range_pods}" |
| 42 | + ip_range_services = "${var.ip_range_services}" |
| 43 | + service_account = "${var.compute_engine_service_account}" |
| 44 | + enable_private_endpoint = true |
| 45 | + enable_private_nodes = true |
| 46 | + master_ipv4_cidr_block = "172.16.0.0/28" |
| 47 | + node_metadata = "SECURE" |
| 48 | + |
| 49 | + master_authorized_networks_config = [{ |
| 50 | + cidr_blocks = [{ |
| 51 | + cidr_block = "${data.google_compute_subnetwork.subnetwork.ip_cidr_range}" |
| 52 | + display_name = "VPC" |
| 53 | + }] |
| 54 | + }] |
| 55 | +} |
| 56 | + |
| 57 | +data "google_client_config" "default" {} |
0 commit comments