bump providers; added some outputs

This commit is contained in:
Aleksei Krugliak 2024-05-05 13:35:15 +04:00
parent 2598cc76d7
commit 524c8d217f
7 changed files with 52 additions and 22 deletions

10
.gitignore vendored
View File

@ -23,8 +23,11 @@ dist/
target/ target/
dist/ dist/
# JetBrains IDE # IDE
.idea/ .idea/
.idea
.vscode/
.vscode
# Unit test reports # Unit test reports
TEST*.xml TEST*.xml
@ -54,4 +57,7 @@ terraform.*
*.tfvars *.tfvars
flux-git-auth.yaml flux-git-auth.yaml
.idea
# custom
_*

View File

@ -34,16 +34,15 @@ terraform destroy -target 'data.google_client_config.primary'
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~>1.4.2 | | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~>1.7.0 |
| <a name="requirement_google"></a> [google](#requirement\_google) | ~>4.62.0 | | <a name="requirement_google"></a> [google](#requirement\_google) | ~>5.27.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | ~>2.19.0 | | <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | ~>2.29.0 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 4.62.1 | | <a name="provider_google"></a> [google](#provider\_google) | 5.27.0 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.19.0 |
## Modules ## 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_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_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 | | [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 | | [google_client_config.primary](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config) | data source |
## Inputs ## Inputs
@ -69,11 +67,15 @@ No modules.
| <a name="input_project"></a> [project](#input\_project) | Google Project to create resources in | `string` | `"demo"` | no | | <a name="input_project"></a> [project](#input\_project) | Google Project to create resources in | `string` | `"demo"` | no |
| <a name="input_region"></a> [region](#input\_region) | The region to host the cluster in | `string` | `"us-central1"` | no | | <a name="input_region"></a> [region](#input\_region) | The region to host the cluster in | `string` | `"us-central1"` | no |
| <a name="input_vpc_host_project"></a> [vpc\_host\_project](#input\_vpc\_host\_project) | Host Project where virtual network exists | `string` | `"demo"` | no | | <a name="input_vpc_host_project"></a> [vpc\_host\_project](#input\_vpc\_host\_project) | Host Project where virtual network exists | `string` | `"demo"` | no |
| <a name="input_zone"></a> [zone](#input\_zone) | The region to host the cluster in | `string` | `"us-central1-b"` | no |
## Outputs ## Outputs
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| <a name="output_gcloud_gke_get_creds"></a> [gcloud\_gke\_get\_creds](#output\_gcloud\_gke\_get\_creds) | Command to get GKE credentials |
| <a name="output_gcloud_gke_link"></a> [gcloud\_gke\_link](#output\_gcloud\_gke\_link) | GKE web ui link |
| <a name="output_gcloud_vpc_link"></a> [gcloud\_vpc\_link](#output\_gcloud\_vpc\_link) | VPC web ui link |
| <a name="output_kubernetes_cluster_host"></a> [kubernetes\_cluster\_host](#output\_kubernetes\_cluster\_host) | GKE Cluster Host | | <a name="output_kubernetes_cluster_host"></a> [kubernetes\_cluster\_host](#output\_kubernetes\_cluster\_host) | GKE Cluster Host |
| <a name="output_kubernetes_cluster_name"></a> [kubernetes\_cluster\_name](#output\_kubernetes\_cluster\_name) | GKE Cluster Name | | <a name="output_kubernetes_cluster_name"></a> [kubernetes\_cluster\_name](#output\_kubernetes\_cluster\_name) | GKE Cluster Name |
| <a name="output_project"></a> [project](#output\_project) | GCloud Project ID | | <a name="output_project"></a> [project](#output\_project) | GCloud Project ID |

10
flux.tf
View File

@ -1,5 +1,5 @@
resource "kubernetes_namespace" "flux-system" { # resource "kubernetes_namespace" "flux-system" {
metadata { # metadata {
name = "flux-system" # name = "flux-system"
} # }
} # }

5
gke.tf
View File

@ -9,8 +9,9 @@ resource "google_container_cluster" "primary" {
remove_default_node_pool = true remove_default_node_pool = true
initial_node_count = 1 initial_node_count = 1
network = google_compute_network.vpc.name network = google_compute_network.vpc.name
subnetwork = google_compute_subnetwork.subnet.name subnetwork = google_compute_subnetwork.subnet.name
# min_master_version = "1.26.5-gke.1200"
} }
# Separately Managed Node Pool # Separately Managed Node Pool

View File

@ -1,19 +1,34 @@
output "region" { output "region" {
value = var.region
description = "GCloud Region" description = "GCloud Region"
value = var.region
} }
output "project" { output "project" {
value = var.project
description = "GCloud Project ID" description = "GCloud Project ID"
value = var.project
} }
output "kubernetes_cluster_name" { output "kubernetes_cluster_name" {
value = google_container_cluster.primary.name
description = "GKE Cluster Name" description = "GKE Cluster Name"
value = google_container_cluster.primary.name
} }
output "kubernetes_cluster_host" { output "kubernetes_cluster_host" {
value = google_container_cluster.primary.endpoint
description = "GKE Cluster Host" 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}"
} }

View File

@ -21,6 +21,12 @@ variable "region" {
default = "us-central1" default = "us-central1"
} }
variable "zone" {
type = string
description = "The region to host the cluster in"
default = "us-central1-b"
}
variable "gke_num_nodes" { variable "gke_num_nodes" {
default = 1 default = 1
description = "number of gke nodes" description = "number of gke nodes"

View File

@ -1,14 +1,14 @@
terraform { terraform {
required_version = "~>1.4.2" required_version = "~>1.7.0"
required_providers { required_providers {
google = { google = {
source = "hashicorp/google" # https://github.com/hashicorp/terraform-provider-google source = "hashicorp/google" # https://github.com/hashicorp/terraform-provider-google
version = "~>4.62.0" version = "~>5.27.0"
} }
kubernetes = { kubernetes = {
source = "hashicorp/kubernetes" # https://github.com/hashicorp/terraform-provider-kubernetes source = "hashicorp/kubernetes" # https://github.com/hashicorp/terraform-provider-kubernetes
version = "~>2.19.0" version = "~>2.29.0"
} }
} }
} }