Skip to content

Commit 7eef1cf

Browse files
authored
Revert "Add cloud nat submodule (#22)" (#23)
This reverts commit 4993891.
1 parent 4993891 commit 7eef1cf

File tree

8 files changed

+20
-69
lines changed

8 files changed

+20
-69
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ No requirements.
8181

8282
| Name | Source | Version |
8383
|------|--------|---------|
84-
| <a name="module_cloud_nat"></a> [cloud\_nat](#module\_cloud\_nat) | ./modules/cloud-nat | n/a |
84+
| <a name="module_cloud_nat"></a> [cloud\_nat](#module\_cloud\_nat) | registry.terraform.io/terraform-google-modules/cloud-nat/google | 5.1.0 |
8585
| <a name="module_network"></a> [network](#module\_network) | registry.terraform.io/terraform-google-modules/network/google | 9.1.0 |
8686
| <a name="module_project"></a> [project](#module\_project) | registry.terraform.io/terraform-google-modules/project-factory/google | 15.0.1 |
8787
| <a name="module_project_services"></a> [project\_services](#module\_project\_services) | terraform-google-modules/project-factory/google//modules/project_services | 15.0.1 |
@@ -92,6 +92,7 @@ No requirements.
9292
|------|------|
9393
| [google-beta_google_container_node_pool.pools](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_container_node_pool) | resource |
9494
| [google_artifact_registry_repository.my-repo](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/artifact_registry_repository) | resource |
95+
| [google_compute_address.cloud_nat_address](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_address) | resource |
9596
| [google_container_cluster.gke](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster) | resource |
9697

9798
## Inputs

examples/existing-project/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module "gke" {
1010
regional = false
1111
zones = ["europe-central2-a"]
1212
cluster_deletion_protection = false
13-
enable_private_nodes = true
1413
node_pools = {
1514
default-pool = {
1615
disk_size_gb = 50

main.tf

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,24 @@ module "network" {
4848
}
4949
}
5050

51+
resource "google_compute_address" "cloud_nat_address" {
52+
name = local.cloud_nat_name
53+
project = local.project_id
54+
region = var.region
55+
count = var.enable_private_nodes ? 1 : 0
56+
}
57+
5158
module "cloud_nat" {
52-
source = "./modules/cloud-nat"
53-
project_id = local.project_id
54-
region = var.region
55-
network = module.network.network_name
56-
router = local.router
57-
name = local.cloud_nat_name
58-
count = var.enable_private_nodes ? 1 : 0
59+
source = "registry.terraform.io/terraform-google-modules/cloud-nat/google"
60+
version = "5.1.0"
61+
project_id = local.project_id
62+
region = var.region
63+
network = module.network.network_name
64+
create_router = true
65+
router = local.router
66+
name = local.cloud_nat_name
67+
nat_ips = [google_compute_address.cloud_nat_address.0.self_link]
68+
count = var.enable_private_nodes ? 1 : 0
5969
}
6070

6171
resource "google_container_cluster" "gke" {

modules/cloud-nat/locals.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

modules/cloud-nat/main.tf

Lines changed: 0 additions & 23 deletions
This file was deleted.

modules/cloud-nat/outputs.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.

modules/cloud-nat/variables.tf

Lines changed: 0 additions & 30 deletions
This file was deleted.

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ output "gke_zones" {
4343
description = "List of zones where the cluster lives"
4444
}
4545
output "nat_ip" {
46-
value = module.cloud_nat.*.cloud_nat_ip
46+
value = google_compute_address.cloud_nat_address.*.address
4747
description = "The IP address allocated for NAT"
4848
}
4949
output "subnetwork_name" {

0 commit comments

Comments
 (0)