45 lines
1.2 KiB
HCL
45 lines
1.2 KiB
HCL
variable "project_id" {
|
|
type = string
|
|
description = "The ID of the project where the security group will be created."
|
|
}
|
|
|
|
variable "name" {
|
|
type = string
|
|
description = "Name of the security group."
|
|
}
|
|
|
|
variable "description" {
|
|
type = string
|
|
default = ""
|
|
description = "Description of the security group. If not provided, it defaults to an empty string."
|
|
}
|
|
|
|
variable "rules" {
|
|
description = "List of rules to attach to this security-group"
|
|
type = list(object({
|
|
direction = string
|
|
description = optional(string)
|
|
ether_type = optional(string)
|
|
icmp_parameters = optional(object({
|
|
type = optional(number)
|
|
code = optional(number)
|
|
}))
|
|
ip_range = optional(string)
|
|
port_range = optional(object({
|
|
min = number
|
|
max = number
|
|
}))
|
|
protocol = optional(object({
|
|
name = optional(string)
|
|
}))
|
|
remote_security_group_id = optional(string)
|
|
}))
|
|
default = []
|
|
validation {
|
|
condition = alltrue([
|
|
for rule in var.rules : contains(["ingress", "egress"], rule.direction)
|
|
# ... need more validations
|
|
])
|
|
error_message = "Direction must be either \"ingress\" or \"egress\"."
|
|
}
|
|
}
|