Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandarp committed Jul 3, 2019
0 parents commit dc92d6d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tfstate*
.terraform/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# terraform-gke

Launch and manage a GKE cluster using Terraform.

## Launch GKE Cluster

```
$ terraform init
$ terraform plan
$ terraform apply
```

## Questions?

Open an issue.
40 changes: 40 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resource "google_container_cluster" "default" {
name = "${var.name}"
project = "${var.project}"
description = "Demo GKE Cluster"
location = "${var.location}"

remove_default_node_pool = true
initial_node_count = "${var.initial_node_count}"

master_auth {
username = ""
password = ""

client_certificate_config {
issue_client_certificate = false
}
}
}

resource "google_container_node_pool" "default" {
name = "${var.name}-node-pool"
project = "${var.project}"
location = "${var.location}"
cluster = "${google_container_cluster.default.name}"
node_count = 1

node_config {
preemptible = true
machine_type = "${var.machine_type}"

metadata = {
disable-legacy-endpoints = "true"
}

oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
7 changes: 7 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "endpoint" {
value = "${google_container_cluster.default.endpoint}"
}

output "master_version" {
value = "${google_container_cluster.default.master_version}"
}
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "name" {
default = "demo-cluster"
}
variable "project" {
default = "optimum-spring-238818"
}

variable "location" {
default = "us-central1"
}

variable "initial_node_count" {
default = 1
}

variable "machine_type" {
default = "n1-standard-1"
}

0 comments on commit dc92d6d

Please sign in to comment.