Skip to content

Commit

Permalink
Merge pull request #5 from keneobum881/feature
Browse files Browse the repository at this point in the history
deploying gke
  • Loading branch information
keneobum881 authored May 21, 2024
2 parents 10531c3 + 0eef716 commit 3f981b6
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
6 changes: 6 additions & 0 deletions environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ module "vpc" {
env = "${local.env}"
}

module "gke" {
source = "../../modules/gke"
project = "${var.project}"
subnet = "${module.vpc.subnet}"
}

# module "http_server" {
# source = "../../modules/http_server"
# project = "${var.project}"
Expand Down
41 changes: 41 additions & 0 deletions modules/gke/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


locals {
network = "${element(split("-", var.subnet), 0)}"
}

resource "google_container_cluster" "ken" {
name = "ken-gke-cluster"
location = "us-west1"
remove_default_node_pool = true
initial_node_count = 1
}

resource "google_container_node_pool" "ken_preemptible_nodes" {
name = "ken-node-pool"
location = "us-west1"
cluster = google_container_cluster.ken.name
node_count = 1

node_config {
preemptible = true
machine_type = "e2-micro"
service_account = "[email protected]"
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
14 changes: 14 additions & 0 deletions modules/gke/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

17 changes: 17 additions & 0 deletions modules/gke/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


variable "project" {}
variable "subnet" {}
18 changes: 18 additions & 0 deletions modules/gke/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


terraform {
required_version = "~> 1.0.0"
}

0 comments on commit 3f981b6

Please sign in to comment.