Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/consul-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ This module creates Firewall rules that allow inbound requests as follows:

* **Consul**: For all the [ports used by Consul](https://www.consul.io/docs/agent/options.html#ports), all members of
the Consul Server cluster will automatically accept inbound traffic based on a [tag](
https://cloud.google.com/compute/docs/vpc/add-remove-network-tags) shared by all cluster members.
https://cloud.google.com/compute/docs/vpc/add-remove-network-tags) shared by all cluster members.
If necessary, you can use the `allowed_inbound_cidr_blocks_cluster` parameter to control the list of [CIDR blocks](
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) where you want agents to be able to communicate with
the cluster (when network tag is not enough).

* **External HTTP API Access**: For external access to the Consul Server cluster over the HTTP API port (default: 8500),
you can use the `allowed_inbound_cidr_blocks_http_api` parameter to control the list of [CIDR blocks](
Expand Down
5 changes: 3 additions & 2 deletions modules/consul-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ resource "google_compute_firewall" "allow_intracluster_consul" {
]
}

source_tags = [var.cluster_tag_name]
target_tags = [var.cluster_tag_name]
source_ranges = var.allowed_inbound_cidr_blocks_cluster
source_tags = [var.cluster_tag_name]
target_tags = [var.cluster_tag_name]
}

# Specify which traffic is allowed into the Consul Cluster solely for HTTP API requests
Expand Down
6 changes: 6 additions & 0 deletions modules/consul-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ variable "instance_group_update_strategy" {
default = "NONE"
}

variable "allowed_inbound_cidr_blocks_cluster" {
description = "A list of CIDR-formatted IP address ranges from which the Compute Instances will allow cluster connections to Consul."
type = list(string)
default = []
}

variable "allowed_inbound_cidr_blocks_http_api" {
description = "A list of CIDR-formatted IP address ranges from which the Compute Instances will allow API connections to Consul."
type = list(string)
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ variable "consul_client_cluster_size" {
default = 3
}

variable "consul_server_allowed_inbound_cidr_blocks_cluster" {
description = "A list of CIDR-formatted IP address ranges from which the Compute Instances will allow cluster connections to Consul."
type = list(string)
default = []
}

variable "consul_server_allowed_inbound_cidr_blocks_http_api" {
description = "A list of CIDR-formatted IP address ranges from which the Compute Instances will allow API connections to Consul."
type = list(string)
Expand Down