Skip to content

Commit

Permalink
Merge pull request #1 from netMedi/update-to-work-with-newer-gcloud-p…
Browse files Browse the repository at this point in the history
…rovider

Update to work with newer gcloud provider
  • Loading branch information
slaapotti authored Jun 19, 2019
2 parents 381d7b5 + 6aeeed7 commit baf98e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
26 changes: 7 additions & 19 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ data "google_compute_address" "default" {
count = "${var.ip_address_name == "" ? 0 : 1}"
name = "${var.ip_address_name}"
project = "${var.network_project == "" ? var.project : var.network_project}"
region = "${var.region}"
location = "${var.location}"
}

locals {
zone = "${var.zone == "" ? lookup(var.region_params["${var.region}"], "zone") : var.zone}"
zone = "${var.zone == "" ? lookup(var.region_params["${var.location}"], "zone") : var.zone}"
name = "${var.name}nat-gateway-${local.zone}"
instance_tags = ["inst-${local.zonal_tag}", "inst-${local.regional_tag}"]
zonal_tag = "${var.name}nat-${local.zone}"
regional_tag = "${var.name}nat-${var.region}"
regional_tag = "${var.name}nat-${var.location}"
}

module "nat-gateway" {
source = "GoogleCloudPlatform/managed-instance-group/google"
version = "1.1.15"
source = "git::ssh://git@github.com/netMedi/terraform-google-managed-instance-group.git"
version = "1.2"
module_enabled = "${var.module_enabled}"
project = "${var.project}"
region = "${var.region}"
location = "${var.location}"
zone = "${local.zone}"
network = "${var.network}"
subnetwork = "${var.subnetwork}"
Expand All @@ -71,18 +71,6 @@ module "nat-gateway" {
ssh_source_ranges = "${var.ssh_source_ranges}"
http_health_check = "${var.autohealing_enabled}"

update_strategy = "ROLLING_UPDATE"

rolling_update_policy = [
{
type = "PROACTIVE"
minimal_action = "REPLACE"
max_surge_fixed = 0
max_unavailable_fixed = 1
min_ready_sec = 30
},
]

access_config = [
{
nat_ip = "${element(concat(google_compute_address.default.*.address, data.google_compute_address.default.*.address, list("")), 0)}"
Expand Down Expand Up @@ -120,5 +108,5 @@ resource "google_compute_address" "default" {
count = "${var.module_enabled && var.ip_address_name == "" ? 1 : 0}"
name = "${local.zonal_tag}"
project = "${var.project}"
region = "${var.region}"
region = "${var.location}"
}
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ variable subnetwork {
default = "default"
}

variable region {
description = "The region to create the nat gateway instance in."
variable location {
description = "The location to create the nat gateway instance in."
}

variable zone {
Expand Down Expand Up @@ -71,7 +71,7 @@ variable route_priority {

variable machine_type {
description = "The machine type for the NAT gateway instance"
default = "n1-standard-1"
default = "g1-small"
}

variable compute_image {
Expand Down

0 comments on commit baf98e5

Please sign in to comment.