Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

added external_ip_address and use_external_ip_address variables #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danisla
Copy link
Contributor

@danisla danisla commented Jan 10, 2019

This PR adds 2 new variables external_ip_address and use_external_ip_address to allow the module to use an address from and existing google_compute_address created with Terraform in the same workspace.

Example usage:

resource "google_compute_address" "ip_address" {
  name   = "my-address"
  region = "us-central1"
}

module "nat-gateway" {
  source  = "GoogleCloudPlatform/nat-gateway/google"
  version = "1.2.3"

  region                  = "us-central1"
  external_ip_address     = "${google_compute_address.ip_address.address}"
  use_external_ip_address = "true"
}

@AndrewFarley
Copy link
Contributor

AndrewFarley commented Feb 13, 2019

Does it really need two variables for this? The if statement in count, doesn't it make sense to simply check if the external_ip_address is set and not empty? KISS and all, is there a use case where you would ever set external_ip_address and not set use_external_ip_address? And wouldn't we also need variable definitions for these? Or are we now requiring the latest 0.12+ version of Terraform for this module which makes that obsolete?

@patrickbsf
Copy link

The prior code with the count failed because of Terraform problems with computed values being used in evaluation of counts. It would fail hard if you tried to define the address in the same workspace as a dependency. Personally I just ended up moving all my IP creations to an independent workspace because I couldn't wait for this fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants