init
This commit is contained in:
16
modules/sg-rule-add/main.tf
Normal file
16
modules/sg-rule-add/main.tf
Normal file
@ -0,0 +1,16 @@
|
||||
resource "aws_security_group_rule" "sg-rule-add" {
|
||||
# description = "Security groups rule add"
|
||||
|
||||
type = var.type
|
||||
// rules
|
||||
for_each = var.rules
|
||||
from_port = each.value.from_port
|
||||
to_port = each.value.to_port
|
||||
protocol = each.value.protocol
|
||||
cidr_blocks = [each.value.cidr_blocks]
|
||||
|
||||
security_group_id = var.security_group_id
|
||||
|
||||
description = "${var.tag_name}-sg-rule"
|
||||
|
||||
}
|
||||
0
modules/sg-rule-add/outputs.tf
Normal file
0
modules/sg-rule-add/outputs.tf
Normal file
34
modules/sg-rule-add/variables.tf
Normal file
34
modules/sg-rule-add/variables.tf
Normal file
@ -0,0 +1,34 @@
|
||||
variable "type" {
|
||||
description = "security rule type"
|
||||
type = string
|
||||
}
|
||||
# variable "from_port" {
|
||||
# description = "from port"
|
||||
# type = number
|
||||
# }
|
||||
# variable "to_port" {
|
||||
# description = "to_port"
|
||||
# type = number
|
||||
# }
|
||||
# variable "protocol" {
|
||||
# description = "protocol"
|
||||
# type = string
|
||||
# }
|
||||
# variable "cidr_blocks" {
|
||||
# description = "cidr_blocks"
|
||||
# type = list(string)
|
||||
# }
|
||||
|
||||
variable "rules" {
|
||||
description = "sg rules"
|
||||
type = map(map(string))
|
||||
|
||||
}
|
||||
|
||||
variable "security_group_id" {
|
||||
|
||||
}
|
||||
variable "tag_name" {
|
||||
description = "tag_name"
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user