Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Commit

Permalink
Ops Manager VMs have static IPs.
Browse files Browse the repository at this point in the history
[#152260182]

Signed-off-by: Genevieve LEsperance <[email protected]>
  • Loading branch information
mcwumbly authored and Genevieve LEsperance committed Oct 30, 2017
1 parent e4ab29d commit ac3c854
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions ops_manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ resource "google_compute_image" "optional-ops-manager-image" {
}
}

resource "google_compute_address" "ops-manager-ip" {
name = "${var.env_name}-ops-manager-ip"
}

resource "google_compute_instance" "ops-manager" {
name = "${var.env_name}-ops-manager"
machine_type = "${var.opsman_machine_type}"
Expand All @@ -51,7 +55,7 @@ resource "google_compute_instance" "ops-manager" {
subnetwork = "${google_compute_subnetwork.management-subnet.name}"

access_config {
# Empty for ephemeral external IP allocation
nat_ip = "${google_compute_address.ops-manager-ip.address}"
}
}

Expand All @@ -66,6 +70,11 @@ resource "google_compute_instance" "ops-manager" {
}
}

resource "google_compute_address" "optional-ops-manager-ip" {
name = "${var.env_name}-optional-ops-manager-ip"
count = "${min(length(split("", var.optional_opsman_image_url)),1)}"
}

resource "google_compute_instance" "optional-ops-manager" {
name = "${var.env_name}-optional-ops-manager"
machine_type = "${var.opsman_machine_type}"
Expand All @@ -74,16 +83,18 @@ resource "google_compute_instance" "optional-ops-manager" {
create_timeout = 10
tags = ["${var.env_name}-ops-manager-external"]

disk {
image = "${google_compute_image.optional-ops-manager-image.self_link}"
size = 150
boot_disk {
initialize_params {
image = "${google_compute_image.optional-ops-manager-image.self_link}"
size = 150
}
}

network_interface {
subnetwork = "${google_compute_subnetwork.management-subnet.name}"

access_config {
# Empty for ephemeral external IP allocation
nat_ip = "${google_compute_address.optional-ops-manager-ip.address}"
}
}

Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ output "tcp_domain" {
}

output "ops_manager_public_ip" {
value = "${google_compute_instance.ops-manager.network_interface.0.access_config.0.assigned_nat_ip}"
value = "${google_compute_address.ops-manager-ip.address}"
}

output "optional_ops_manager_public_ip" {
value = "${google_compute_instance.optional-ops-manager.network_interface.0.access_config.0.assigned_nat_ip}"
value = "${google_compute_address.optional-ops-manager-ip.address}"
}

output "env_dns_zone_name_servers" {
Expand Down

0 comments on commit ac3c854

Please sign in to comment.