Skip to content

Commit b91c587

Browse files
authored
feat: add allowed_ip_ranges variable (#21)
1 parent 1fba8c7 commit b91c587

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

modules/create_environment/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module "composer" {
5353
| subnetwork\_region | The subnetwork region of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
5454
| tags | Tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls. | `set(string)` | `[]` | no |
5555
| use\_ip\_aliases | Enable Alias IPs in the GKE cluster. If true, a VPC-native cluster is created. | `bool` | `false` | no |
56+
| web\_server\_allowed\_ip\_ranges | The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions will be applied. | <pre>list(object({<br> value = string,<br> description = string<br> }))</pre> | `null` | no |
5657
| web\_server\_ipv4\_cidr | The CIDR block from which IP range in tenant project will be reserved for the web server. | `string` | `null` | no |
5758
| zone | Zone where the Cloud Composer nodes are created. | `string` | `"us-central1-f"` | no |
5859

modules/create_environment/main.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ resource "google_composer_environment" "composer_env" {
5050
}
5151
}
5252

53+
dynamic "web_server_network_access_control" {
54+
for_each = var.web_server_allowed_ip_ranges == null ? [] : [1]
55+
content {
56+
dynamic "allowed_ip_range" {
57+
for_each = var.web_server_allowed_ip_ranges
58+
content {
59+
value = allowed_ip_range.value.value
60+
description = allowed_ip_range.value.description
61+
}
62+
}
63+
}
64+
}
65+
5366
dynamic "private_environment_config" {
5467
for_each = var.use_ip_aliases ? [
5568
{

modules/create_environment/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,12 @@ variable "kms_key_name" {
177177
type = string
178178
default = null
179179
}
180+
181+
variable "web_server_allowed_ip_ranges" {
182+
description = "The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions will be applied."
183+
default = null
184+
type = list(object({
185+
value = string,
186+
description = string
187+
}))
188+
}

0 commit comments

Comments
 (0)