Skip to content

Commit

Permalink
Merge pull request #127 from redpanda-data/various-fixes
Browse files Browse the repository at this point in the history
gcp cleanup and labeling
  • Loading branch information
gene-redpanda committed Feb 2, 2023
2 parents e18a09a + 11632c0 commit d32cad2
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ hosts.ini
aws/_override.tf
gcp/_override.tf
azure/_override.tf
ibm/_override.tf
*.tfvars
ibm/_override.tf
48 changes: 24 additions & 24 deletions README.md

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions gcp/cluster.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
provider "google" {
project = var.project_name
region = var.region
zone = "${var.region}-${var.zone}"
}

resource "random_uuid" "cluster" {}

locals {
uuid = random_uuid.cluster.result
deployment_id = "${random_uuid.cluster.result}"
deployment_id = random_uuid.cluster.result
}

resource "google_compute_resource_policy" "redpanda-rp" {
Expand Down Expand Up @@ -58,6 +52,8 @@ KEYS
access_config {
}
}

labels = tomap(var.labels)
}

resource "google_compute_instance" "monitor" {
Expand Down Expand Up @@ -89,6 +85,7 @@ KEYS
}
}

labels = tomap(var.labels)
}

resource "google_compute_instance" "client" {
Expand Down Expand Up @@ -119,14 +116,15 @@ KEYS
access_config {
}
}
labels = tomap(var.labels)
}

resource "google_compute_instance_group" "redpanda" {
name = "redpanda-group-${local.deployment_id}"
zone = "${var.region}-${var.zone}"
instances = "${concat(google_compute_instance.redpanda.*.self_link,
instances = concat(google_compute_instance.redpanda.*.self_link,
google_compute_instance.client.*.self_link,
[google_compute_instance.monitor[0].self_link])}"
[google_compute_instance.monitor[0].self_link])
}

resource "local_file" "hosts_ini" {
Expand Down
5 changes: 5 additions & 0 deletions gcp/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "google" {
project = var.project_name
region = var.region
zone = "${var.region}-${var.zone}"
}
3 changes: 2 additions & 1 deletion gcp/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ After completing these steps, please follow the required steps in the [project r
- `ssh_user`: The ssh user. Must match the one in the public ssh key's comments.
- `ha`: Enable high availability mode. In this mode (which supports up to 8 nodes), instances will be deployed into a Compute Resource Policy with an availability domain for each node. N.B. GCP does not currently have a mode which allows you to knowingly co-locate specific nodes into a smaller number of availability domains (see [Google Issue 256993209](https://issuetracker.google.com/issues/256993209)).

Example: `terraform apply -var nodes=3 -var project_name=myproject -var subnet=redpanda-cluster-subnet -var public_key_path=~/.ssh/id_rsa.pub -var ssh_user=$USER`
We recommend putting all the variables you'd like to set as key=value pairs in a file named [redpanda.auto.tfvars](https://developer.hashicorp.com/terraform/language/values/variables#variable-definitions-tfvars-files) in this directory for convenience. However you can also set them at runtime using command line flags.
Example: `terraform apply -var nodes=3 -var project_name=myproject -var subnet=redpanda-cluster-subnet -var public_key_path=~/.ssh/id_rsa.pub -var ssh_user=$USER`
8 changes: 8 additions & 0 deletions gcp/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ variable "ssh_user" {
variable "enable_monitoring" {
default = "yes"
}

variable "labels" {
description = "passthrough of GCP labels"
default = {
"purpose" = "redpanda-cluster"
"created-with" = "terraform"
}
}

0 comments on commit d32cad2

Please sign in to comment.