|
| 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 | +provider "google-beta" { |
| 18 | + version = "~> 2.2" |
| 19 | + region = "${var.region}" |
| 20 | +} |
| 21 | + |
| 22 | +provider "random" { |
| 23 | + version = "~> 2.1" |
| 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/private-cluster" |
| 34 | + |
| 35 | + ip_range_pods = "${var.ip_range_pods}" |
| 36 | + ip_range_services = "${var.ip_range_services}" |
| 37 | + name = "stub-domains-private-cluster${var.cluster_name_suffix}" |
| 38 | + network = "${var.network}" |
| 39 | + project_id = "${var.project_id}" |
| 40 | + region = "${var.region}" |
| 41 | + subnetwork = "${var.subnetwork}" |
| 42 | + |
| 43 | + deploy_using_private_endpoint = "true" |
| 44 | + enable_private_endpoint = "false" |
| 45 | + enable_private_nodes = "true" |
| 46 | + |
| 47 | + master_authorized_networks_config = [{ |
| 48 | + cidr_blocks = [{ |
| 49 | + cidr_block = "${data.google_compute_subnetwork.subnetwork.ip_cidr_range}" |
| 50 | + display_name = "VPC" |
| 51 | + }] |
| 52 | + }] |
| 53 | + |
| 54 | + master_ipv4_cidr_block = "172.16.0.0/28" |
| 55 | + |
| 56 | + network_policy = "true" |
| 57 | + service_account = "${var.compute_engine_service_account}" |
| 58 | + |
| 59 | + stub_domains { |
| 60 | + "example.com" = [ |
| 61 | + "10.254.154.11", |
| 62 | + "10.254.154.12", |
| 63 | + ] |
| 64 | + |
| 65 | + "example.net" = [ |
| 66 | + "10.254.154.11", |
| 67 | + "10.254.154.12", |
| 68 | + ] |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +data "google_client_config" "default" {} |
0 commit comments