diff --git a/.gitignore b/.gitignore index 7195aaf..3163c96 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,11 @@ dist/ target/ dist/ -# JetBrains IDE +# IDE .idea/ +.idea +.vscode/ +.vscode # Unit test reports TEST*.xml @@ -54,4 +57,7 @@ terraform.* *.tfvars flux-git-auth.yaml -.idea + + +# custom +_* \ No newline at end of file diff --git a/README.md b/README.md index a81463c..7973aa4 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,15 @@ terraform destroy -target 'data.google_client_config.primary' | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | ~>1.4.2 | -| [google](#requirement\_google) | ~>4.62.0 | -| [kubernetes](#requirement\_kubernetes) | ~>2.19.0 | +| [terraform](#requirement\_terraform) | ~>1.7.0 | +| [google](#requirement\_google) | ~>5.27.0 | +| [kubernetes](#requirement\_kubernetes) | ~>2.29.0 | ## Providers | Name | Version | |------|---------| -| [google](#provider\_google) | 4.62.1 | -| [kubernetes](#provider\_kubernetes) | 2.19.0 | +| [google](#provider\_google) | 5.27.0 | ## Modules @@ -57,7 +56,6 @@ No modules. | [google_compute_subnetwork.subnet](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_subnetwork) | resource | | [google_container_cluster.primary](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster) | resource | | [google_container_node_pool.primary_nodes](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool) | resource | -| [kubernetes_namespace.flux-system](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [google_client_config.primary](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config) | data source | ## Inputs @@ -69,11 +67,15 @@ No modules. | [project](#input\_project) | Google Project to create resources in | `string` | `"demo"` | no | | [region](#input\_region) | The region to host the cluster in | `string` | `"us-central1"` | no | | [vpc\_host\_project](#input\_vpc\_host\_project) | Host Project where virtual network exists | `string` | `"demo"` | no | +| [zone](#input\_zone) | The region to host the cluster in | `string` | `"us-central1-b"` | no | ## Outputs | Name | Description | |------|-------------| +| [gcloud\_gke\_get\_creds](#output\_gcloud\_gke\_get\_creds) | Command to get GKE credentials | +| [gcloud\_gke\_link](#output\_gcloud\_gke\_link) | GKE web ui link | +| [gcloud\_vpc\_link](#output\_gcloud\_vpc\_link) | VPC web ui link | | [kubernetes\_cluster\_host](#output\_kubernetes\_cluster\_host) | GKE Cluster Host | | [kubernetes\_cluster\_name](#output\_kubernetes\_cluster\_name) | GKE Cluster Name | | [project](#output\_project) | GCloud Project ID | diff --git a/flux.tf b/flux.tf index d61afc1..20fb86c 100644 --- a/flux.tf +++ b/flux.tf @@ -1,5 +1,5 @@ -resource "kubernetes_namespace" "flux-system" { - metadata { - name = "flux-system" - } -} \ No newline at end of file +# resource "kubernetes_namespace" "flux-system" { +# metadata { +# name = "flux-system" +# } +# } \ No newline at end of file diff --git a/gke.tf b/gke.tf index 4fb9af1..663cb13 100644 --- a/gke.tf +++ b/gke.tf @@ -9,8 +9,9 @@ resource "google_container_cluster" "primary" { remove_default_node_pool = true initial_node_count = 1 - network = google_compute_network.vpc.name - subnetwork = google_compute_subnetwork.subnet.name + network = google_compute_network.vpc.name + subnetwork = google_compute_subnetwork.subnet.name + # min_master_version = "1.26.5-gke.1200" } # Separately Managed Node Pool diff --git a/outputs.tf b/outputs.tf index 81698e7..62f6dd4 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,19 +1,34 @@ output "region" { - value = var.region description = "GCloud Region" + value = var.region } output "project" { - value = var.project description = "GCloud Project ID" + value = var.project } output "kubernetes_cluster_name" { - value = google_container_cluster.primary.name description = "GKE Cluster Name" + value = google_container_cluster.primary.name } output "kubernetes_cluster_host" { - value = google_container_cluster.primary.endpoint description = "GKE Cluster Host" + value = google_container_cluster.primary.endpoint +} + +output "gcloud_gke_get_creds" { + description = "Command to get GKE credentials" + value = "gcloud container clusters get-credentials ${google_container_cluster.primary.name} --region ${var.region} --project ${var.project}" +} + +output "gcloud_vpc_link" { + description = "VPC web ui link" + value = "https://console.cloud.google.com/networking/networks/list?project=${var.project}" +} + +output "gcloud_gke_link" { + description = "GKE web ui link" + value = "https://console.cloud.google.com/kubernetes/clusters/details/${var.region}/${var.project}-gke/details?project=${var.project}" } diff --git a/variables.tf b/variables.tf index d4a5d5d..f1601e9 100644 --- a/variables.tf +++ b/variables.tf @@ -21,6 +21,12 @@ variable "region" { default = "us-central1" } +variable "zone" { + type = string + description = "The region to host the cluster in" + default = "us-central1-b" +} + variable "gke_num_nodes" { default = 1 description = "number of gke nodes" diff --git a/versions.tf b/versions.tf index 54cdf42..014623e 100644 --- a/versions.tf +++ b/versions.tf @@ -1,14 +1,14 @@ terraform { - required_version = "~>1.4.2" + required_version = "~>1.7.0" required_providers { google = { source = "hashicorp/google" # https://github.com/hashicorp/terraform-provider-google - version = "~>4.62.0" + version = "~>5.27.0" } kubernetes = { source = "hashicorp/kubernetes" # https://github.com/hashicorp/terraform-provider-kubernetes - version = "~>2.19.0" + version = "~>2.29.0" } } }