Skip to content

Commit

Permalink
feat!: Adds support for labels (#45)
Browse files Browse the repository at this point in the history
* Adds support for labels on forwarding rules

* Use beta provider for labels support

* Adds support for labels

* Adds provider_meta

* resolves merge conflicts
  • Loading branch information
willroberts authored Jun 22, 2022
1 parent 11637e4 commit 08b00ea
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Full functional examples are located in the [examples](./examples/) directory.
| health\_check | Health check to determine whether instances are responsive and able to do work | <pre>object({<br> check_interval_sec = number<br> healthy_threshold = number<br> timeout_sec = number<br> unhealthy_threshold = number<br> port = number<br> request_path = string<br> host = string<br> })</pre> | <pre>{<br> "check_interval_sec": null,<br> "healthy_threshold": null,<br> "host": null,<br> "port": null,<br> "request_path": null,<br> "timeout_sec": null,<br> "unhealthy_threshold": null<br>}</pre> | no |
| ip\_address | IP address of the external load balancer, if empty one will be assigned. | `any` | `null` | no |
| ip\_protocol | The IP protocol for the frontend forwarding rule and firewall rule. TCP, UDP, ESP, AH, SCTP or ICMP. | `string` | `"TCP"` | no |
| labels | The labels to attach to resources created by this module. | `map(string)` | `{}` | no |
| name | Name for the forwarding rule and prefix for supporting resources. | `string` | n/a | yes |
| network | Name of the network to create resources in. | `string` | `"default"` | no |
| project | The project to deploy to, if not set the default provider project is used. | `string` | `""` | no |
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ locals {
}

resource "google_compute_forwarding_rule" "default" {
provider = google-beta
project = var.project
name = var.name
target = google_compute_target_pool.default.self_link
Expand All @@ -27,6 +28,7 @@ resource "google_compute_forwarding_rule" "default" {
region = var.region
ip_address = var.ip_address
ip_protocol = var.ip_protocol
labels = var.labels
}

resource "google_compute_target_pool" "default" {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,10 @@ variable "allowed_ips" {
description = "The IP address ranges which can access the load balancer."
default = ["0.0.0.0/0"]
type = list(string)
}

variable "labels" {
description = "The labels to attach to resources created by this module."
default = {}
type = map(string)
}
9 changes: 8 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,22 @@
terraform {
required_version = ">= 0.13"
required_providers {

google = {
source = "hashicorp/google"
version = ">= 3.53, < 5.0"
}

google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.53, < 5.0"
}
}

provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-lb/v3.1.0"
}

provider_meta "google-beta" {
module_name = "blueprints/terraform/terraform-google-lb/v3.1.0"
}
}

0 comments on commit 08b00ea

Please sign in to comment.