2022-04-07 06:49:07 -07:00
|
|
|
# Copyright 2022 Google LLC
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "ad_domain_fqdn" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Active Directory domain (FQDN)."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
validation {
|
|
|
|
condition = length(var.ad_domain_fqdn) > 0
|
|
|
|
error_message = "Active Directory domain needs to be specified."
|
|
|
|
}
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "ad_domain_netbios" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Active Directory domain (NetBIOS)."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
validation {
|
|
|
|
condition = length(var.ad_domain_netbios) > 0
|
|
|
|
error_message = "Active Directory domain needs to be specified."
|
|
|
|
}
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "always_on_groups" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "List of Always On Groups."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = list(string)
|
|
|
|
default = ["bookshelf"]
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "boot_disk_size" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Boot disk size in GB."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = number
|
|
|
|
default = 50
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "cluster_name" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Cluster name (prepended with prefix)."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "cluster"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "data_disk_size" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Database disk size in GB."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = number
|
|
|
|
default = 200
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "health_check_config" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Health check configuration."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = object({ check_interval_sec = number,
|
|
|
|
healthy_threshold = number,
|
|
|
|
unhealthy_threshold = number,
|
|
|
|
timeout_sec = number,
|
|
|
|
})
|
|
|
|
default = {
|
|
|
|
check_interval_sec = 2
|
|
|
|
healthy_threshold = 1
|
|
|
|
unhealthy_threshold = 2
|
|
|
|
timeout_sec = 1
|
|
|
|
}
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "health_check_port" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Health check port."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = number
|
|
|
|
default = 59997
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "health_check_ranges" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Health check ranges."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = list(string)
|
|
|
|
default = ["35.191.0.0/16", "209.85.152.0/22", "209.85.204.0/22"]
|
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "managed_ad_dn" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Managed Active Directory domain (eg. OU=Cloud,DC=example,DC=com)."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = ""
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "network" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Network to use in the project."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "node_image" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "SQL Server node machine image."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
|
|
|
default = "projects/windows-sql-cloud/global/images/family/sql-ent-2019-win-2019"
|
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "node_instance_type" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "SQL Server database node instance type."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "n2-standard-8"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "node_name" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Node base name."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = string
|
|
|
|
default = "node"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "prefix" {
|
2022-11-23 02:09:00 -08:00
|
|
|
description = "Prefix used for resource names."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = string
|
2022-11-23 02:09:00 -08:00
|
|
|
validation {
|
|
|
|
condition = var.prefix != ""
|
|
|
|
error_message = "Prefix cannot be empty."
|
|
|
|
}
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "project_create" {
|
|
|
|
description = "Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format."
|
|
|
|
type = object({
|
|
|
|
billing_account_id = string
|
|
|
|
parent = string
|
|
|
|
})
|
|
|
|
default = null
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "project_id" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Google Cloud project ID."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "region" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Region for resources."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "europe-west4"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "shared_vpc_project_id" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Shared VPC project ID for firewall rules."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = null
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "sql_admin_password" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Password for the SQL admin user to be created."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = string
|
|
|
|
validation {
|
|
|
|
condition = length(var.sql_admin_password) > 0
|
|
|
|
error_message = "SQL administrator password needs to be specified."
|
|
|
|
}
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "sql_client_cidrs" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "CIDR ranges that are allowed to connect to SQL Server."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = list(string)
|
|
|
|
default = ["0.0.0.0/0"]
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "subnetwork" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Subnetwork to use in the project."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = string
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "vpc_ip_cidr_range" {
|
|
|
|
description = "Ip range used in the subnet deployef in the Service Project."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "10.0.0.0/20"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "witness_image" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "SQL Server witness machine image."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "projects/windows-cloud/global/images/family/windows-2019"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "witness_instance_type" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "SQL Server witness node instance type."
|
2022-11-19 03:38:37 -08:00
|
|
|
type = string
|
|
|
|
default = "n2-standard-2"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|
|
|
|
|
2022-11-19 03:38:37 -08:00
|
|
|
variable "witness_name" {
|
2022-11-24 09:56:01 -08:00
|
|
|
description = "Witness base name."
|
2022-04-07 06:49:07 -07:00
|
|
|
type = string
|
2022-11-19 03:38:37 -08:00
|
|
|
default = "witness"
|
2022-04-07 06:49:07 -07:00
|
|
|
}
|