Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support explicit reserved_ip_range for Filestore instances #2072

Merged
Merged
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
1 change: 1 addition & 0 deletions modules/file-system/filestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ No modules.
| <a name="input_network_id"></a> [network\_id](#input\_network\_id) | The ID of the GCE VPC network to which the instance is connected given in the format:<br>`projects/<project_id>/global/networks/<network_name>`" | `string` | n/a | yes |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | ID of project in which Filestore instance will be created. | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | Location for Filestore instances at Enterprise tier. | `string` | n/a | yes |
| <a name="input_reserved_ip_range"></a> [reserved\_ip\_range](#input\_reserved\_ip\_range) | Reserved IP range for Filestore instance (set to null to enable automatic selection) | `string` | `null` | no |
| <a name="input_size_gb"></a> [size\_gb](#input\_size\_gb) | Storage size of the filestore instance in GB. | `number` | `1024` | no |
| <a name="input_zone"></a> [zone](#input\_zone) | Location for Filestore instances below Enterprise tier. | `string` | n/a | yes |

Expand Down
7 changes: 4 additions & 3 deletions modules/file-system/filestore/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ resource "google_filestore_instance" "filestore_instance" {
labels = local.labels

networks {
network = local.shared_vpc ? var.network_id : local.network_name
connect_mode = var.connect_mode
modes = ["MODE_IPV4"]
network = local.shared_vpc ? var.network_id : local.network_name
connect_mode = var.connect_mode
modes = ["MODE_IPV4"]
reserved_ip_range = var.reserved_ip_range
}

dynamic "timeouts" {
Expand Down
12 changes: 12 additions & 0 deletions modules/file-system/filestore/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ variable "connect_mode" {
default = "DIRECT_PEERING"
}

variable "reserved_ip_range" {
description = "Reserved IP range for Filestore instance (set to null to enable automatic selection)"
type = string
default = null
nullable = true

validation {
condition = var.reserved_ip_range == null || can(cidrhost(var.reserved_ip_range, 0))
error_message = "IP address range must be in CIDR format."
}
}

variable "mount_options" {
description = "NFS mount options to mount file system."
type = string
Expand Down