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

Commit

Permalink
Merge branch 'ops-man-image-refactor' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneadams authored and mariash committed Sep 10, 2020
2 parents 965929a + dc4262f commit f76c2df
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ project = "your-gcp-project"
region = "us-central1"
zones = ["us-central1-a", "us-central1-b", "us-central1-c"]
dns_suffix = "gcp.some-project.cf-app.com"
opsman_image = "ops-manager-2-10-build-48"
opsman_image_url = "https://storage.googleapis.com/ops-manager-us/pcf-gcp-2.0-build.264.tar.gz"
buckets_location = "US"
Expand Down
2 changes: 1 addition & 1 deletion modules/ops_manager/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "google_dns_record_set" "optional-ops-manager-dns" {
name = "pcf-optional.${var.dns_zone_dns_name}"
type = "A"
ttl = 300
count = "${min(length(split("", var.optional_opsman_image_url)),1)}"
count = "${min(length(split("", var.optional_opsman_image)),1)}"

managed_zone = "${var.dns_zone_name}"

Expand Down
2 changes: 1 addition & 1 deletion modules/ops_manager/eip.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ resource "google_compute_address" "ops-manager-ip" {

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)}"
count = "${min(length(split("", var.optional_opsman_image)),1)}"
}
40 changes: 20 additions & 20 deletions modules/ops_manager/image.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
resource "google_compute_image" "ops-manager-image" {
name = "${var.env_name}-ops-manager-image"
count = "${var.opsman_image_url == "" ? 0 : 1}"
# resource "google_compute_image" "ops-manager-image" {
# name = "${var.env_name}-ops-manager-image"
# count = "${var.opsman_image_url == "" ? 0 : 1}"

timeouts {
create = "20m"
}
# timeouts {
# create = "20m"
# }

raw_disk {
source = "https://storage.googleapis.com/ops-manager-${replace(var.opsman_image_url, "/.*ops-manager-(.*)/", "$1")}"
}
}
# raw_disk {
# source = "${var.optional_opsman_image_url}"
# }
# }

resource "google_compute_image" "optional-ops-manager-image" {
name = "${var.env_name}-optional-ops-manager-image"
count = "${var.optional_opsman_image_url == "" ? 0 : 1}"
# resource "google_compute_image" "optional-ops-manager-image" {
# name = "${var.env_name}-optional-ops-manager-image"
# count = "${var.optional_opsman_image_url == "" ? 0 : 1}"

timeouts {
create = "20m"
}
# timeouts {
# create = "20m"
# }

raw_disk {
source = "${var.optional_opsman_image_url}"
}
}
# raw_disk {
# source = "${var.optional_opsman_image_url}"
# }
# }
4 changes: 2 additions & 2 deletions modules/ops_manager/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ resource "google_compute_instance" "ops-manager" {
machine_type = "${var.opsman_machine_type}"
zone = "${element(var.zones, 1)}"
tags = ["${var.env_name}-ops-manager-external"]
count = "${var.opsman_image_url == "" ? 0 : 1}"
count = "${var.opsman_image == "" ? 0 : 1}"

timeouts {
create = "${var.ops_man_image_creation_timeout}"
}

boot_disk {
initialize_params {
image = "${google_compute_image.ops-manager-image.self_link}"
image = "projects/pivotal-ops-manager-images/global/images/${var.opsman_image}"
type = "pd-ssd"
size = 150
}
Expand Down
4 changes: 2 additions & 2 deletions modules/ops_manager/optional_instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "google_compute_instance" "optional-ops-manager" {
name = "${var.env_name}-optional-ops-manager"
machine_type = "${var.opsman_machine_type}"
zone = "${element(var.zones, 1)}"
count = "${min(length(split("", var.optional_opsman_image_url)),1)}"
count = "${min(length(split("", var.optional_opsman_image)),1)}"
tags = ["${var.env_name}-ops-manager-external"]

timeouts {
Expand All @@ -11,7 +11,7 @@ resource "google_compute_instance" "optional-ops-manager" {

boot_disk {
initialize_params {
image = "${google_compute_image.optional-ops-manager-image.self_link}"
image = "projects/pivotal-ops-manager-images/global/images/${var.opsman_image}"
size = 150
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/ops_manager/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ variable "zones" {

variable "opsman_machine_type" {}
variable "opsman_storage_bucket_count" {}
variable "opsman_image_url" {}
variable "opsman_image" {}

variable "optional_opsman_image_url" {
variable "optional_opsman_image" {
default = ""
}

Expand Down
4 changes: 2 additions & 2 deletions terraforming-pas/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module "ops_manager" {
opsman_storage_bucket_count = "${var.opsman_storage_bucket_count}"

opsman_machine_type = "${var.opsman_machine_type}"
opsman_image_url = "${var.opsman_image_url}"
optional_opsman_image_url = "${var.optional_opsman_image_url}"
opsman_image = "${var.opsman_image}"
optional_opsman_image = "${var.optional_opsman_image}"
create_iam_service_account_members = "${var.create_iam_service_account_members}"

pcf_network_name = "${module.infra.network}"
Expand Down
8 changes: 4 additions & 4 deletions terraforming-pas/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ variable "zones" {
type = "list"
}

variable "opsman_image_url" {
variable "opsman_image" {
type = "string"
description = "Location of ops manager image on google cloud storage"
description = "Name of ops manager image"
}

variable "optional_opsman_image_url" {
variable "optional_opsman_image" {
type = "string"
description = "Location of ops manager image (to be used for optional extra instance) on google cloud storage"
description = "Name of ops manager image (to be used for optional extra instance)"
default = ""
}

Expand Down

0 comments on commit f76c2df

Please sign in to comment.